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
1c6facc3
Commit
1c6facc3
authored
Jun 17, 2021
by
aniket-engg
Committed by
Aniket
Jul 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
analyze, transform and return to IDE
parent
80f8d503
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
slitherClient.ts
libs/remixd/src/services/slitherClient.ts
+18
-12
index.ts
libs/remixd/src/types/index.ts
+1
-1
No files found.
libs/remixd/src/services/slitherClient.ts
View file @
1c6facc3
import
*
as
WS
from
'ws'
// eslint-disable-line
import
{
PluginClient
}
from
'@remixproject/plugin'
import
{
existsSync
,
readFileSync
}
from
'fs'
import
{
OutputStandard
}
from
'../types'
// eslint-disable-line
const
{
spawn
,
execSync
}
=
require
(
'child_process'
)
export
class
SlitherClient
extends
PluginClient
{
...
...
@@ -22,14 +23,21 @@ export class SlitherClient extends PluginClient {
}
transform
(
detectors
)
{
// detectors
// I/O standard mapping
// Analysis Description -> description
// Analysis Short title -> check
// Confidence -> confidence
// Severity -> impact
// Source Map -> elements[i].source_mapping (remove filename_used, filename_absolute)
const
standardReport
=
[]
for
(
let
e
of
detectors
)
{
let
obj
=
{}
obj
[
'description'
]
=
e
[
'description'
]
obj
[
'title'
]
=
e
.
check
obj
[
'confidence'
]
=
e
.
confidence
obj
[
'severity'
]
=
e
.
impact
obj
[
'sourceMap'
]
=
e
.
elements
.
map
((
element
)
=>
{
delete
element
.
source_mapping
[
'filename_used'
]
delete
element
.
source_mapping
[
'filename_absolute'
]
return
element
})
standardReport
.
push
(
obj
)
}
return
standardReport
}
analyse
(
filePath
:
string
,
compilerConfig
)
{
...
...
@@ -72,8 +80,8 @@ export class SlitherClient extends PluginClient {
child
.
on
(
'close'
,
()
=>
{
const
outputFileAbsPath
=
`
${
this
.
currentSharedFolder
}
/
${
outputFile
}
`
if
(
existsSync
(
outputFileAbsPath
))
{
cons
t
report
=
readFileSync
(
outputFileAbsPath
,
'utf8'
)
console
.
log
(
'report--->'
,
report
)
le
t
report
=
readFileSync
(
outputFileAbsPath
,
'utf8'
)
report
=
JSON
.
parse
(
report
)
if
(
report
[
'success'
])
{
response
[
'status'
]
=
true
if
(
!
report
[
'results'
]
||
!
report
[
'results'
].
detectors
||
!
report
[
'results'
].
detectors
.
length
)
{
...
...
@@ -90,8 +98,6 @@ export class SlitherClient extends PluginClient {
reject
(
new
Error
(
'Error in running Slither Analysis. See remixd console.'
))
}
}
else
reject
(
new
Error
(
'Error in generating Slither Analysis Report. See remixd console.'
))
// if (error) reject(error)
// else resolve(result)
})
})
}
...
...
libs/remixd/src/types/index.ts
View file @
1c6facc3
import
*
as
ServiceList
from
'../serviceList'
import
*
as
Websocket
from
'ws'
export
type
OutputStandard
=
{
export
interface
OutputStandard
{
description
:
string
title
:
string
confidence
:
string
...
...
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