1/* 2 * Copyright (c) 2024 - 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { LOG_LEVEL } from 'arkanalyzer'; 17import { Language } from 'arkanalyzer/lib/core/model/ArkFile'; 18 19export class ProjectConfig { 20 projectName: string; 21 projectPath: string; 22 logPath: string; 23 ohosSdkPath: string; 24 hmsSdkPath: string; 25 checkPath: string; 26 apiVersion: number; 27 fix: string; 28 fixSelected: boolean; 29 npmPath: string; 30 npmInstallDir: string; 31 reportDir: string; 32 sdksThirdParty: string[]; 33 arkCheckPath: string; 34 product: string; 35 logLevel: LOG_LEVEL; 36 arkAnalyzerLogLevel: LOG_LEVEL; 37 38 39 // [filePath, languageTag] or [folderPath, languageTag] 40 languageTags: Map<string, Language>; 41 // [...filePaths, ...folderPaths] 42 fileOrFolderToCheck: string[]; 43 44 constructor(config: any) { 45 this.projectName = config.projectName ?? ''; 46 this.projectPath = config.projectPath ?? ''; 47 this.logPath = config.logPath ?? ''; 48 this.ohosSdkPath = config.ohosSdkPath ?? ''; 49 this.hmsSdkPath = config.hmsSdkPath ?? ''; 50 this.checkPath = config.checkPath ?? ''; 51 this.apiVersion = config.sdkVersion ?? 14; 52 this.fix = config.fix ?? 'false'; 53 this.fixSelected = config.fixSelected ?? false; 54 this.npmPath = config.npmPath ? config.npmPath : 'npm'; 55 this.npmInstallDir = config.npmInstallDir ? config.npmInstallDir : './'; 56 this.reportDir = config.reportDir ? config.reportDir : './'; 57 this.sdksThirdParty = config.sdksThirdParty ?? []; 58 this.arkCheckPath = config.arkCheckPath ?? ''; 59 this.product = config.product ?? ''; 60 this.languageTags = config.languageTags ?? new Map(); 61 this.fileOrFolderToCheck = config.fileOrFolderToCheck ?? []; 62 this.logLevel = config.logLevel ?? LOG_LEVEL.INFO; 63 this.arkAnalyzerLogLevel = config.arkAnalyzerLogLevel ?? LOG_LEVEL.ERROR; 64 } 65} 66 67export interface SelectedFileInfo { 68 filePath: string; 69 fixKey?: string[]; 70} 71 72export class FileToCheck implements SelectedFileInfo { 73 public filePath: string; 74 75 constructor(filePath: string) { 76 this.filePath = filePath; 77 } 78}