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
7e6f877b
Commit
7e6f877b
authored
Jun 25, 2021
by
aniket-engg
Committed by
Aniket
Jul 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logs and comments in remixd
parent
65dc4826
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
remix-ui-static-analyser.tsx
...x-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+1
-1
slitherClient.ts
libs/remixd/src/services/slitherClient.ts
+19
-5
No files found.
libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
View file @
7e6f877b
...
...
@@ -213,7 +213,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const
{
currentVersion
,
optimize
,
evmVersion
}
=
compilerState
props
.
analysisModule
.
call
(
'slither'
,
'analyse'
,
state
.
file
,
{
currentVersion
,
optimize
,
evmVersion
}).
then
((
result
)
=>
{
if
(
result
.
status
)
{
props
.
analysisModule
.
call
(
'terminal'
,
'log'
,
{
type
:
'info'
,
value
:
`[Slither Analysis]:
Success
!!
${
result
.
count
}
warnings found.`
})
props
.
analysisModule
.
call
(
'terminal'
,
'log'
,
{
type
:
'info'
,
value
:
`[Slither Analysis]:
Analysis Completed
!!
${
result
.
count
}
warnings found.`
})
const
report
=
result
.
data
report
.
map
((
item
)
=>
{
let
location
:
any
=
{}
...
...
libs/remixd/src/services/slitherClient.ts
View file @
7e6f877b
...
...
@@ -50,27 +50,40 @@ export class SlitherClient extends PluginClient {
}
const
options
=
{
cwd
:
this
.
currentSharedFolder
,
shell
:
true
}
const
{
currentVersion
,
optimize
,
evmVersion
}
=
compilerConfig
if
(
currentVersion
)
{
if
(
currentVersion
&&
currentVersion
.
includes
(
'+commit'
))
{
// Get compiler version with commit id e.g: 0.8.2+commit.661d110
const
versionString
:
string
=
currentVersion
.
substring
(
0
,
currentVersion
.
indexOf
(
'+commit'
)
+
16
)
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
`[Slither Analysis]: Compiler version is
${
versionString
}
`
)
// Check solc current installed version
const
solcOutput
:
Buffer
=
execSync
(
'solc --version'
,
options
)
if
(
!
solcOutput
.
toString
().
includes
(
versionString
))
{
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
`[Slither Analysis]: Compiler version is different from installed solc version`
)
// Get compiler version without commit id e.g: 0.8.2
const
version
:
string
=
versionString
.
substring
(
0
,
versionString
.
indexOf
(
'+commit'
))
// List solc versions installed using solc-select
const
solcSelectInstalledVersions
:
Buffer
=
execSync
(
'solc-select versions'
,
options
)
// Check if required version is already installed
if
(
!
solcSelectInstalledVersions
.
toString
().
includes
(
version
))
{
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
`[Slither Analysis]: Installing
${
version
}
using solc-select`
)
// Install required version
execSync
(
`solc-select install
${
version
}
`
,
options
)
}
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
`[Slither Analysis]: Setting
${
version
}
as current solc version using solc-select`
)
// Set solc current version as required version
execSync
(
`solc-select use
${
version
}
`
,
options
)
}
}
else
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
`[Slither Analysis]: Compiler version is same as installed solc version`
)
}
const
outputFile
:
string
=
'remix-slitherReport_'
+
Date
.
now
()
+
'.json'
const
optimizeOption
:
string
=
optimize
?
'--optimize '
:
''
const
evmOption
:
string
=
evmVersion
?
`--evm-version
${
evmVersion
}
`
:
''
const
solcArgs
:
string
=
optimizeOption
||
evmOption
?
`--solc-args '
${
optimizeOption
}${
evmOption
}
'`
:
''
const
cmd
:
string
=
`slither
${
filePath
}
${
solcArgs
}
--json
${
outputFile
}
`
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
`[Slither Analysis]: Running Slither...`
)
const
child
=
spawn
(
cmd
,
options
)
const
response
=
{}
child
.
on
(
'close'
,
()
=>
{
const
outputFileAbsPath
:
string
=
`
${
this
.
currentSharedFolder
}
/
${
outputFile
}
`
// Check if slither report file exists
if
(
existsSync
(
outputFileAbsPath
))
{
let
report
=
readFileSync
(
outputFileAbsPath
,
'utf8'
)
report
=
JSON
.
parse
(
report
)
...
...
@@ -83,13 +96,14 @@ export class SlitherClient extends PluginClient {
response
[
'count'
]
=
detectors
.
length
response
[
'data'
]
=
this
.
transform
(
detectors
)
}
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
`[Slither Analysis]: Analysis Completed!!
${
response
[
'count'
]}
warnings found.`
)
resolve
(
response
)
}
else
{
console
.
log
(
'[Slither Analysis]: Error in running Slither Analysis'
)
console
.
log
(
'
\
x1b[31m%s
\
x1b[0m'
,
'
[Slither Analysis]: Error in running Slither Analysis'
)
console
.
log
(
report
[
'error'
])
reject
(
new
Error
(
'Error in running Slither Analysis. See remixd console.'
))
reject
(
new
Error
(
'Error in running Slither Analysis. See remixd console
for details
.'
))
}
}
else
reject
(
new
Error
(
'Error in generating Slither Analysis Report. See remixd console.'
))
}
else
reject
(
new
Error
(
'Error in generating Slither Analysis Report. See remixd console
for details
.'
))
})
})
}
...
...
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