From 3825771999c3573e9aa7f9dd700e47e58ca95677 Mon Sep 17 00:00:00 2001 From: fanjiaojiao0729 Date: Wed, 6 Dec 2023 11:43:37 +0800 Subject: [PATCH] api check bug fix-extemds interface this unkonw Signed-off-by: fanjiaojiao0729 --- .../src/coreImpl/checker/src/tag_legality_check.ts | 10 +++++++--- .../src/coreImpl/checker/src/tag_value_check.ts | 2 +- .../dts_parser/src/typedef/checker/result_type.ts | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build-tools/dts_parser/src/coreImpl/checker/src/tag_legality_check.ts b/build-tools/dts_parser/src/coreImpl/checker/src/tag_legality_check.ts index 582937225c..805143a3c0 100644 --- a/build-tools/dts_parser/src/coreImpl/checker/src/tag_legality_check.ts +++ b/build-tools/dts_parser/src/coreImpl/checker/src/tag_legality_check.ts @@ -64,13 +64,17 @@ export class LegalityCheck { apiLegalityTagsSet.delete('param'); if (apiLegalityTagsSet.has(apiTag.tag)) { apiLegalityTagsSet.delete(apiTag.tag); - if (singleApi.getApiType() === ApiType.INTERFACE) { - apiLegalityTagsSet.delete('typedef'); - } + } + if (singleApi.getApiType() === ApiType.INTERFACE && (apiTag.tag === 'typedef' || apiTag.tag === 'interface')) { + apiLegalityTagsSet.delete('typedef'); + apiLegalityTagsSet.delete('interface'); } if (singleApi.getApiType() === ApiType.METHOD && (singleApi as MethodInfo).getReturnValue().length === 0) { apiLegalityTagsSet.delete('returns'); } + if (apiLegalityTagsSet.has('extends') && (singleApi as ClassInfo).getParentClasses().length === 0) { + apiLegalityTagsSet.delete('extends'); + } }); // param合法性单独进行校验 LegalityCheck.paramLegalityCheck(paramTagNumber, paramApiNumber, apiLegalityCheckResult); diff --git a/build-tools/dts_parser/src/coreImpl/checker/src/tag_value_check.ts b/build-tools/dts_parser/src/coreImpl/checker/src/tag_value_check.ts index b326bb9f36..513c18f799 100644 --- a/build-tools/dts_parser/src/coreImpl/checker/src/tag_value_check.ts +++ b/build-tools/dts_parser/src/coreImpl/checker/src/tag_value_check.ts @@ -312,7 +312,7 @@ export class TagValueCheck { const isNumber: boolean = /^\d+$/.test(deprecatedVersion); if (deprecatedFixedField !== 'since' || !isNumber) { deprecatedValueCheckResult.state = false; - deprecatedValueCheckResult.errorInfo = ErrorMessage.ERROR_INFO_VALUE_DEFAULT; + deprecatedValueCheckResult.errorInfo = ErrorMessage.ERROR_INFO_VALUE_DEPRECATED; } return deprecatedValueCheckResult; } diff --git a/build-tools/dts_parser/src/typedef/checker/result_type.ts b/build-tools/dts_parser/src/typedef/checker/result_type.ts index 02f0468f99..9eebb28b2b 100644 --- a/build-tools/dts_parser/src/typedef/checker/result_type.ts +++ b/build-tools/dts_parser/src/typedef/checker/result_type.ts @@ -117,7 +117,7 @@ export enum ErrorMessage { ERROR_EVENT_CALLBACK_MISSING = 'The off functions of one single event should have at least one callback parameter, and the callback parameter should be the last parameter.', ERROR_EVENT_ON_AND_OFF_PAIR = 'The on and off event subscription methods do not appear in pair.', ERROR_EVENT_WITHOUT_PARAMETER = 'The event subscription methods should has at least one parameter.', - ILLEGAL_USE_ANY = 'Illegal [any] keyword used in the API', + ILLEGAL_USE_ANY = 'Illegal [$$] keyword used in the API', ERROR_CHANGES_VERSION = 'Please check if the changed API version number is 10.', ERROR_WORD = 'The current word [$$] is incompatible with the regulaion, please confirm whether it needs to be corrected to a common word.', ERROR_NAMING = 'Prohibited word in [$$]:{$$}.The word allowed is [$$]', -- Gitee