!5071 debug:JSDoc校验工具param值校验和顺序校验修复

Merge pull request !5071 from fanjiaojiao/master
This commit is contained in:
openharmony_ci 2023-04-18 02:36:25 +00:00 committed by Gitee
commit 80dc2b046b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 3 deletions

View File

@ -38,7 +38,7 @@ function isAscendingOrder(tags) {
// 判断标签是否为官方标签
const firstTag = isOfficialTag(tags[tagIndex].tag);
// 非自定义标签在前或数组降序时报错
if ((firstTag && secondIndex > 1) || firstIndex > secondIndex) {
if ((firstTag && secondIndex > -1) || (firstIndex > secondIndex && secondIndex > -1)) {
checkResult = false;
break;
}

View File

@ -214,11 +214,13 @@ function checkTagsQuantity(comment, index, errorLogs) {
}
}
let paramIndex = 0;
let throwsIndex = 0;
function checkTagValue(tag, index, node, fileName, errorLogs) {
const { JsDocValueChecker } = require('./check_jsdoc_value/check_rest_value');
const checker = JsDocValueChecker[tag.tag];
let paramIndex = 0;
let throwsIndex = 0;
if (checker) {
let valueCheckResult;
if (tag.tag === 'param' && [ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
@ -261,6 +263,8 @@ function checkJsDocOfCurrentNode(node, sourcefile, permissionConfigPath, fileNam
}
checkTagValue(tag, index, node, fileName, errorLogs)
});
paramIndex = 0;
throwsIndex = 0;
// 标签数量校验
checkTagsQuantity(comment, index, errorLogs);
checkInfoMap[index.toString()].illegalTags = checkInfoMap[index.toString()].illegalTags.concat(errorLogs);