|
|
|
@ -56,11 +56,17 @@ slitherEnabled: boolean, setStartAnalysis: React.Dispatch<React.SetStateAction<b |
|
|
|
|
const warningErrors = [] |
|
|
|
|
props.analysisModule.hints = [] |
|
|
|
|
// Run solhint
|
|
|
|
|
if (solhintEnabled) { |
|
|
|
|
_paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyze', 'solHint']) |
|
|
|
|
const hintsResult = await props.analysisModule.call('solhint', 'lint', state.file) |
|
|
|
|
props.analysisModule.hints = solhintEnabled === false ? 0 : hintsResult |
|
|
|
|
props.analysisModule.hints = hintsResult |
|
|
|
|
setHints(hintsResult) |
|
|
|
|
} else { |
|
|
|
|
props.analysisModule.hints = [] |
|
|
|
|
setHints([]) |
|
|
|
|
} |
|
|
|
|
// Remix Analysis
|
|
|
|
|
if (basicEnabled) { |
|
|
|
|
_paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyze', 'remixAnalyzer']) |
|
|
|
|
const results = runner.run(lastCompilationResult, categoryIndex) |
|
|
|
|
for (const result of results) { |
|
|
|
@ -99,8 +105,8 @@ slitherEnabled: boolean, setStartAnalysis: React.Dispatch<React.SetStateAction<b |
|
|
|
|
locationString = row + 1 + ':' + column + ':' |
|
|
|
|
fileName = Object.keys(lastCompilationResult.sources)[file] |
|
|
|
|
} |
|
|
|
|
if(fileName !== currentFile) { |
|
|
|
|
const {file, provider} = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName) |
|
|
|
|
if (fileName !== currentFile) { |
|
|
|
|
const { file, provider } = await props.analysisModule.call('fileManager', 'getPathFromUrl', fileName) |
|
|
|
|
if (file.startsWith('.deps') || (provider.type === 'localhost' && file.startsWith('localhost/node_modules'))) isLibrary = true |
|
|
|
|
} |
|
|
|
|
const msg = message(result.name, item.warning, item.more, state.file, locationString) |
|
|
|
@ -123,6 +129,9 @@ slitherEnabled: boolean, setStartAnalysis: React.Dispatch<React.SetStateAction<b |
|
|
|
|
setSsaWarnings(warningMessage) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
setSsaWarnings([]) |
|
|
|
|
} |
|
|
|
|
// Slither Analysis
|
|
|
|
|
if (showSlither && slitherEnabled) { |
|
|
|
|
setSlitherWarnings([]) |
|
|
|
@ -198,12 +207,13 @@ slitherEnabled: boolean, setStartAnalysis: React.Dispatch<React.SetStateAction<b |
|
|
|
|
props.analysisModule.call('terminal', 'log', { type: 'error', value: '[Slither Analysis]: Error occured! See remixd console for details.' }) |
|
|
|
|
showWarnings(warningMessage, 'warningModuleName') |
|
|
|
|
} |
|
|
|
|
} else showWarnings(warningMessage, 'warningModuleName') |
|
|
|
|
} else //showWarnings(warningMessage, 'warningModuleName')
|
|
|
|
|
setStartAnalysis(false) |
|
|
|
|
} else { |
|
|
|
|
if (categoryIndex.length) { |
|
|
|
|
warningContainer.current.innerText = 'No compiled AST available' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
props.event.trigger('staticAnaysisWarning', [-1]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|