split slither analysis & solhint & remix analysis

pull/3838/head
Joseph Izang 1 year ago
parent 44b835556a
commit cc99ee5a1b
  1. 43
      libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts

@ -127,6 +127,39 @@ slitherEnabled: boolean, setStartAnalysis: React.Dispatch<React.SetStateAction<b
setSsaWarnings(warningMessage)
}
}
} else {
if (categoryIndex.length) {
warningContainer.current.innerText = 'No compiled AST available'
}
props.event.trigger('staticAnaysisWarning', [-1])
}
}
}
/**
* Run the analysis on the currently compiled contract
* @param lastCompilationResult
* @param lastCompilationSource
* @param currentFile {string} current file path
* @param state { RemixUiStaticAnalyserState}
* @param props {RemixUiStaticAnalyserProps}
* @param isSupportedVersion {boolean}
* @param slitherEnabled {boolean}
* @param categoryIndex {number[]}
* @param groupedModules {any}
* @param runner {any}
* @param _paq {any}
* @param message {any}
* @param showWarnings {boolean}
* @param allWarnings {React.RefObject<object>}
* @param warningContainer {React.RefObject<object>}
* @returns {Promise<void>}
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function runSlitherAnalysis (lastCompilationResult, lastCompilationSource, currentFile: string, state: RemixUiStaticAnalyserState, props: RemixUiStaticAnalyserProps, isSupportedVersion, showSlither, categoryIndex: number[], groupedModules, runner, _paq, message, showWarnings, allWarnings: React.RefObject<any>, warningContainer: React.RefObject<any>, calculateWarningStateEntries: (e:[string, any][]) => {length: number, errors: any[] }, warningState, setHints: React.Dispatch<React.SetStateAction<SolHintReport[]>>, hints: SolHintReport[], setSlitherWarnings: React.Dispatch<React.SetStateAction<any[]>>, setSsaWarnings: React.Dispatch<React.SetStateAction<any[]>>,
slitherEnabled: boolean, setStartAnalysis: React.Dispatch<React.SetStateAction<boolean>>) {
// Slither Analysis
if (showSlither && slitherEnabled) {
setSlitherWarnings([])
@ -196,20 +229,12 @@ slitherEnabled: boolean, setStartAnalysis: React.Dispatch<React.SetStateAction<b
return prev
})
}
showWarnings(warningMessage, 'warningModuleName')
}
} catch(error) {
props.analysisModule.call('terminal', 'log', { type: 'error', value: '[Slither Analysis]: Error occured! See remixd console for details.' })
showWarnings(warningMessage, 'warningModuleName')
}
} else showWarnings(warningMessage, 'warningModuleName')
setStartAnalysis(false)
} else {
if (categoryIndex.length) {
warningContainer.current.innerText = 'No compiled AST available'
}
setStartAnalysis(false)
props.event.trigger('staticAnaysisWarning', [-1])
}
}
}

Loading…
Cancel
Save