修改告警问题、统一管理gitgnore

Signed-off-by: wangcaoyu <wangcaoyu@huawei.com>
This commit is contained in:
wangcaoyu 2024-07-18 20:50:15 +08:00
parent f06894b487
commit d7944c8dc5
17 changed files with 204 additions and 189 deletions

22
.gitignore vendored Normal file
View File

@ -0,0 +1,22 @@
# 忽略node依赖包及相关安装
node_modules
package-lock.json
# 忽略编译sdk输出api
build-tools/api
# 忽略编译sdk输出kits
build-tools/kits
# 忽略编译sdk输出arkts
build-tools/arkts
# 忽略APIdiff工具提供资料结果
build-tools/dts_parser/diff合集
# 忽略APIcheck工具数据json结果
# build-tools/dts_parser/result.json
# 忽略API相关工具执行测试用例的输出数据
build-tools/dts_parser/test/output
#忽略API相关工具执行测试用例失败的相关输出文件
build-tools/dts_parser/mochawesome-report
#忽略本地typescript离线包
build-tools/dts_parser/deps/*

View File

@ -487,155 +487,155 @@ function isAscending(arr) {
}
exports.isAscending = isAscending;
const ruleArr = ["API_DOC_ATOMICSERVICE_01",
"API_DOC_ATOMICSERVICE_02",
"API_DOC_CONSTANT_01",
"API_DOC_CONSTANT_02",
"API_DOC_CONSTANT_03",
"API_DOC_CONSTANT_04",
"API_DOC_CROSSPLATFORM_01",
"API_DOC_CROSSPLATFORM_02",
"API_DOC_DEFAULT_01",
"API_DOC_DEFAULT_02",
"API_DOC_DEFAULT_04",
"API_DOC_DEPRECATED_01",
"API_DOC_DEPRECATED_02",
"API_DOC_DEPRECATED_03",
"API_DOC_DEPRECATED_04",
"API_DOC_ENUM_01",
"API_DOC_ENUM_02",
"API_DOC_ENUM_03",
"API_DOC_ENUM_04",
"API_DOC_ENUM_05",
"API_DOC_EXAMPLE_01",
"API_DOC_EXAMPLE_02",
"API_DOC_EXTENDS_01",
"API_DOC_EXTENDS_02",
"API_DOC_EXTENDS_03",
"API_DOC_EXTENDS_04",
"API_DOC_EXTENDS_05",
"API_DOC_FAMODELONLY_01",
"API_DOC_FAMODELONLY_02",
"API_DOC_FAMODELONLY_03",
"API_DOC_FIRES_01",
"API_DOC_FIRES_02",
"API_DOC_FORM_01",
"API_DOC_FORM_02",
"API_DOC_IMPLEMENTS_01",
"API_DOC_IMPLEMENTS_04",
"API_DOC_INTERFACE_04",
"API_DOC_INTERFACE_05",
"API_DOC_NAMESPACE_01",
"API_DOC_NAMESPACE_02",
"API_DOC_NAMESPACE_03",
"API_DOC_NAMESPACE_04",
"API_DOC_NAMESPACE_05",
"API_DOC_PARAM_01",
"API_DOC_PARAM_02",
"API_DOC_PARAM_03",
"API_DOC_PARAM_04",
"API_DOC_PARAM_05",
"API_DOC_PARAM_06",
"API_DOC_PERMISSION_02",
"API_DOC_PERMISSION_04",
"API_DOC_READONLY_01",
"API_DOC_READONLY_02",
"API_DOC_READONLY_03",
"API_DOC_RETURNS_01",
"API_DOC_RETURNS_02",
"API_DOC_RETURNS_03",
"API_DOC_RETURNS_04",
"API_DOC_RETURNS_05",
"API_DOC_RETURNS_06",
"API_DOC_SINCE_01",
"API_DOC_SINCE_02",
"API_DOC_SINCE_03",
"API_DOC_SINCE_04",
"API_DOC_STAGEMODELONLY_01",
"API_DOC_STAGEMODELONLY_02",
"API_DOC_STAGEMODELONLY_03",
"API_DOC_STATIC_01",
"API_DOC_STATIC_02",
"API_DOC_STRUCT_02",
"API_DOC_STRUCT_05",
"API_DOC_SYSCAP_02",
"API_DOC_SYSCAP_03",
"API_DOC_SYSCAP_04",
"API_DOC_SYSTEMAPI_01",
"API_DOC_SYSTEMAPI_02",
"API_DOC_SYSTEMAPI_03",
"API_DOC_TEST_01",
"API_DOC_TEST_02",
"API_DOC_TEST_03",
"API_DOC_THROWS_01",
"API_DOC_THROWS_02",
"API_DOC_THROWS_03",
"API_DOC_TYPE_01",
"API_DOC_TYPE_02",
"API_DOC_TYPE_03",
"API_DOC_TYPE_05",
"API_DOC_TYPEDEF_01",
"API_DOC_TYPEDEF_02",
"API_DOC_TYPEDEF_03",
"API_DOC_TYPEDEF_04",
"API_DOC_TYPEDEF_05",
"API_DOC_USEINSTEAD_01",
"API_DOC_USEINSTEAD_02",
"API_DOC_USEINSTEAD_03",
"API_DOC_USEINSTEAD_04",
"API_DOC_UNKNOW_DECORATOR_01",
"API_DEFINE_UNALLOWABLE_01",
"API_DEFINE_NAME_01",
"API_DEFINE_NAME_02",
"API_DEFINE_SPELLING_01",
"API_DEFINE_EVENT_01",
"API_DEFINE_EVENT_02",
"API_DEFINE_EVENT_03",
"API_DEFINE_EVENT_04",
"API_DEFINE_EVENT_05",
"API_DEFINE_EVENT_06",
"API_DEFINE_EVENT_07",
"API_DEFINE_EVENT_08",
"API_DEFINE_HUMP_01",
"API_DEFINE_HUMP_02",
"API_DEFINE_HUMP_03",
"API_DEFINE_HUMP_04",
"API_DEFINE_HUMP_05",
"API_CHANGE_INCOMPATIBLE_01",
"API_CHANGE_INCOMPATIBLE_02",
"API_CHANGE_INCOMPATIBLE_03",
"API_CHANGE_INCOMPATIBLE_04",
"API_CHANGE_INCOMPATIBLE_05",
"API_CHANGE_INCOMPATIBLE_06",
"API_CHANGE_INCOMPATIBLE_07",
"API_CHANGE_INCOMPATIBLE_08",
"API_CHANGE_INCOMPATIBLE_09",
"API_CHANGE_INCOMPATIBLE_10",
"API_CHANGE_INCOMPATIBLE_11",
"API_CHANGE_INCOMPATIBLE_12",
"API_CHANGE_INCOMPATIBLE_13",
"API_CHANGE_INCOMPATIBLE_14",
"API_CHANGE_INCOMPATIBLE_15",
"API_CHANGE_INCOMPATIBLE_16",
"API_CHANGE_INCOMPATIBLE_17",
"API_CHANGE_INCOMPATIBLE_18",
"API_CHANGE_INCOMPATIBLE_19",
"API_CHANGE_INCOMPATIBLE_20",
"API_CHANGE_INCOMPATIBLE_21",
"API_CHANGE_INCOMPATIBLE_22",
"API_CHANGE_INCOMPATIBLE_23",
"API_CHANGE_INCOMPATIBLE_24",
"API_CHANGE_INCOMPATIBLE_25",
"API_CHANGE_INCOMPATIBLE_26",
"API_CHANGE_INCOMPATIBLE_27",
"API_CHANGE_INCOMPATIBLE_28",
"API_CHANGE_INCOMPATIBLE_29",
"API_CHANGE_INCOMPATIBLE_30",
"API_CHANGE_INCOMPATIBLE_31",
"API_CHANGE_INCOMPATIBLE_33",
"API_CHANGE_INCOMPATIBLE_34",
"API_CHANGE_INCOMPATIBLE_35",
"API_CHANGE_INCOMPATIBLE_36",
const ruleArr = ['API_DOC_ATOMICSERVICE_01',
'API_DOC_ATOMICSERVICE_02',
'API_DOC_CONSTANT_01',
'API_DOC_CONSTANT_02',
'API_DOC_CONSTANT_03',
'API_DOC_CONSTANT_04',
'API_DOC_CROSSPLATFORM_01',
'API_DOC_CROSSPLATFORM_02',
'API_DOC_DEFAULT_01',
'API_DOC_DEFAULT_02',
'API_DOC_DEFAULT_04',
'API_DOC_DEPRECATED_01',
'API_DOC_DEPRECATED_02',
'API_DOC_DEPRECATED_03',
'API_DOC_DEPRECATED_04',
'API_DOC_ENUM_01',
'API_DOC_ENUM_02',
'API_DOC_ENUM_03',
'API_DOC_ENUM_04',
'API_DOC_ENUM_05',
'API_DOC_EXAMPLE_01',
'API_DOC_EXAMPLE_02',
'API_DOC_EXTENDS_01',
'API_DOC_EXTENDS_02',
'API_DOC_EXTENDS_03',
'API_DOC_EXTENDS_04',
'API_DOC_EXTENDS_05',
'API_DOC_FAMODELONLY_01',
'API_DOC_FAMODELONLY_02',
'API_DOC_FAMODELONLY_03',
'API_DOC_FIRES_01',
'API_DOC_FIRES_02',
'API_DOC_FORM_01',
'API_DOC_FORM_02',
'API_DOC_IMPLEMENTS_01',
'API_DOC_IMPLEMENTS_04',
'API_DOC_INTERFACE_04',
'API_DOC_INTERFACE_05',
'API_DOC_NAMESPACE_01',
'API_DOC_NAMESPACE_02',
'API_DOC_NAMESPACE_03',
'API_DOC_NAMESPACE_04',
'API_DOC_NAMESPACE_05',
'API_DOC_PARAM_01',
'API_DOC_PARAM_02',
'API_DOC_PARAM_03',
'API_DOC_PARAM_04',
'API_DOC_PARAM_05',
'API_DOC_PARAM_06',
'API_DOC_PERMISSION_02',
'API_DOC_PERMISSION_04',
'API_DOC_READONLY_01',
'API_DOC_READONLY_02',
'API_DOC_READONLY_03',
'API_DOC_RETURNS_01',
'API_DOC_RETURNS_02',
'API_DOC_RETURNS_03',
'API_DOC_RETURNS_04',
'API_DOC_RETURNS_05',
'API_DOC_RETURNS_06',
'API_DOC_SINCE_01',
'API_DOC_SINCE_02',
'API_DOC_SINCE_03',
'API_DOC_SINCE_04',
'API_DOC_STAGEMODELONLY_01',
'API_DOC_STAGEMODELONLY_02',
'API_DOC_STAGEMODELONLY_03',
'API_DOC_STATIC_01',
'API_DOC_STATIC_02',
'API_DOC_STRUCT_02',
'API_DOC_STRUCT_05',
'API_DOC_SYSCAP_02',
'API_DOC_SYSCAP_03',
'API_DOC_SYSCAP_04',
'API_DOC_SYSTEMAPI_01',
'API_DOC_SYSTEMAPI_02',
'API_DOC_SYSTEMAPI_03',
'API_DOC_TEST_01',
'API_DOC_TEST_02',
'API_DOC_TEST_03',
'API_DOC_THROWS_01',
'API_DOC_THROWS_02',
'API_DOC_THROWS_03',
'API_DOC_TYPE_01',
'API_DOC_TYPE_02',
'API_DOC_TYPE_03',
'API_DOC_TYPE_05',
'API_DOC_TYPEDEF_01',
'API_DOC_TYPEDEF_02',
'API_DOC_TYPEDEF_03',
'API_DOC_TYPEDEF_04',
'API_DOC_TYPEDEF_05',
'API_DOC_USEINSTEAD_01',
'API_DOC_USEINSTEAD_02',
'API_DOC_USEINSTEAD_03',
'API_DOC_USEINSTEAD_04',
'API_DOC_UNKNOW_DECORATOR_01',
'API_DEFINE_UNALLOWABLE_01',
'API_DEFINE_NAME_01',
'API_DEFINE_NAME_02',
'API_DEFINE_SPELLING_01',
'API_DEFINE_EVENT_01',
'API_DEFINE_EVENT_02',
'API_DEFINE_EVENT_03',
'API_DEFINE_EVENT_04',
'API_DEFINE_EVENT_05',
'API_DEFINE_EVENT_06',
'API_DEFINE_EVENT_07',
'API_DEFINE_EVENT_08',
'API_DEFINE_HUMP_01',
'API_DEFINE_HUMP_02',
'API_DEFINE_HUMP_03',
'API_DEFINE_HUMP_04',
'API_DEFINE_HUMP_05',
'API_CHANGE_INCOMPATIBLE_01',
'API_CHANGE_INCOMPATIBLE_02',
'API_CHANGE_INCOMPATIBLE_03',
'API_CHANGE_INCOMPATIBLE_04',
'API_CHANGE_INCOMPATIBLE_05',
'API_CHANGE_INCOMPATIBLE_06',
'API_CHANGE_INCOMPATIBLE_07',
'API_CHANGE_INCOMPATIBLE_08',
'API_CHANGE_INCOMPATIBLE_09',
'API_CHANGE_INCOMPATIBLE_10',
'API_CHANGE_INCOMPATIBLE_11',
'API_CHANGE_INCOMPATIBLE_12',
'API_CHANGE_INCOMPATIBLE_13',
'API_CHANGE_INCOMPATIBLE_14',
'API_CHANGE_INCOMPATIBLE_15',
'API_CHANGE_INCOMPATIBLE_16',
'API_CHANGE_INCOMPATIBLE_17',
'API_CHANGE_INCOMPATIBLE_18',
'API_CHANGE_INCOMPATIBLE_19',
'API_CHANGE_INCOMPATIBLE_20',
'API_CHANGE_INCOMPATIBLE_21',
'API_CHANGE_INCOMPATIBLE_22',
'API_CHANGE_INCOMPATIBLE_23',
'API_CHANGE_INCOMPATIBLE_24',
'API_CHANGE_INCOMPATIBLE_25',
'API_CHANGE_INCOMPATIBLE_26',
'API_CHANGE_INCOMPATIBLE_27',
'API_CHANGE_INCOMPATIBLE_28',
'API_CHANGE_INCOMPATIBLE_29',
'API_CHANGE_INCOMPATIBLE_30',
'API_CHANGE_INCOMPATIBLE_31',
'API_CHANGE_INCOMPATIBLE_33',
'API_CHANGE_INCOMPATIBLE_34',
'API_CHANGE_INCOMPATIBLE_35',
'API_CHANGE_INCOMPATIBLE_36',
];
exports.ruleArr = ruleArr;

View File

@ -1,11 +0,0 @@
#忽略node依赖包及相关安装
node_modules
package-lock.json
#忽略执行测试用例的输出数据
test/output
#忽略执行测试用例失败的相关输出文件
mochawesome-report
#忽略本地typescript离线包
deps/*
#sdk
api

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -43,9 +43,9 @@ import { EventMethodChecker } from './event_method_check';
import { EventMethodData } from '../../../typedef/checker/event_method_check_interface';
import { ApiChangeCheck } from './check_api_diff';
import { TagInheritCheck } from './tag_inherit_check';
import { ChineseCheck } from "./check_chinese";
import { ChineseCheck } from './check_chinese';
import { AnonymousFunctionCheck } from './check_anonymous_function';
import { CheckErrorCode } from "./check_error_code";
import { CheckErrorCode } from './check_error_code';
export let currentFilePath: string = '';

View File

@ -15,7 +15,7 @@
import { ErrorMessage, ErrorTagFormat, } from '../../../typedef/checker/result_type';
import { CommonFunctions } from '../../../utils/checkUtils';
import { Comment } from "../../../typedef/parser/Comment";
import { Comment } from '../../../typedef/parser/Comment';
export class ChineseCheck {

View File

@ -14,9 +14,9 @@
*/
import { Comment } from "../../../typedef/parser/Comment";
import { ErrorMessage, ErrorTagFormat } from "../../../typedef/checker/result_type";
import { CommonFunctions } from "../../../utils/checkUtils";
import { Comment } from '../../../typedef/parser/Comment';
import { ErrorMessage, ErrorTagFormat } from '../../../typedef/checker/result_type';
import { CommonFunctions } from '../../../utils/checkUtils';
export class CheckErrorCode {

View File

@ -219,7 +219,7 @@ export class LegalityCheck {
}
// check repeat throws
const orderedThrowsCode: string[] = apiThrowsCode.sort();
for (var i = 0; i < orderedThrowsCode.length; i++) {
for (let i = 0; i < orderedThrowsCode.length; i++) {
if (orderedThrowsCode[i] === orderedThrowsCode[i + 1]) {
apiRepeatThrows.state = false;
apiRepeatThrows.errorInfo = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_REPEATLABEL, ['throws']);

View File

@ -1618,7 +1618,9 @@ export namespace DiffProcessorHelper {
* @returns {*} {string}
*/
function stitchMethodParameters(methodParams: ParamInfo[]): string {
if (methodParams.length <= 1) return methodParams[0].getDefinedText();
if (methodParams.length <= 1) {
return methodParams[0].getDefinedText();
}
return methodParams.reduce((preStr: string, curItem: ParamInfo, idx: number) => {
let curStr: string = curItem.getDefinedText();
if (idx !== methodParams.length - 1) {

View File

@ -54,7 +54,7 @@ export class DiffHelper {
const newSDKApiLocations: Map<string, string[]> = DiffHelper.getApiLocations(clonedNewSDKApiMap, isCheck);
DiffHelper.diffKit(clonedOldSDKApiMap, clonedNewSDKApiMap, diffInfos);
const oldFilePathSet: Set<string> = new Set(Array.from(clonedOldSDKApiMap.keys()));
Array.from(clonedOldSDKApiMap.keys())
Array.from(clonedOldSDKApiMap.keys());
// 先以旧版本为基础进行对比
for (const key of oldSDKApiLocations.keys()) {
const apiLocation: string[] = oldSDKApiLocations.get(key) as string[];
@ -230,7 +230,7 @@ export class DiffHelper {
DiffProcessorHelper.JsDocDiffHelper.diffJsDocInfo(oldApiInfo, newApiInfo, diffInfos);
DiffProcessorHelper.ApiDecoratorsDiffHelper.diffDecorator(oldApiInfo, newApiInfo, diffInfos);
newMethodInfoMap.delete(oldApiInfo.getDefinedText());
oldMethodInfoMap.delete(oldApiInfo.getDefinedText())
oldMethodInfoMap.delete(oldApiInfo.getDefinedText());
}
});

View File

@ -199,7 +199,6 @@ export class ApiStatisticsHelper {
} else {
apiStatisticsInfo.setDefinedText(sameNameDefinedText ? sameNameDefinedText : apiInfo.getDefinedText());
}
let isOptional: boolean = false;
if (apiInfo.getApiType() === ApiType.METHOD) {
const methodInfo: MethodInfo = apiInfo as MethodInfo;

View File

@ -1006,7 +1006,7 @@ export const isNotApiSet: Set<string> = new Set([
ApiType.NAMESPACE,
ApiType.ENUM,
ApiType.SOURCE_FILE,
])
]);
/**
* API类型中新增必选属性/
@ -1015,4 +1015,4 @@ export const parentApiTypeSet: Set<string> = new Set([
ApiType.INTERFACE,
ApiType.STRUCT,
ApiType.CLASS
])
]);

View File

@ -600,12 +600,13 @@ export class TypeAliasInfo extends ApiInfo {
return this;
}
getReturnType() {
getReturnType(): string {
return this.returnType;
}
setParamInfos(paramInfo: ParamInfo) {
setParamInfos(paramInfo: ParamInfo): TypeAliasInfo {
this.paramInfos.push(paramInfo);
return this;
}
getParamInfos(): ParamInfo[] {
@ -979,7 +980,8 @@ export class ParserParam {
break;
}
}
const resolvedFileName: string | undefined = ts.resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost).resolvedModule?.resolvedFileName;
const resolvedFileName: string | undefined = ts.resolveModuleName(moduleName, containingFile, compilerOptions,
compilerHost).resolvedModule?.resolvedFileName;
if (resolvedFileName) {
value.resolvedFileName = resolvedFileName;
value.isExternalLibraryImport = true;

View File

@ -119,10 +119,10 @@ export class GenerateFile {
'description',
'language',
'mainBuggyCode',
"apiName",
"apiType",
"hierarchicalRelations",
"parentModuleName"
'apiName',
'apiType',
'hierarchicalRelations',
'parentModuleName'
];
for (let i = 1; i <= apiCheckArr.length; i++) {
const apiData: ApiResultMessage = apiCheckArr[i - 1];
@ -258,7 +258,8 @@ export class CommonFunctions {
}
static getErrorInfo(singleApi: BasicApiInfo | undefined, apiJsdoc: Comment.JsDocInfo | undefined, filePath: string, errorBaseInfo: ErrorBaseInfo): ApiCheckInfo {
static getErrorInfo(singleApi: BasicApiInfo | undefined, apiJsdoc: Comment.JsDocInfo | undefined, filePath: string,
errorBaseInfo: ErrorBaseInfo): ApiCheckInfo {
let apiInfo: ApiCheckInfo = new ApiCheckInfo();
if (singleApi === undefined) {
return apiInfo;
@ -282,7 +283,7 @@ export class CommonFunctions {
return apiInfo;
}
static getMdFiles(url: string) {
static getMdFiles(url: string): string[] {
const mdFiles: string[] = [];
const content: string = fs.readFileSync(url, 'utf-8');
const filePathArr: string[] = content.split(/[(\r\n)\r\n]+/);
@ -296,7 +297,7 @@ export class CommonFunctions {
return mdFiles;
}
static splitPath(filePath: string, pathElements: Set<string>) {
static splitPath(filePath: string, pathElements: Set<string>): void {
let spliteResult: ParsedPath = path.parse(filePath);
if (spliteResult.base !== '') {
pathElements.add(spliteResult.base);