kit file告警过滤bug修复,any关键字校验范围调整

Signed-off-by: fanjiaojiao0729 <fanjiaojiao@huawei.com>
This commit is contained in:
fanjiaojiao0729 2024-08-07 14:50:36 +08:00
parent c51c5e5363
commit 863e613828
3 changed files with 10 additions and 7 deletions

View File

@ -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)

View File

@ -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) ||

View File

@ -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]);
}