|
|
@ -111,13 +111,14 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
const runAnalysis = async () => { |
|
|
|
const runAnalysis = async () => { |
|
|
|
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) |
|
|
|
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) |
|
|
|
} |
|
|
|
} |
|
|
|
if (basicEnabled) { |
|
|
|
props.event.trigger('staticAnaysisWarning', []) |
|
|
|
if (state.data !== null) { |
|
|
|
// if (basicEnabled) {
|
|
|
|
runAnalysis().catch(console.error); |
|
|
|
// if (state.data !== null) {
|
|
|
|
} |
|
|
|
// runAnalysis().catch(console.error);
|
|
|
|
} else { |
|
|
|
// }
|
|
|
|
props.event.trigger('staticAnaysisWarning', []) |
|
|
|
// } else {
|
|
|
|
} |
|
|
|
// props.event.trigger('staticAnaysisWarning', [])
|
|
|
|
|
|
|
|
// }
|
|
|
|
return () => { } |
|
|
|
return () => { } |
|
|
|
}, [state]) |
|
|
|
}, [state]) |
|
|
|
|
|
|
|
|
|
|
@ -252,14 +253,11 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const handleSlitherEnabled = async () => { |
|
|
|
const handleSlitherEnabled = async () => { |
|
|
|
const checkRemixd = await !props.analysisModule.call('manager', 'isActive', 'remixd') |
|
|
|
const checkRemixd = await props.analysisModule.call('manager', 'isActive', 'remixd') |
|
|
|
if (showSlither && checkRemixd) { |
|
|
|
if (showSlither) { |
|
|
|
setShowSlither(false) |
|
|
|
setShowSlither(false) |
|
|
|
await props.analysisModule.call('manager', 'deactivatePlugin', 'remixd') |
|
|
|
}
|
|
|
|
await props.analysisModule.call('filePanel', 'setWorkspace', 'default_workspace') |
|
|
|
if(!showSlither) { |
|
|
|
} else { |
|
|
|
|
|
|
|
await props.analysisModule.call('manager', 'activatePlugin', 'remixd') |
|
|
|
|
|
|
|
await props.analysisModule.call('filePanel', 'setWorkspace', { name: 'localhost', isLocalhost: true }, true) |
|
|
|
|
|
|
|
setShowSlither(true) |
|
|
|
setShowSlither(true) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -548,7 +546,21 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
<div className="mb-4 pt-2"> |
|
|
|
<div className="mb-4 pt-2"> |
|
|
|
<Fragment> |
|
|
|
<Fragment> |
|
|
|
{!hideWarnings
|
|
|
|
{!hideWarnings
|
|
|
|
? slitherWarnings.map((warning, index) => ( |
|
|
|
? showLibsWarning ? slitherWarnings.filter(warning => warning.isLibrary).map((warning, index) => ( |
|
|
|
|
|
|
|
<div |
|
|
|
|
|
|
|
data-id={`staticAnalysisModule${warning.warningModuleName}${index}`} |
|
|
|
|
|
|
|
id={`staticAnalysisModule${warning.warningModuleName}${index}`} |
|
|
|
|
|
|
|
key={index} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<ErrorRenderer |
|
|
|
|
|
|
|
name={`staticAnalysisModule${warning.warningModuleName}${index}`} |
|
|
|
|
|
|
|
message={warning.msg} |
|
|
|
|
|
|
|
opt={warning.options} |
|
|
|
|
|
|
|
warningErrors={warning.warningErrors} |
|
|
|
|
|
|
|
editor={props.analysisModule} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)) : slitherWarnings.map((warning, index) => ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
data-id={`staticAnalysisModule${warning.warningModuleName}${index}`} |
|
|
|
data-id={`staticAnalysisModule${warning.warningModuleName}${index}`} |
|
|
|
id={`staticAnalysisModule${warning.warningModuleName}${index}`} |
|
|
|
id={`staticAnalysisModule${warning.warningModuleName}${index}`} |
|
|
@ -586,7 +598,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
), |
|
|
|
), |
|
|
|
}, |
|
|
|
}, |
|
|
|
]; |
|
|
|
]; |
|
|
|
const t = Object.entries(warningState) |
|
|
|
|
|
|
|
const checkBasicStatus = () => { |
|
|
|
const checkBasicStatus = () => { |
|
|
|
return Object.values(groupedModules).map((value: any) => { |
|
|
|
return Object.values(groupedModules).map((value: any) => { |
|
|
|
return (value.map(x => { |
|
|
|
return (value.map(x => { |
|
|
@ -599,115 +611,121 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
<div className="analysis_3ECCBV px-3 pb-1"> |
|
|
|
<div className="analysis_3ECCBV px-3 pb-1"> |
|
|
|
<div className="my-2 d-flex flex-column align-items-left"> |
|
|
|
<div className="my-2 d-flex flex-column align-items-left"> |
|
|
|
<div className="d-flex flex-column mb-3" id="staticanalysisButton"> |
|
|
|
<div className="d-flex flex-column mb-3" id="staticanalysisButton"> |
|
|
|
<div className="mb-3 d-flex justify-content-between"> |
|
|
|
<div className="mb-3 d-flex justify-content-start"> |
|
|
|
<RemixUiCheckbox |
|
|
|
<RemixUiCheckbox |
|
|
|
id="solhintstaticanalysis" |
|
|
|
|
|
|
|
inputType="checkbox" |
|
|
|
|
|
|
|
title="Run solhint static analysis on file save" |
|
|
|
|
|
|
|
onClick={handleLinterEnabled} |
|
|
|
|
|
|
|
checked={solhintEnabled} |
|
|
|
|
|
|
|
label="Linter" |
|
|
|
|
|
|
|
onChange={() => {}} |
|
|
|
|
|
|
|
tooltipPlacement={'top-start'} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<RemixUiCheckbox |
|
|
|
|
|
|
|
id="checkAllEntries" |
|
|
|
id="checkAllEntries" |
|
|
|
inputType="checkbox" |
|
|
|
inputType="checkbox" |
|
|
|
title="Select all Remix analysis modules" |
|
|
|
title="Remix analysis is a basic analysis tool for Remix Ide." |
|
|
|
checked={Object.values(groupedModules).map((value: any) => { |
|
|
|
checked={Object.values(groupedModules).map((value: any) => { |
|
|
|
return (value.map(x => { |
|
|
|
return (value.map(x => { |
|
|
|
return x._index.toString() |
|
|
|
return x._index.toString() |
|
|
|
})) |
|
|
|
})) |
|
|
|
}).flat().every(el => categoryIndex.includes(el))} |
|
|
|
}).flat().every(el => categoryIndex.includes(el))} |
|
|
|
label="Basic" |
|
|
|
label="Remix" |
|
|
|
onClick={() => { |
|
|
|
onClick={() => { |
|
|
|
handleCheckAllModules(groupedModules) |
|
|
|
handleCheckAllModules(groupedModules) |
|
|
|
}} |
|
|
|
}} |
|
|
|
onChange={() => {}} |
|
|
|
onChange={() => {}} |
|
|
|
|
|
|
|
tooltipPlacement={'bottom-start'} |
|
|
|
|
|
|
|
optionalClassName="mr-3" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<RemixUiCheckbox |
|
|
|
|
|
|
|
id="solhintstaticanalysis" |
|
|
|
|
|
|
|
inputType="checkbox" |
|
|
|
|
|
|
|
title="Run solhint static analysis." |
|
|
|
|
|
|
|
onClick={handleLinterEnabled} |
|
|
|
|
|
|
|
checked={solhintEnabled} |
|
|
|
|
|
|
|
label="Linter" |
|
|
|
|
|
|
|
onChange={() => {}} |
|
|
|
tooltipPlacement={'top-start'} |
|
|
|
tooltipPlacement={'top-start'} |
|
|
|
|
|
|
|
optionalClassName="mr-3" |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<RemixUiCheckbox |
|
|
|
<RemixUiCheckbox |
|
|
|
id="enableSlither" |
|
|
|
id="enableSlither" |
|
|
|
inputType="checkbox" |
|
|
|
inputType="checkbox" |
|
|
|
onClick={handleSlitherEnabled} |
|
|
|
onClick={handleSlitherEnabled} |
|
|
|
checked={showSlither} |
|
|
|
checked={showSlither} |
|
|
|
|
|
|
|
disabled={true} |
|
|
|
label="Slither" |
|
|
|
label="Slither" |
|
|
|
onChange={() => {}} |
|
|
|
onChange={() => {}} |
|
|
|
|
|
|
|
optionalClassName="mr-3" |
|
|
|
|
|
|
|
title="To run Slither analysis, you must activate remixd and connect remix ide to your local file system." |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<Button |
|
|
|
<Button |
|
|
|
buttonText={`Analyse ${state.file}`} |
|
|
|
buttonText={state && state.data && state.file.length > 0 ? `Analyse ${state.file}` : 'Compile a Contract'} |
|
|
|
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 () => 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)} |
|
|
|
message, showWarnings, allWarnings, warningContainer, calculateWarningStateEntries, warningState, setHints, hints, setSlitherWarnings, setSsaWarnings)} |
|
|
|
disabled={(state.data === null || !isSupportedVersion) || (!solhintEnabled && !basicEnabled) } |
|
|
|
disabled={(state.data === null || !isSupportedVersion) || (!solhintEnabled && !basicEnabled) } |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div className="mt-4 p-2 d-flex border-top flex-column"> |
|
|
|
{state && state.data !== null && state.source !== null && state.file.length > 0 ? (<div className="d-flex border-top flex-column"> |
|
|
|
<span>Last results for:</span> |
|
|
|
<div className="mt-4 p-2 d-flex border-top flex-column"> |
|
|
|
<span |
|
|
|
<span>Last results for:</span> |
|
|
|
className="text-break break-word word-break font-weight-bold" |
|
|
|
<span |
|
|
|
id="staticAnalysisCurrentFile" |
|
|
|
className="text-break break-word word-break font-weight-bold" |
|
|
|
> |
|
|
|
id="staticAnalysisCurrentFile" |
|
|
|
{state.file} |
|
|
|
> |
|
|
|
</span> |
|
|
|
{state.file} |
|
|
|
</div> |
|
|
|
</span> |
|
|
|
<div className="border-top mt-3 pt-2" id="staticanalysisresult"> |
|
|
|
</div> |
|
|
|
<RemixUiCheckbox |
|
|
|
<div className="border-top mt-3 pt-2 mb-2" id="staticanalysisresult"> |
|
|
|
id="showLibWarnings" |
|
|
|
<RemixUiCheckbox |
|
|
|
name="showLibWarnings" |
|
|
|
id="showLibWarnings" |
|
|
|
categoryId="showLibWarnings" |
|
|
|
name="showLibWarnings" |
|
|
|
title="When checked, the results are also displayed for external contract libraries." |
|
|
|
categoryId="showLibWarnings" |
|
|
|
inputType="checkbox" |
|
|
|
title="When checked, the results are also displayed for external contract libraries." |
|
|
|
checked={showLibsWarning} |
|
|
|
inputType="checkbox" |
|
|
|
label="Show warnings for external libraries" |
|
|
|
checked={showLibsWarning} |
|
|
|
onClick={handleShowLibsWarning} |
|
|
|
label="Show warnings for external libraries" |
|
|
|
onChange={() => {}} |
|
|
|
onClick={handleShowLibsWarning} |
|
|
|
tooltipPlacement="top-start" |
|
|
|
onChange={() => {}} |
|
|
|
/> |
|
|
|
tooltipPlacement="top-start" |
|
|
|
<RemixUiCheckbox |
|
|
|
/> |
|
|
|
id="hideWarnings" |
|
|
|
<RemixUiCheckbox |
|
|
|
name="hideWarnings" |
|
|
|
id="hideWarnings" |
|
|
|
title="When checked, general warnings from analysis are hidden." |
|
|
|
name="hideWarnings" |
|
|
|
inputType="checkbox" |
|
|
|
title="When checked, general warnings from analysis are hidden." |
|
|
|
checked={hideWarnings} |
|
|
|
inputType="checkbox" |
|
|
|
label="Hide warnings" |
|
|
|
checked={hideWarnings} |
|
|
|
onClick={handleHideWarnings} |
|
|
|
label="Hide warnings" |
|
|
|
onChange={() => {}} |
|
|
|
onClick={handleHideWarnings} |
|
|
|
/> |
|
|
|
onChange={() => {}} |
|
|
|
</div> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<Tabs defaultActiveKey={tabKeys[0].tabKey}> |
|
|
|
<Tabs defaultActiveKey={tabKeys[0].tabKey}> |
|
|
|
{solhintEnabled ? <Tab |
|
|
|
{ |
|
|
|
key={tabKeys[0].tabKey} |
|
|
|
checkBasicStatus() ? <Tab |
|
|
|
title={tabKeys[0].title} |
|
|
|
key={tabKeys[1].tabKey} |
|
|
|
eventKey={tabKeys[0].tabKey} |
|
|
|
title={tabKeys[1].title} |
|
|
|
tabClassName="text-decoration-none font-weight-bold" |
|
|
|
eventKey={tabKeys[1].tabKey} |
|
|
|
> |
|
|
|
tabClassName="text-decoration-none font-weight-bold" |
|
|
|
{tabKeys[0].child} |
|
|
|
> |
|
|
|
</Tab> : null} |
|
|
|
{tabKeys[1].child} |
|
|
|
|
|
|
|
</Tab> : null |
|
|
|
{ |
|
|
|
} |
|
|
|
checkBasicStatus() ? <Tab |
|
|
|
{solhintEnabled ? <Tab |
|
|
|
key={tabKeys[1].tabKey} |
|
|
|
key={tabKeys[0].tabKey} |
|
|
|
title={tabKeys[1].title} |
|
|
|
title={tabKeys[0].title} |
|
|
|
eventKey={tabKeys[1].tabKey} |
|
|
|
eventKey={tabKeys[0].tabKey} |
|
|
|
tabClassName="text-decoration-none font-weight-bold" |
|
|
|
tabClassName="text-decoration-none font-weight-bold" |
|
|
|
> |
|
|
|
> |
|
|
|
{tabKeys[1].child} |
|
|
|
{tabKeys[0].child} |
|
|
|
</Tab> : null |
|
|
|
</Tab> : null} |
|
|
|
} |
|
|
|
{ showSlither ? <Tab |
|
|
|
|
|
|
|
key={tabKeys[2].tabKey} |
|
|
|
{ showSlither ? <Tab |
|
|
|
title={tabKeys[2].title} |
|
|
|
key={tabKeys[2].tabKey} |
|
|
|
eventKey={tabKeys[2].tabKey} |
|
|
|
title={tabKeys[2].title} |
|
|
|
tabClassName="text-decoration-none font-weight-bold" |
|
|
|
eventKey={tabKeys[2].tabKey} |
|
|
|
> |
|
|
|
tabClassName="text-decoration-none font-weight-bold" |
|
|
|
{tabKeys[2].child} |
|
|
|
> |
|
|
|
</Tab> : null } |
|
|
|
{tabKeys[2].child} |
|
|
|
</Tabs> |
|
|
|
</Tab> : null } |
|
|
|
</div>) : null} |
|
|
|
|
|
|
|
</div> |
|
|
|
</Tabs> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|