From 1a58e3ef1c74a98d97234372fbcebba44c706b87 Mon Sep 17 00:00:00 2001 From: HuSenlin Date: Mon, 25 Aug 2025 11:13:58 +0800 Subject: [PATCH] fix AI reaview Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICUHSK Signed-off-by: HuSenlin --- ets2panda/linter/src/cli/LinterCLI.ts | 4 ++-- .../scan/ProblemStatisticsCommonFunction.ts | 17 ++++++++++------- .../scan/StatisticsReportInPutInfo.ts | 2 +- ets2panda/linter/src/lib/utils/TsUtils.ts | 2 +- .../utils/functions/ConfiguredRulesProcess.ts | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ets2panda/linter/src/cli/LinterCLI.ts b/ets2panda/linter/src/cli/LinterCLI.ts index 9d8ae8337f..be7e4cdaaa 100644 --- a/ets2panda/linter/src/cli/LinterCLI.ts +++ b/ets2panda/linter/src/cli/LinterCLI.ts @@ -32,7 +32,7 @@ import { logStatistics } from '../lib/statistics/StatisticsLogger'; import { compileLintOptions, getEtsLoaderPath } from '../lib/ts-compiler/Compiler'; import { processSyncErr, processSyncOut } from '../lib/utils/functions/ProcessWrite'; import { parseCommandLine } from './CommandLineParser'; -import { getwholeRules } from '../lib/utils/functions/ConfiguredRulesProcess'; +import { getAllLinterRules } from '../lib/utils/functions/ConfiguredRulesProcess'; export function run(): void { const commandLineArgs = process.argv.slice(2); @@ -78,7 +78,7 @@ async function runIdeInteractiveMode(cmdOptions: CommandLineOptions): Promise, wholeLinterRules: string[]) : Map { +function getProcessedRuleToNumbersMap( + ruleToNumbersMap: Map, + allLinterRules: string[] +): Map { const processedRuleToNumbersMap: Map = new Map(); const homecheckRuleToNumbersMap: Map = ruleToNumbersMap; - wholeLinterRules.forEach((ruleName) => { + allLinterRules.forEach((ruleName) => { const ruleNumber = ruleToNumbersMap.get(ruleName) || 0; homecheckRuleToNumbersMap.delete(ruleName); processedRuleToNumbersMap.set(ruleName, ruleNumber); }); - + homecheckRuleToNumbersMap.forEach((number, ruleName) => { processedRuleToNumbersMap.set(ruleName, number); - }) + }); return processedRuleToNumbersMap; } @@ -213,7 +216,7 @@ export function generateMigrationStatisicsReport( const statisticsReportData = getProblemStatisticsInfo( problemNumbers, - getProcessedRuleToNumbersMap(ruleToNumbersMap, getwholeRules()), + getProcessedRuleToNumbersMap(ruleToNumbersMap, getAllLinterRules()), ruleToAutoFixedNumbersMap, timeRecorder ); diff --git a/ets2panda/linter/src/lib/statistics/scan/StatisticsReportInPutInfo.ts b/ets2panda/linter/src/lib/statistics/scan/StatisticsReportInPutInfo.ts index b43198f2fe..a841890f97 100644 --- a/ets2panda/linter/src/lib/statistics/scan/StatisticsReportInPutInfo.ts +++ b/ets2panda/linter/src/lib/statistics/scan/StatisticsReportInPutInfo.ts @@ -20,7 +20,7 @@ export class StatisticsReportInPutInfo { totalProblemNumbers: number = 0; arkOnePointOneProblemNumbers: number = 0; ruleToNumbersMap: Map = {} as Map; - wholeRules: string[] = [] as string[]; + allLinterRules: string[] = [] as string[]; ruleToAutoFixedNumbersMap: Map = {} as Map; cmdOptions: CommandLineOptions = {} as CommandLineOptions; timeRecorder: TimeRecorder = {} as TimeRecorder; diff --git a/ets2panda/linter/src/lib/utils/TsUtils.ts b/ets2panda/linter/src/lib/utils/TsUtils.ts index d49c2cdff9..3aa1893629 100644 --- a/ets2panda/linter/src/lib/utils/TsUtils.ts +++ b/ets2panda/linter/src/lib/utils/TsUtils.ts @@ -3590,7 +3590,7 @@ export class TsUtils { return false; } - projectPath.concat(PATH_SEPARATOR + currentModule); + projectPath = projectPath.concat(PATH_SEPARATOR + currentModule); } const importedFile = path.resolve(projectPath, importFilePath + extension); diff --git a/ets2panda/linter/src/lib/utils/functions/ConfiguredRulesProcess.ts b/ets2panda/linter/src/lib/utils/functions/ConfiguredRulesProcess.ts index 65ee056abc..27bf5988bd 100644 --- a/ets2panda/linter/src/lib/utils/functions/ConfiguredRulesProcess.ts +++ b/ets2panda/linter/src/lib/utils/functions/ConfiguredRulesProcess.ts @@ -97,7 +97,7 @@ function isStringArray(value: any): value is string[] { ); } -export function getwholeRules() : string[] { +export function getAllLinterRules(): string[] { const configureRulePath = getDefaultConfigurePath(); const configuredRulesMap = getRulesFromConfig(configureRulePath); return Array.from(configuredRulesMap.values()).flat(); -- Gitee