|
|
|
@ -7,6 +7,7 @@ import { RemixUiCheckbox } from '@remix-ui/checkbox' // eslint-disable-line |
|
|
|
|
import ErrorRenderer from './ErrorRenderer' // eslint-disable-line
|
|
|
|
|
import { compilation } from './actions/staticAnalysisActions' |
|
|
|
|
import { initialState, analysisReducer } from './reducers/staticAnalysisReducer' |
|
|
|
|
import { OverlayTrigger, Tooltip } from 'react-bootstrap' |
|
|
|
|
const StaticAnalysisRunner = require('@remix-project/remix-analyzer').CodeAnalysis |
|
|
|
|
const utils = remixLib.util |
|
|
|
|
|
|
|
|
@ -56,7 +57,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
} |
|
|
|
|
const [autoRun, setAutoRun] = useState(true) |
|
|
|
|
const [slitherEnabled, setSlitherEnabled] = useState(false) |
|
|
|
|
const [showSlither, setShowSlither] = useState('hidden') |
|
|
|
|
const [showSlither, setShowSlither] = useState(false) |
|
|
|
|
const [categoryIndex, setCategoryIndex] = useState(groupedModuleIndex(groupedModules)) |
|
|
|
|
|
|
|
|
|
const warningContainer = React.useRef(null) |
|
|
|
@ -88,9 +89,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
// Reset state
|
|
|
|
|
dispatch({ type: '', payload: {} }) |
|
|
|
|
// Show 'Enable Slither Analysis' checkbox
|
|
|
|
|
if (currentWorkspace && currentWorkspace.isLocalhost === true) setShowSlither('visible') |
|
|
|
|
if (currentWorkspace && currentWorkspace.isLocalhost === true) setShowSlither(true) |
|
|
|
|
else { |
|
|
|
|
setShowSlither('hidden') |
|
|
|
|
setShowSlither(false) |
|
|
|
|
setSlitherEnabled(false) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -103,7 +104,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
props.event.trigger('staticAnaysisWarning', []) |
|
|
|
|
// Reset state
|
|
|
|
|
dispatch({ type: '', payload: {} }) |
|
|
|
|
setShowSlither('hidden') |
|
|
|
|
setShowSlither(false) |
|
|
|
|
setSlitherEnabled(false) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -414,7 +415,8 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
/> |
|
|
|
|
<Button buttonText="Run" onClick={() => run(state.data, state.source, state.file)} disabled={(state.data === null || categoryIndex.length === 0) && !slitherEnabled }/> |
|
|
|
|
</div> |
|
|
|
|
<div className="d-flex" id="enableSlitherAnalysis" style={{ visibility: showSlither } as CSSProperties }> |
|
|
|
|
{ showSlither && |
|
|
|
|
<div className="d-flex mt-2" id="enableSlitherAnalysis"> |
|
|
|
|
<RemixUiCheckbox |
|
|
|
|
id="enableSlither" |
|
|
|
|
inputType="checkbox" |
|
|
|
@ -423,10 +425,18 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
label="Enable Slither Analysis" |
|
|
|
|
onChange={() => {}} |
|
|
|
|
/> |
|
|
|
|
<a href="https://remix-ide.readthedocs.io/en/latest/slither.html#enable-slither-analysis" target="_blank"> |
|
|
|
|
<i className="ml-3 fas fa-info" title="Know how to use Slither Analysis"></i> |
|
|
|
|
|
|
|
|
|
<a className="mt-1 text-nowrap" href='https://remix-ide.readthedocs.io/en/latest/slither.html#enable-slither-analysis' target={'_blank'}> |
|
|
|
|
<OverlayTrigger placement={'right'} overlay={ |
|
|
|
|
<Tooltip className="text-nowrap" id="overlay-tooltip"> |
|
|
|
|
<span className="p-1 pr-3" style={{ backgroundColor: 'black', minWidth: '230px' }}>Learn how to use Slither Analysis</span> |
|
|
|
|
</Tooltip> |
|
|
|
|
}> |
|
|
|
|
<i style={{ fontSize: 'medium' }} className={'fal fa-info-circle ml-3'} aria-hidden="true"></i> |
|
|
|
|
</OverlayTrigger> |
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
} |
|
|
|
|
</div> |
|
|
|
|
<div id="staticanalysismodules" className="list-group list-group-flush"> |
|
|
|
|
{Object.keys(groupedModules).map((categoryId, i) => { |
|
|
|
|