diff --git a/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx b/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx index 5c0d8b57ad..0b051497c0 100644 --- a/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx +++ b/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx @@ -4,7 +4,7 @@ type BasicTitleProps = { warningStateEntries: any } -function calculateWarningStateEntries(entries: any[][]) { +export function calculateWarningStateEntries(entries: any[][]) { let warninglength = 0 entries.forEach((entry) => { warninglength += entry[1].length @@ -12,7 +12,7 @@ function calculateWarningStateEntries(entries: any[][]) { return warninglength } -export default function BasicTitle(props: BasicTitleProps) { +export function BasicTitle(props: BasicTitleProps) { return ( Basic{props.warningStateEntries.length > 0 ? {calculateWarningStateEntries(props.warningStateEntries)}: null} diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx index 769d84c836..0b45d36335 100644 --- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx +++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx @@ -9,13 +9,11 @@ import ErrorRenderer from './ErrorRenderer' // eslint-disable-line import { compilation } from './actions/staticAnalysisActions' import { initialState, analysisReducer } from './reducers/staticAnalysisReducer' import { CodeAnalysis } from '@remix-project/remix-analyzer' -import { CustomTooltip } from '@remix-ui/helper' import Tab from 'react-bootstrap/Tab' import Tabs from 'react-bootstrap/Tabs' -import { Fade } from 'react-bootstrap' import { AnalysisTab, SolHintReport } from '../staticanalyser' import { run } from './actions/staticAnalysisActions' -import BasicTitle from './components/BasicTitle' +import { BasicTitle, calculateWarningStateEntries } from './components/BasicTitle' declare global { interface Window { @@ -158,6 +156,11 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { setSlitherEnabled(false) } }) + const warningResult = calculateWarningStateEntries(Object.entries(warningState)) + console.log({ warningResult, hintCount: hints.length }) + props.analysisModule.emit('statusChanged', 'solhint', { key: hints.length+warningResult, + title: `${hints.length+warningResult} warning${hints.length+warningResult === 1 ? '' : 's'}`, type: 'warning'}) + props.event.trigger('staticAnaysisWarning', [hints.length+warningResult]) // eslint-disable-next-line @typescript-eslint/no-unused-vars props.analysisModule.on('solidity', 'compilerLoaded', async (version: string, license: string) => { setDisableForRun(version) @@ -268,6 +271,14 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { } } + const handleLinterEnabled = () => { + if (solhintEnabled) { + setSolhintEnabled(false) + } else { + setSolhintEnabled(true) + } + } + const handleCheckSingle = (event, _index) => { _index = _index.toString() if (categoryIndex.includes(_index)) { @@ -344,10 +355,6 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ) } - const handleShowLinterMessages = () => { - - } - const handleHideWarnings = () => { } @@ -359,7 +366,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { <> {hints.length > 0 &&