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
b3205690
Commit
b3205690
authored
Jan 29, 2021
by
aniket-engg
Committed by
Aniket
Feb 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments added
parent
be714b7c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
similarVariableNames.ts
...zer/src/solidity-analyzer/modules/similarVariableNames.ts
+3
-0
No files found.
libs/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.ts
View file @
b3205690
...
...
@@ -46,10 +46,13 @@ export default class similarVariableNames implements AnalyzerModule {
}
const
vars
:
string
[]
=
this
.
getFunctionVariables
(
contract
,
func
).
map
(
getDeclaredVariableName
)
this
.
findSimilarVarNames
(
vars
).
map
((
sim
)
=>
{
// check if function is implemented
if
(
func
.
node
.
implemented
)
{
const
astWalker
=
new
AstWalker
()
const
functionBody
:
any
=
func
.
node
.
body
// 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
))
{
warnings
.
push
({
warning
:
`
${
funcName
}
: Variables have very similar names "
${
sim
.
var1
}
" and "
${
sim
.
var2
}
".
${
hasModifiersComments
}
${
multipleContractsWithSameNameComments
}
`
,
...
...
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