needed conditional check

pull/5370/head
Joseph Izang 1 year ago
parent b9b8c7e248
commit cdda3ad979
  1. 28
      libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

@ -368,28 +368,28 @@ useEffect(() => {
}, [hideWarnings, showLibsWarning]) }, [hideWarnings, showLibsWarning])
useEffect(() => { useEffect(() => {
const slitherTotal = slitherWarnings && state.data && state.source !== null const slitherTotal = slitherEnabled && showSlither && slitherWarnings && state.data && state.source !== null
? slitherWarnings.filter((x) => !x.options.isLibrary && x.hasWarning).length ? slitherWarnings.filter((x) => !x.options.isLibrary && x.hasWarning).length
: 0 : 0
const ssaTotal = ssaWarnings && state.data && state.source !== null const ssaTotal = basicEnabled && ssaWarnings && state.data && state.source !== null
? ssaWarnings.filter((x) => !x.options.isLibrary && x.hasWarning).length ? ssaWarnings.filter((x) => !x.options.isLibrary && x.hasWarning).length
: 0 : 0
const hintsTotal = hints && state.data && state.source !== null ? hints.length : 0 const hintsTotal = solhintEnabled && hints && state.data && state.source !== null ? hints.length : 0
console.log('hideWarnings & showLibsWarning are unchecked and lengths have changed', { slitherTotal, ssaTotal, hintsTotal }) console.log('hideWarnings & showLibsWarning are unchecked and lengths have changed', { slitherTotal, ssaTotal, hintsTotal })
props.event.trigger('staticAnaysisWarning', [slitherTotal + ssaTotal + hintsTotal]) props.event.trigger('staticAnaysisWarning', [slitherTotal + ssaTotal + hintsTotal])
}, [hints.length, slitherWarnings.length, ssaWarnings.length]) }, [hints.length, slitherWarnings.length, ssaWarnings.length])
useEffect(() => { // useEffect(() => {
const slitherTotal = slitherWarnings && slitherEnabled && showSlither && state.data && state.source !== null // const slitherTotal = slitherWarnings && slitherEnabled && showSlither && state.data && state.source !== null
? slitherWarnings.filter((x) => !x.options.isLibrary && x.hasWarning).length // ? slitherWarnings.filter((x) => !x.options.isLibrary && x.hasWarning).length
: 0 // : 0
const ssaTotal = ssaWarnings && basicEnabled && state.data && state.source !== null // const ssaTotal = ssaWarnings && basicEnabled && state.data && state.source !== null
? ssaWarnings.filter((x) => !x.options.isLibrary && x.hasWarning).length // ? ssaWarnings.filter((x) => !x.options.isLibrary && x.hasWarning).length
: 0 // : 0
const hintsTotal = hints && solhintEnabled && state.data && state.source !== null ? hints.length : 0 // const hintsTotal = hints && solhintEnabled && state.data && state.source !== null ? hints.length : 0
console.log('hideWarnings & showLibsWarning are unchecked and tools could be checked or unchecked', { slitherTotal, ssaTotal, hintsTotal }) // console.log('hideWarnings & showLibsWarning are unchecked and tools could be checked or unchecked', { slitherTotal, ssaTotal, hintsTotal })
props.event.trigger('staticAnaysisWarning', [slitherTotal + ssaTotal + hintsTotal]) // props.event.trigger('staticAnaysisWarning', [slitherTotal + ssaTotal + hintsTotal])
}, [solhintEnabled, basicEnabled, slitherEnabled, showSlither]) // }, [solhintEnabled, basicEnabled, slitherEnabled, showSlither])
const handleSlitherEnabled = async () => { const handleSlitherEnabled = async () => {
const checkRemixd = await props.analysisModule.call('manager', 'isActive', 'remixd') const checkRemixd = await props.analysisModule.call('manager', 'isActive', 'remixd')

Loading…
Cancel
Save