From 5cc7bc87173201d05fa1857dcf8a516c53a540b8 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 31 May 2023 16:45:00 +0100 Subject: [PATCH] add types to function params. add linting to run --- .../src/lib/actions/staticAnalysisActions.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts b/libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts index 65d7b96314..d50c830d43 100644 --- a/libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts +++ b/libs/remix-ui/static-analyser/src/lib/actions/staticAnalysisActions.ts @@ -1,6 +1,7 @@ import { CompilationResult, SourceWithTarget } from '@remixproject/plugin-api' import React from 'react' //eslint-disable-line -import { AnalysisTab, RemixUiStaticAnalyserReducerActionType } from '../../staticanalyser' +import { AnalysisTab, RemixUiStaticAnalyserReducerActionType, RemixUiStaticAnalyserState, SolHintReport } from '../../staticanalyser' +import { RemixUiStaticAnalyserProps } from '@remix-ui/static-analyser' /** * @@ -41,7 +42,7 @@ export const compilation = (analysisModule: AnalysisTab, * @returns {Promise} */ // eslint-disable-next-line @typescript-eslint/no-unused-vars -export async function run (lastCompilationResult, lastCompilationSource, currentFile, state, props, isSupportedVersion, slitherEnabled, categoryIndex, groupedModules, runner, _paq, message, showWarnings, allWarnings, warningContainer) { +export async function run (lastCompilationResult, lastCompilationSource, currentFile: string, state: RemixUiStaticAnalyserState, props: RemixUiStaticAnalyserProps, isSupportedVersion, slitherEnabled, categoryIndex: number[], groupedModules, runner, _paq, message, showWarnings, allWarnings: React.RefObject, warningContainer: React.RefObject, calculateWarningStateEntries: (e:[string, any][]) => {length: number, errors: any[] }, warningState, setHints: React.Dispatch>, hints: SolHintReport[]) { if (!isSupportedVersion) return if (state.data !== null) { @@ -49,6 +50,13 @@ export async function run (lastCompilationResult, lastCompilationSource, current const warningMessage = [] const warningErrors = [] + // Run solhint + const hintsResult = await props.analysisModule.call('solhint', 'lint', state.file) + setHints(hintsResult) + const warningResult = calculateWarningStateEntries(Object.entries(warningState)) + props.analysisModule.emit('statusChanged', { key: hints.length+warningResult.length, + title: `${hints.length+warningResult.length} warning${hints.length+warningResult.length === 1 ? '' : 's'}`, type: 'warning'}) + // Remix Analysis _paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyze', 'remixAnalyzer']) const results = runner.run(lastCompilationResult, categoryIndex)