|
|
@ -81,6 +81,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
const [hints, setHints] = useState<SolHintReport[]>([]) |
|
|
|
const [hints, setHints] = useState<SolHintReport[]>([]) |
|
|
|
const [slitherWarnings, setSlitherWarnings] = useState([]) |
|
|
|
const [slitherWarnings, setSlitherWarnings] = useState([]) |
|
|
|
const [ssaWarnings, setSsaWarnings] = useState([]) |
|
|
|
const [ssaWarnings, setSsaWarnings] = useState([]) |
|
|
|
|
|
|
|
const [tabKey, setTabKey] = useState('basic') |
|
|
|
|
|
|
|
|
|
|
|
const warningContainer = useRef(null) |
|
|
|
const warningContainer = useRef(null) |
|
|
|
const allWarnings = useRef({}) |
|
|
|
const allWarnings = useRef({}) |
|
|
@ -107,6 +108,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
setWarningState({}) |
|
|
|
setHints([]) |
|
|
|
setHints([]) |
|
|
|
setSlitherWarnings([]) |
|
|
|
setSlitherWarnings([]) |
|
|
|
setSsaWarnings([]) |
|
|
|
setSsaWarnings([]) |
|
|
@ -143,7 +145,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
props.analysisModule.on('filePanel', 'setWorkspace', (currentWorkspace) => { |
|
|
|
props.analysisModule.on('filePanel', 'setWorkspace', (currentWorkspace) => { |
|
|
|
// Reset warning state
|
|
|
|
// Reset warning state
|
|
|
|
setWarningState([]) |
|
|
|
setWarningState({}) |
|
|
|
// Reset badge
|
|
|
|
// Reset badge
|
|
|
|
props.event.trigger('staticAnaysisWarning', []) |
|
|
|
props.event.trigger('staticAnaysisWarning', []) |
|
|
|
// Reset state
|
|
|
|
// Reset state
|
|
|
@ -165,7 +167,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
// Hide 'Enable Slither Analysis' checkbox
|
|
|
|
// Hide 'Enable Slither Analysis' checkbox
|
|
|
|
if (plugin.name === 'remixd') { |
|
|
|
if (plugin.name === 'remixd') { |
|
|
|
// Reset warning state
|
|
|
|
// Reset warning state
|
|
|
|
setWarningState([]) |
|
|
|
setWarningState({}) |
|
|
|
setHints([]) |
|
|
|
setHints([]) |
|
|
|
setSlitherWarnings([]) |
|
|
|
setSlitherWarnings([]) |
|
|
|
setSlitherEnabled(false) |
|
|
|
setSlitherEnabled(false) |
|
|
@ -218,9 +220,11 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (newWarningCount > 0) { |
|
|
|
props.event.trigger('staticAnaysisWarning', [newWarningCount]) |
|
|
|
props.event.trigger('staticAnaysisWarning', [newWarningCount]) |
|
|
|
setWarningState(newWarningState) |
|
|
|
setWarningState(newWarningState) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if(hints.length > 0) { |
|
|
|
if(hints.length > 0) { |
|
|
@ -511,6 +515,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
<BasicTitle |
|
|
|
<BasicTitle |
|
|
|
warningStateEntries={Object.entries(warningState)} |
|
|
|
warningStateEntries={Object.entries(warningState)} |
|
|
|
hideWarnings={hideWarnings} |
|
|
|
hideWarnings={hideWarnings} |
|
|
|
|
|
|
|
showLibsWarnings={showLibsWarning} |
|
|
|
/> |
|
|
|
/> |
|
|
|
), |
|
|
|
), |
|
|
|
child: ( |
|
|
|
child: ( |
|
|
@ -520,8 +525,8 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
<div className="mb-4 pt-2"> |
|
|
|
<div className="mb-4 pt-2"> |
|
|
|
{Object.entries(warningState).map((element, index) => ( |
|
|
|
{Object.entries(warningState).map((element, index) => ( |
|
|
|
<div key={index}> |
|
|
|
<div key={index}> |
|
|
|
{ !hideWarnings && element[1]['length'] > 0 ? <span className="text-dark h6">{element[0]}</span> : null} |
|
|
|
{ hideWarnings === false ? <span className="text-dark h6">{element[0]}</span> : null} |
|
|
|
{!hideWarnings ? element[1]["map"]( |
|
|
|
{ hideWarnings === false ? element[1]["map"]( |
|
|
|
(x,i) => // eslint-disable-line dot-notation
|
|
|
|
(x,i) => // eslint-disable-line dot-notation
|
|
|
|
x.hasWarning |
|
|
|
x.hasWarning |
|
|
|
? ( // eslint-disable-next-line dot-notation
|
|
|
|
? ( // eslint-disable-next-line dot-notation
|
|
|
@ -753,8 +758,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<Tabs |
|
|
|
<Tabs |
|
|
|
defaultActiveKey={tabKeys[0].tabKey} |
|
|
|
defaultActiveKey={tabKeys[1].tabKey} |
|
|
|
className="px-1" |
|
|
|
className="px-1" |
|
|
|
|
|
|
|
onSelect={(newKey) => setTabKey(newKey)} |
|
|
|
> |
|
|
|
> |
|
|
|
{ |
|
|
|
{ |
|
|
|
checkBasicStatus() ? <Tab |
|
|
|
checkBasicStatus() ? <Tab |
|
|
@ -766,14 +772,16 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
{tabKeys[1].child} |
|
|
|
{tabKeys[1].child} |
|
|
|
</Tab> : null |
|
|
|
</Tab> : null |
|
|
|
} |
|
|
|
} |
|
|
|
{solhintEnabled ? <Tab |
|
|
|
{ |
|
|
|
|
|
|
|
solhintEnabled ? <Tab |
|
|
|
key={tabKeys[0].tabKey} |
|
|
|
key={tabKeys[0].tabKey} |
|
|
|
title={tabKeys[0].title} |
|
|
|
title={tabKeys[0].title} |
|
|
|
eventKey={tabKeys[0].tabKey} |
|
|
|
eventKey={tabKeys[0].tabKey} |
|
|
|
tabClassName="text-decoration-none font-weight-bold px-2" |
|
|
|
tabClassName="text-decoration-none font-weight-bold px-2" |
|
|
|
> |
|
|
|
> |
|
|
|
{tabKeys[0].child} |
|
|
|
{tabKeys[0].child} |
|
|
|
</Tab> : null} |
|
|
|
</Tab> : null |
|
|
|
|
|
|
|
} |
|
|
|
{ showSlither && slitherEnabled ? <Tab |
|
|
|
{ showSlither && slitherEnabled ? <Tab |
|
|
|
key={tabKeys[2].tabKey} |
|
|
|
key={tabKeys[2].tabKey} |
|
|
|
title={tabKeys[2].title} |
|
|
|
title={tabKeys[2].title} |
|
|
|