|
|
@ -64,6 +64,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
|
|
|
|
|
|
|
const warningContainer = React.useRef(null) |
|
|
|
const warningContainer = React.useRef(null) |
|
|
|
const [warningState, setWarningState] = useState({}) |
|
|
|
const [warningState, setWarningState] = useState({}) |
|
|
|
|
|
|
|
const [allWarnings, setAllWarnings] = useState({}) |
|
|
|
const [state, dispatch] = useReducer(analysisReducer, initialState) |
|
|
|
const [state, dispatch] = useReducer(analysisReducer, initialState) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
@ -72,6 +73,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
setWarningState({}) |
|
|
|
setWarningState({}) |
|
|
|
|
|
|
|
setAllWarnings({}) |
|
|
|
if (autoRun) { |
|
|
|
if (autoRun) { |
|
|
|
if (state.data !== null) { |
|
|
|
if (state.data !== null) { |
|
|
|
run(state.data, state.source, state.file) |
|
|
|
run(state.data, state.source, state.file) |
|
|
@ -126,14 +128,17 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const groupedCategory = groupBy(resultArray, groupByKey) |
|
|
|
const groupedCategory = groupBy(resultArray, groupByKey) |
|
|
|
|
|
|
|
setAllWarnings(groupedCategory) |
|
|
|
setWarningState(groupedCategory) |
|
|
|
setWarningState(groupedCategory) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showWarningsByModule = (showOnlyModule: string) => { |
|
|
|
const showWarningsByModule = (showOnlyModule: string) => { |
|
|
|
if(showOnlyModule && warningState[showOnlyModule]) { |
|
|
|
if(allWarnings[showOnlyModule]) { |
|
|
|
const newWarningState = {} |
|
|
|
const newWarningState = {} |
|
|
|
newWarningState[showOnlyModule] = warningState[showOnlyModule] |
|
|
|
newWarningState[showOnlyModule] = allWarnings[showOnlyModule] |
|
|
|
setWarningState({[showOnlyModule]: warningState[showOnlyModule]}) |
|
|
|
setWarningState({[showOnlyModule]: allWarnings[showOnlyModule]}) |
|
|
|
|
|
|
|
} else if (showOnlyModule === 'all') { |
|
|
|
|
|
|
|
setWarningState(allWarnings) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -312,6 +317,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { |
|
|
|
const handleShowSlitherResultEnabled = () => { |
|
|
|
const handleShowSlitherResultEnabled = () => { |
|
|
|
if (slitherResultEnabled) { |
|
|
|
if (slitherResultEnabled) { |
|
|
|
setSlitherResultEnabled(false) |
|
|
|
setSlitherResultEnabled(false) |
|
|
|
|
|
|
|
showWarningsByModule('all') |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
setSlitherResultEnabled(true) |
|
|
|
setSlitherResultEnabled(true) |
|
|
|
showWarningsByModule('Slither Analysis') |
|
|
|
showWarningsByModule('Slither Analysis') |
|
|
|