|
|
|
@ -120,29 +120,25 @@ export class SlitherClient extends PluginClient { |
|
|
|
|
allowPaths = allowPathString |
|
|
|
|
remaps = remapString.trim() |
|
|
|
|
} |
|
|
|
|
const allowPathsOption: string = allowPaths ? `--allow-paths ${allowPaths}` : '' |
|
|
|
|
const optimizeOption: string = optimize ? '--optimize' : '' |
|
|
|
|
const evmOption: string = evmVersion ? `--evm-version ${evmVersion}` : '' |
|
|
|
|
let solcArgs = '' |
|
|
|
|
if (allowPathsOption) { |
|
|
|
|
if (!solcArgs.endsWith(' ')) solcArgs += ' ' |
|
|
|
|
solcArgs += allowPathsOption; |
|
|
|
|
} |
|
|
|
|
if (optimizeOption) { |
|
|
|
|
solcArgs += optimizeOption; |
|
|
|
|
solcArgs += optimizeOption + ' ' |
|
|
|
|
} |
|
|
|
|
if (evmOption) { |
|
|
|
|
if (!solcArgs.endsWith(' ')) solcArgs += ' ' |
|
|
|
|
solcArgs += evmOption; |
|
|
|
|
} |
|
|
|
|
if (solcArgs) { |
|
|
|
|
solcArgs = `--solc-args "${solcArgs.trim()}"`; |
|
|
|
|
solcArgs = `--solc-args "${solcArgs.trimStart()}"`; |
|
|
|
|
} |
|
|
|
|
const solcRemaps = remaps ? `--solc-remaps "${remaps}"` : '' |
|
|
|
|
|
|
|
|
|
const outputFile: string = 'remix-slitherReport.json' |
|
|
|
|
const outputFile: string = 'remix-slitherReport_' + Math.floor(Date.now() / 1000) + '.json' |
|
|
|
|
const cmd: string = `slither ${filePath} ${solcArgs} ${solcRemaps} --json ${outputFile}` |
|
|
|
|
console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Running Slither...') |
|
|
|
|
console.log(cmd) |
|
|
|
|
// Added `stdio: 'ignore'` as for contract with NPM imports analysis which is exported in 'stderr'
|
|
|
|
|
// get too big and hangs the process. We process analysis from the report file only
|
|
|
|
|
const child = spawn(cmd, { cwd: this.currentSharedFolder, shell: true, stdio: 'ignore' }) |
|
|
|
|