|
|
@ -9,7 +9,7 @@ import * as semver from 'semver' |
|
|
|
import { TreeView, TreeViewItem } from '@remix-ui/tree-view' // eslint-disable-line
|
|
|
|
import { TreeView, TreeViewItem } from '@remix-ui/tree-view' // eslint-disable-line
|
|
|
|
import { RemixUiCheckbox } from '@remix-ui/checkbox' // eslint-disable-line
|
|
|
|
import { RemixUiCheckbox } from '@remix-ui/checkbox' // eslint-disable-line
|
|
|
|
import ErrorRenderer from './ErrorRenderer' // eslint-disable-line
|
|
|
|
import ErrorRenderer from './ErrorRenderer' // eslint-disable-line
|
|
|
|
import { compilation } from './actions/staticAnalysisActions' |
|
|
|
import { compilation, runSlitherAnalysis } from './actions/staticAnalysisActions' |
|
|
|
import { initialState, analysisReducer } from './reducers/staticAnalysisReducer' |
|
|
|
import { initialState, analysisReducer } from './reducers/staticAnalysisReducer' |
|
|
|
import { CodeAnalysis } from '@remix-project/remix-analyzer' |
|
|
|
import { CodeAnalysis } from '@remix-project/remix-analyzer' |
|
|
|
import Tab from 'react-bootstrap/Tab' |
|
|
|
import Tab from 'react-bootstrap/Tab' |
|
|
@ -197,6 +197,11 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
return () => { } |
|
|
|
return () => { } |
|
|
|
}, [props]) |
|
|
|
}, [props]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const hintErrors = hints.filter(hint => hint.type === 'error') |
|
|
|
|
|
|
|
const noLibSlitherWarnings = slitherWarnings.filter(w => !w.options.isLibrary) |
|
|
|
|
|
|
|
const slitherErrors = noLibSlitherWarnings.filter(slitherError => slitherError.options.type === 'error') |
|
|
|
|
|
|
|
const remixAnalysisNoLibs = ssaWarnings.filter(ssa => ssa.options.isLibrary === false) |
|
|
|
|
|
|
|
|
|
|
|
const message = (name: string, warning: any, more?: string, fileName?: string, locationString?: string) : string => { |
|
|
|
const message = (name: string, warning: any, more?: string, fileName?: string, locationString?: string) : string => { |
|
|
|
return (` |
|
|
|
return (` |
|
|
|
<span className='d-flex flex-column'> |
|
|
|
<span className='d-flex flex-column'> |
|
|
@ -243,6 +248,17 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
} |
|
|
|
} |
|
|
|
},[hints.length, state]) |
|
|
|
},[hints.length, state]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
if(ssaWarnings.length > 0) { |
|
|
|
|
|
|
|
props.event.trigger('staticAnaysisWarning', [ssaWarnings.length]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(remixAnalysisNoLibs.length > 0) { |
|
|
|
|
|
|
|
props.event.trigger('staticAnaysisWarning', [remixAnalysisNoLibs.length]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, [ssaWarnings.length]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const showWarnings = (warningMessage, groupByKey) => { |
|
|
|
const showWarnings = (warningMessage, groupByKey) => { |
|
|
|
const resultArray = [] |
|
|
|
const resultArray = [] |
|
|
|
warningMessage.map(x => { |
|
|
|
warningMessage.map(x => { |
|
|
@ -329,9 +345,11 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
|
|
|
|
|
|
|
const handleShowLibsWarning = () => { |
|
|
|
const handleShowLibsWarning = () => { |
|
|
|
if (showLibsWarning) { |
|
|
|
if (showLibsWarning) { |
|
|
|
|
|
|
|
props.event.trigger('staticAnaysisWarning', [remixAnalysisNoLibs.length]) |
|
|
|
setShowLibsWarning(false) |
|
|
|
setShowLibsWarning(false) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
filterWarnings() |
|
|
|
// filterWarnings()
|
|
|
|
|
|
|
|
props.event.trigger('staticAnaysisWarning', [ssaWarnings.length]) |
|
|
|
setShowLibsWarning(true) |
|
|
|
setShowLibsWarning(true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -396,9 +414,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
setHideWarnings(!hideWarnings) |
|
|
|
setHideWarnings(!hideWarnings) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const hintErrors = hints.filter(hint => hint.type === 'error') |
|
|
|
console.log({ ssaWarnings, remixAnalysisNoLibs, slitherWarnings, hints }) |
|
|
|
const noLibSlitherWarnings = slitherWarnings.filter(w => !w.options.isLibrary) |
|
|
|
|
|
|
|
const slitherErrors = noLibSlitherWarnings.filter(slitherError => slitherError.options.type === 'error') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tabKeys = [ |
|
|
|
const tabKeys = [ |
|
|
|
{ |
|
|
|
{ |
|
|
@ -522,19 +538,23 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
tabKey: "basic", |
|
|
|
tabKey: "basic", |
|
|
|
title: ( |
|
|
|
title: ( |
|
|
|
<BasicTitle |
|
|
|
<BasicTitle |
|
|
|
warningStateEntries={Object.entries(warningState)} |
|
|
|
|
|
|
|
hideWarnings={hideWarnings} |
|
|
|
hideWarnings={hideWarnings} |
|
|
|
showLibsWarnings={showLibsWarning} |
|
|
|
showLibsWarnings={showLibsWarning} |
|
|
|
|
|
|
|
ssaWarnings={ssaWarnings} |
|
|
|
|
|
|
|
ssaWarningsNoLibs={remixAnalysisNoLibs} |
|
|
|
|
|
|
|
warningStateEntries={Object.entries(warningState)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
), |
|
|
|
), |
|
|
|
child: ( |
|
|
|
child: ( |
|
|
|
<BasicTabBody |
|
|
|
<BasicTabBody |
|
|
|
analysisModule={props.analysisModule} |
|
|
|
analysisModule={props.analysisModule} |
|
|
|
warningState={warningState} |
|
|
|
|
|
|
|
hideWarnings={hideWarnings} |
|
|
|
hideWarnings={hideWarnings} |
|
|
|
showLibsWarning={showLibsWarning} |
|
|
|
showLibsWarning={showLibsWarning} |
|
|
|
|
|
|
|
ssaWarnings={ssaWarnings} |
|
|
|
|
|
|
|
ssaWarningsNoLibs={remixAnalysisNoLibs} |
|
|
|
startAnalysis={startAnalysis} |
|
|
|
startAnalysis={startAnalysis} |
|
|
|
state={state} |
|
|
|
state={state} |
|
|
|
|
|
|
|
warningState={warningState} |
|
|
|
/> |
|
|
|
/> |
|
|
|
), |
|
|
|
), |
|
|
|
}, |
|
|
|
}, |
|
|
@ -680,8 +700,13 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
buttonText={`Analyse ${state.file}`} |
|
|
|
buttonText={`Analyse ${state.file}`} |
|
|
|
title={`${runButtonTitle}`} |
|
|
|
title={`${runButtonTitle}`} |
|
|
|
classList="btn btn-sm btn-primary btn-block" |
|
|
|
classList="btn btn-sm btn-primary btn-block" |
|
|
|
onClick={async () => await run(state.data, state.source, state.file, state , props, isSupportedVersion, showSlither, categoryIndex, groupedModules, runner,_paq, |
|
|
|
onClick={async () => { |
|
|
|
message, showWarnings, allWarnings, warningContainer, calculateWarningStateEntries, warningState, setHints, hints, setSlitherWarnings, setSsaWarnings, slitherEnabled, setStartAnalysis)} |
|
|
|
await run(state.data, state.source, state.file, state , props, isSupportedVersion, showSlither, categoryIndex, groupedModules, runner,_paq, |
|
|
|
|
|
|
|
message, showWarnings, allWarnings, warningContainer, calculateWarningStateEntries, warningState, setHints, hints, setSlitherWarnings, setSsaWarnings, slitherEnabled, setStartAnalysis) |
|
|
|
|
|
|
|
await runSlitherAnalysis(state.data, state.source, state.file, state , props, isSupportedVersion, showSlither, categoryIndex, groupedModules, runner,_paq, |
|
|
|
|
|
|
|
message, showWarnings, allWarnings, warningContainer, calculateWarningStateEntries, warningState, setHints, hints, setSlitherWarnings, setSsaWarnings, slitherEnabled, setStartAnalysis) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
disabled={(state.data === null || !isSupportedVersion) || (!solhintEnabled && !basicEnabled) } |
|
|
|
disabled={(state.data === null || !isSupportedVersion) || (!solhintEnabled && !basicEnabled) } |
|
|
|
/> : <Button |
|
|
|
/> : <Button |
|
|
|
buttonText={`Analyze ${state.file}`} |
|
|
|
buttonText={`Analyze ${state.file}`} |
|
|
|