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
5d69e682
Commit
5d69e682
authored
Jun 16, 2021
by
aniket-engg
Committed by
Aniket
Jul 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch solc to remic compiler version
parent
74320821
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
21 deletions
+36
-21
remix-ui-static-analyser.tsx
...x-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+4
-2
slitherClient.ts
libs/remixd/src/services/slitherClient.ts
+32
-19
No files found.
libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
View file @
5d69e682
...
...
@@ -108,8 +108,10 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
if
(
lastCompilationResult
&&
categoryIndex
.
length
>
0
)
{
let
warningCount
=
0
const
warningMessage
=
[]
props
.
analysisModule
.
call
(
'solidity-logic'
,
'getCompilerState'
).
then
(
console
.
log
)
// props.analysisModule.call('slither', 'analyse', state.file).then(console.log)
props
.
analysisModule
.
call
(
'solidity-logic'
,
'getCompilerState'
).
then
((
compilerState
)
=>
{
const
{
currentVersion
,
optimize
,
evmVersion
}
=
compilerState
props
.
analysisModule
.
call
(
'slither'
,
'analyse'
,
state
.
file
,
{
currentVersion
,
optimize
,
evmVersion
}).
then
(
console
.
log
)
})
runner
.
run
(
lastCompilationResult
,
categoryIndex
,
results
=>
{
results
.
map
((
result
)
=>
{
let
moduleName
...
...
libs/remixd/src/services/slitherClient.ts
View file @
5d69e682
import
*
as
WS
from
'ws'
// eslint-disable-line
import
{
PluginClient
}
from
'@remixproject/plugin'
const
{
spawn
}
=
require
(
'child_process'
)
const
{
spawn
,
execSync
}
=
require
(
'child_process'
)
export
class
SlitherClient
extends
PluginClient
{
methods
:
Array
<
string
>
...
...
@@ -20,30 +20,43 @@ export class SlitherClient extends PluginClient {
this
.
currentSharedFolder
=
currentSharedFolder
}
analyse
(
filePath
:
string
)
{
analyse
(
filePath
:
string
,
compilerConfig
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
readOnly
)
{
const
errMsg
=
'[Slither Analysis]: Cannot analyse in read-only mode'
return
reject
(
new
Error
(
errMsg
))
}
const
outputFile
=
'remix-slitherReport_'
+
Date
.
now
()
+
'.json'
const
cmd
=
`slither
${
filePath
}
--json
${
outputFile
}
`
const
options
=
{
cwd
:
this
.
currentSharedFolder
,
shell
:
true
}
const
child
=
spawn
(
cmd
,
options
)
let
result
=
''
let
error
=
''
child
.
stdout
.
on
(
'data'
,
(
data
)
=>
{
const
msg
=
`[Slither Analysis]:
${
data
.
toString
()}
`
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
msg
)
result
+=
msg
+
'
\
n'
})
child
.
stderr
.
on
(
'data'
,
(
err
)
=>
{
error
+=
`[Slither Analysis]:
${
err
.
toString
()}
`
})
child
.
on
(
'close'
,
()
=>
{
if
(
error
)
reject
(
error
)
else
resolve
(
result
)
})
const
{
currentVersion
,
optimize
,
evmVersion
}
=
compilerConfig
if
(
currentVersion
)
{
const
versionString
=
currentVersion
.
substring
(
0
,
currentVersion
.
indexOf
(
'+commit'
)
+
16
)
const
solcOutput
=
execSync
(
'solc --version'
,
options
)
if
(
!
solcOutput
.
toString
().
includes
(
versionString
))
{
const
version
=
versionString
.
substring
(
0
,
versionString
.
indexOf
(
'+commit'
))
const
solcSelectInstalledVersions
=
execSync
(
'solc-select versions'
,
options
)
if
(
!
solcSelectInstalledVersions
.
toString
().
includes
(
version
))
{
execSync
(
`solc-select install
${
version
}
`
,
options
)
}
execSync
(
`solc-select use
${
version
}
`
,
options
)
}
}
// const outputFile = 'remix-slitherReport_' + Date.now() + '.json'
// const cmd = `slither ${filePath} --json ${outputFile}`
// const child = spawn(cmd, options)
// let result = ''
// let error = ''
// child.stdout.on('data', (data) => {
// const msg = `[Slither Analysis]: ${data.toString()}`
// console.log('\x1b[32m%s\x1b[0m', msg)
// result += msg + '\n'
// })
// child.stderr.on('data', (err) => {
// error += `[Slither Analysis]: ${err.toString()}`
// })
// child.on('close', () => {
// if (error) reject(error)
// else resolve(result)
// })
})
}
}
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