From 863e613828e3937010809109240c9cfe2433b760 Mon Sep 17 00:00:00 2001 From: fanjiaojiao0729 Date: Wed, 7 Aug 2024 14:50:36 +0800 Subject: [PATCH] =?UTF-8?q?kit=20file=E5=91=8A=E8=AD=A6=E8=BF=87=E6=BB=A4b?= =?UTF-8?q?ug=E4=BF=AE=E5=A4=8D=EF=BC=8Cany=E5=85=B3=E9=94=AE=E5=AD=97?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=8C=83=E5=9B=B4=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fanjiaojiao0729 --- .../src/coreImpl/checker/src/api_check_plugin.ts | 2 +- .../dts_parser/src/coreImpl/checker/src/compile_info.ts | 9 +++++---- .../src/coreImpl/checker/src/forbidden_words_check.ts | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/build-tools/dts_parser/src/coreImpl/checker/src/api_check_plugin.ts b/build-tools/dts_parser/src/coreImpl/checker/src/api_check_plugin.ts index a4e4f651d..a809ef588 100644 --- a/build-tools/dts_parser/src/coreImpl/checker/src/api_check_plugin.ts +++ b/build-tools/dts_parser/src/coreImpl/checker/src/api_check_plugin.ts @@ -127,7 +127,7 @@ export class Check { errorBaseInfo); AddErrorLogs.addAPICheckErrorLogs(apiInfoNojsdoc, compositiveResult, compositiveLocalResult); } else { - if (apiJsdoc.getKit().length === 0) { + if (apiJsdoc.getKit() === 'NA') { const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo(); errorBaseInfo .setErrorID(ErrorID.WRONG_SCENE_ID) diff --git a/build-tools/dts_parser/src/coreImpl/checker/src/compile_info.ts b/build-tools/dts_parser/src/coreImpl/checker/src/compile_info.ts index a51b6e2aa..2c6607f02 100644 --- a/build-tools/dts_parser/src/coreImpl/checker/src/compile_info.ts +++ b/build-tools/dts_parser/src/coreImpl/checker/src/compile_info.ts @@ -62,11 +62,12 @@ export class AddErrorLogs { checkErrorInfos.forEach((checkErrorInfo: ApiResultSimpleInfo) => { const checkErrorMessage: string = checkErrorInfo.getMessage().replace(/API check error of \[.*\]: /g, ''); - if (checkErrorMessage === CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['kit'])) { - hasLostKitErrorInfo.push(checkErrorInfo.getMessage()); + const keyMessage: string = checkErrorInfo.getFilePath() + checkErrorMessage; + if (keyMessage === apiInfo.getFilePath() + CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['kit'])) { + hasLostKitErrorInfo.push(checkErrorInfo.getFilePath() + checkErrorInfo.getMessage()); } - if (checkErrorMessage === CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['file'])) { - hasLostfileErrorInfo.push(checkErrorInfo.getMessage()); + if (keyMessage === apiInfo.getFilePath() + CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['file'])) { + hasLostfileErrorInfo.push(checkErrorInfo.getFilePath() + checkErrorInfo.getMessage()); } }); if ((isLostKitErrorInfo && hasLostKitErrorInfo.length !== 0) || diff --git a/build-tools/dts_parser/src/coreImpl/checker/src/forbidden_words_check.ts b/build-tools/dts_parser/src/coreImpl/checker/src/forbidden_words_check.ts index dfc175b9b..5c4bfd647 100644 --- a/build-tools/dts_parser/src/coreImpl/checker/src/forbidden_words_check.ts +++ b/build-tools/dts_parser/src/coreImpl/checker/src/forbidden_words_check.ts @@ -26,7 +26,8 @@ export class ForbiddenWordsCheck { * @returns { ErrorTagFormat } */ static forbiddenWordsCheck(singleApi: ClassInfo): ErrorTagFormat { - const forbiddenWordsArr: string[] = ['any', 'this', 'unknown']; + const forbiddenWordsArr: string[] = ['this', 'unknown']; + const forbiddenWordAny: string = 'any'; const forbiddenWordsResult: ErrorTagFormat = { state: true, errorInfo: '', @@ -46,7 +47,8 @@ export class ForbiddenWordsCheck { }); let apiTextWordsArr = fullText.split(/\s/g); apiTextWordsArr.forEach((apiTextWord) => { - if (forbiddenWordsArr.includes(apiTextWord) && publishVersion === apiVersionToBeVerified) { + + if (publishVersion === apiVersionToBeVerified && (forbiddenWordsArr.includes(apiTextWord) || (apiTextWord === forbiddenWordAny && singleApi.getFilePath().indexOf('.d.ets') !== -1))) { forbiddenWordsResult.state = false; forbiddenWordsResult.errorInfo = CommonFunctions.createErrorInfo(ErrorMessage.ILLEGAL_USE_ANY, [apiTextWord]); }