From e1787787faeeed41bf64edec619ba7c98c0aba29 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 16 Aug 2021 13:27:18 +0200 Subject: [PATCH] fix slither arguments --- libs/remixd/src/services/slitherClient.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libs/remixd/src/services/slitherClient.ts b/libs/remixd/src/services/slitherClient.ts index 513be66f7e..3c56e4e807 100644 --- a/libs/remixd/src/services/slitherClient.ts +++ b/libs/remixd/src/services/slitherClient.ts @@ -121,24 +121,26 @@ export class SlitherClient extends PluginClient { remaps = remapString.trim() } const allowPathsOption: string = allowPaths ? `--allow-paths ${allowPaths}` : '' - const optimizeOption: string = optimize ? ' --optimize ' : '' - const evmOption: string = evmVersion ? ` --evm-version ${evmVersion}` : '' + 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) { - solcArgs += ' ' + evmOption - } - if (allowPathsOption) { - solcArgs += ' ' + allowPathsOption + if (!solcArgs.endsWith(' ')) solcArgs += ' ' + solcArgs += evmOption; } if (solcArgs) { - solcArgs = `--solc-args "${solcArgs.trim()}"` + solcArgs = `--solc-args "${solcArgs.trim()}"`; } const solcRemaps = remaps ? `--solc-remaps "${remaps}"` : '' - const outputFile: string = 'remix-slitherReport_' + Math.floor(Date.now() / 1000) + '.json' + const outputFile: string = 'remix-slitherReport.json' const cmd: string = `slither ${filePath} ${solcArgs} ${solcRemaps} --json ${outputFile}` console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Running Slither...') // Added `stdio: 'ignore'` as for contract with NPM imports analysis which is exported in 'stderr'