Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
94c834cb
Commit
94c834cb
authored
Jan 29, 2021
by
aniket-engg
Committed by
Aniket
Feb 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check variable declaration too
parent
a3358c38
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
similarVariableNames.ts
...zer/src/solidity-analyzer/modules/similarVariableNames.ts
+2
-1
staticAnalysisIntegration-test-0.4.24.ts
...er/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
+1
-1
staticAnalysisIntegration-test-0.5.0.ts
...zer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
+2
-2
No files found.
libs/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.ts
View file @
94c834cb
...
...
@@ -53,7 +53,8 @@ export default class similarVariableNames implements AnalyzerModule {
// Walk through all statements of function
astWalker
.
walk
(
functionBody
,
(
node
)
=>
{
// check if these is an identifier node which is one of the tracked similar variables
if
(
node
.
nodeType
===
"Identifier"
&&
(
node
.
name
===
sim
.
var1
||
node
.
name
===
sim
.
var2
))
{
if
((
node
.
nodeType
===
'Identifier'
||
node
.
nodeType
===
'VariableDeclaration'
)
&&
(
node
.
name
===
sim
.
var1
||
node
.
name
===
sim
.
var2
))
{
warnings
.
push
({
warning
:
`
${
funcName
}
: Variables have very similar names "
${
sim
.
var1
}
" and "
${
sim
.
var2
}
".
${
hasModifiersComments
}
${
multipleContractsWithSameNameComments
}
`
,
location
:
node
[
'src'
]
...
...
libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.ts
View file @
94c834cb
...
...
@@ -283,7 +283,7 @@ test('Integration test similarVariableNames module', function (t: test.Test) {
'inheritance.sol'
:
0
,
'modifier1.sol'
:
0
,
'modifier2.sol'
:
0
,
'notReentrant.sol'
:
3
,
'notReentrant.sol'
:
4
,
'structReentrant.sol'
:
0
,
'thisLocal.sol'
:
0
,
'globals.sol'
:
0
,
...
...
libs/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
View file @
94c834cb
...
...
@@ -279,13 +279,13 @@ test('Integration test similarVariableNames module', function (t: test.Test) {
'KingOfTheEtherThrone.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
7
,
'ballot_reentrant.sol'
:
24
,
'ballot_reentrant.sol'
:
40
,
'ballot_withoutWarnings.sol'
:
0
,
'cross_contract.sol'
:
0
,
'inheritance.sol'
:
0
,
'modifier1.sol'
:
0
,
'modifier2.sol'
:
0
,
'notReentrant.sol'
:
3
,
'notReentrant.sol'
:
4
,
'structReentrant.sol'
:
0
,
'thisLocal.sol'
:
0
,
'globals.sol'
:
0
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment