@ -72,6 +72,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
const [ solhintEnabled , setSolhintEnabled ] = useState ( true ) // assuming that solhint is always enabled
const [ solhintEnabled , setSolhintEnabled ] = useState ( true ) // assuming that solhint is always enabled
const [ showSlither , setShowSlither ] = useState ( false )
const [ showSlither , setShowSlither ] = useState ( false )
const [ slitherEnabled , setSlitherEnabled ] = useState ( false )
const [ slitherEnabled , setSlitherEnabled ] = useState ( false )
const [ startAnalysis , setStartAnalysis ] = useState ( false )
const [ isSupportedVersion , setIsSupportedVersion ] = useState ( false )
const [ isSupportedVersion , setIsSupportedVersion ] = useState ( false )
let [ showLibsWarning , setShowLibsWarning ] = useState ( false ) // eslint-disable-line prefer-const
let [ showLibsWarning , setShowLibsWarning ] = useState ( false ) // eslint-disable-line prefer-const
const [ categoryIndex , setCategoryIndex ] = useState ( groupedModuleIndex ( groupedModules ) )
const [ categoryIndex , setCategoryIndex ] = useState ( groupedModuleIndex ( groupedModules ) )
@ -112,7 +113,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
useEffect ( ( ) = > {
useEffect ( ( ) = > {
setWarningState ( { } )
setWarningState ( { } )
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 , slitherEnabled )
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 )
}
}
props . event . trigger ( 'staticAnaysisWarning' , [ ] )
props . event . trigger ( 'staticAnaysisWarning' , [ ] )
// if (basicEnabled) {
// if (basicEnabled) {
@ -465,7 +466,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
< / Fragment >
< / Fragment >
< / div >
< / div >
< / div >
< / div >
) : < span className = "display-6" > No Results . < / span > }
) : state . data && state . file . length > 0 && state . source && startAnalysis && hints . length > 0 ? < span className = "ml-4 spinner-grow-sm d-flex justify-content-center" > Loading . . . < / span > : < span className = "display-6 text-center " > Nothing to report < / span > }
< / >
< / >
) ,
) ,
title : (
title : (
@ -526,7 +527,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
) ) }
) ) }
< / div >
< / div >
< / div >
< / div >
) : < span className = "display-6" > No Results . < / span > }
) : state . data && state . file . length > 0 && state . source && startAnalysis && Object . entries ( warningState ) . length > 0 ? < span className = "ml-4 spinner-grow-sm d-flex justify-content-center" > Loading . . . < / span > : < span className = "display-6 text-center " > Nothing to report < / span > }
< / >
< / >
) ,
) ,
} ,
} ,
@ -602,7 +603,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
< / Fragment >
< / Fragment >
< / div >
< / div >
< / div >
< / div >
) : < span className = "display-6" > No Resul t < / span > }
) : state . data && state . file . length > 0 && state . source && startAnalysis && slitherWarnings . length > 0 ? < span className = "ml-4 spinner-grow-sm d-flex justify-content-center" > Loading . . . < / span > : < span className = "display-6 text-center " > Nothing to repor t < / span > }
< / >
< / >
) ,
) ,
} ,
} ,
@ -642,7 +643,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
< RemixUiCheckbox
< RemixUiCheckbox
id = "solhintstaticanalysis"
id = "solhintstaticanalysis"
inputType = "checkbox"
inputType = "checkbox"
title = "Linter use s SolHint static analysis."
title = "Linter run s SolHint static analysis."
onClick = { handleLinterEnabled }
onClick = { handleLinterEnabled }
checked = { solhintEnabled }
checked = { solhintEnabled }
label = "Linter"
label = "Linter"
@ -661,27 +662,26 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
label = "Slither"
label = "Slither"
onChange = { ( ) = > { } }
onChange = { ( ) = > { } }
optionalClassName = "mr-3"
optionalClassName = "mr-3"
title = { slitherEnabled ? "Run Slither static analysis." : "To run Slither analysis, Remix IDE must be connected to your local filesystem with Remixd." }
title = { slitherEnabled ? "Slither runs Slither static analysis." : "To run Slither analysis, Remix IDE must be connected to your local filesystem with Remixd." }
/ >
/ >
< / div >
< / div >
{ state . data && state . file . length > 0 && state . source ? < Button
{ state . data && state . file . length > 0 && state . source ? < Button
buttonText = { ` Analyse ${ state . file } ` }
buttonText = { ` Analyse ${ state . file } ` }
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 , slitherEnabled ) }
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 ) }
/ > : < B u t t o n
/ > : < B u t t o n
buttonText = { ` Analyze ${ state . file } ` }
buttonText = { ` Analyze ${ 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 ( ) = > 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 ) }
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 ) }
/ > }
/ > }
{ state && state . data !== null && state . source !== null && state . file . length > 0 ? ( < div className = "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" >
< div className = { ` mt-4 p-2 d-flex ${ slitherWarnings . length > 0 || hints . length > 0 || Object . entries ( warningState ) . length > 0 ? 'border-top' : '' } flex-column ` } >
{ slitherWarnings . length > 0 || hints . length > 0 || Object . entries ( warningState ) . length > 0 ? (
{ slitherWarnings . length > 0 || hints . length > 0 || Object . entries ( warningState ) . length > 0 ? (
< >
< div className = { ` mt-4 p-2 d-flex ${ slitherWarnings . length > 0 || hints . length > 0 || Object . entries ( warningState ) . length > 0 ? 'border-top' : '' } flex-column ` } >
< span > Last results for : < / span >
< span > Last results for : < / span >
< span
< span
className = "text-break break-word word-break font-weight-bold"
className = "text-break break-word word-break font-weight-bold"
@ -689,9 +689,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
>
>
{ state . file }
{ state . file }
< / span >
< / span >
< / > ) : null }
< / div >
< / div >
< div className = "border-top mt-3 pt-2 mb-2" id = "staticanalysisresult" >
) : null }
< div className = "border-top mt-2 pt-2 mb-2" id = "staticanalysisresult" >
< RemixUiCheckbox
< RemixUiCheckbox
id = "showLibWarnings"
id = "showLibWarnings"
name = "showLibWarnings"
name = "showLibWarnings"