161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci* Copyright (c) 2021-2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci* Licensed under the Apache License, Version 2.0 (the 'License'); 461847f8eSopenharmony_ci* you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci* You may obtain a copy of the License at 661847f8eSopenharmony_ci* 761847f8eSopenharmony_ci* http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci* 961847f8eSopenharmony_ci* Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an 'AS IS' BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci*/ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ciconst whiteLists = require('../config/jsdocCheckWhiteList.json'); 1761847f8eSopenharmony_ciconst { parseJsDoc, commentNodeWhiteList, requireTypescriptModule, ErrorType, ErrorLevel, FileType, ErrorValueInfo, 1861847f8eSopenharmony_ci createErrorInfo, isWhiteListFile } = require('./utils'); 1961847f8eSopenharmony_ciconst { checkApiOrder, checkAPITagName, checkInheritTag } = require('./check_jsdoc_value/check_order'); 2061847f8eSopenharmony_ciconst { addAPICheckErrorLogs } = require('./compile_info'); 2161847f8eSopenharmony_ciconst ts = requireTypescriptModule(); 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ci// 标签合法性校验 2461847f8eSopenharmony_cifunction checkJsDocLegality(node, comments, checkInfoMap) { 2561847f8eSopenharmony_ci // since 2661847f8eSopenharmony_ci legalityCheck(node, comments, commentNodeWhiteList, ['since'], true, checkInfoMap); 2761847f8eSopenharmony_ci // syscap 2861847f8eSopenharmony_ci legalityCheck(node, comments, getIllegalKinds([ts.SyntaxKind.ModuleDeclaration, ts.SyntaxKind.ClassDeclaration]), 2961847f8eSopenharmony_ci ['syscap'], true, checkInfoMap); 3061847f8eSopenharmony_ci // const定义语句必填 3161847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.VariableStatement], ['constant'], true, checkInfoMap, 3261847f8eSopenharmony_ci (currentNode, checkResult) => { 3361847f8eSopenharmony_ci return (checkResult && (currentNode.kind !== ts.SyntaxKind.VariableStatement || !/^const\s/.test(currentNode.getText()))) || 3461847f8eSopenharmony_ci (!checkResult && currentNode.kind === ts.SyntaxKind.VariableStatement && /^const\s/.test(currentNode.getText())); 3561847f8eSopenharmony_ci }); 3661847f8eSopenharmony_ci // 'enum' 3761847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.EnumDeclaration], ['enum'], true, checkInfoMap); 3861847f8eSopenharmony_ci // 'extends' 3961847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.ClassDeclaration], ['extends'], true, checkInfoMap, 4061847f8eSopenharmony_ci (currentNode, checkResult) => { 4161847f8eSopenharmony_ci let tagCheckResult = false; 4261847f8eSopenharmony_ci if (ts.isClassDeclaration(currentNode) && currentNode.heritageClauses) { 4361847f8eSopenharmony_ci const clauses = currentNode.heritageClauses; 4461847f8eSopenharmony_ci clauses.forEach(claus => { 4561847f8eSopenharmony_ci if (/^extends\s/.test(claus.getText())) { 4661847f8eSopenharmony_ci tagCheckResult = true; 4761847f8eSopenharmony_ci } 4861847f8eSopenharmony_ci }); 4961847f8eSopenharmony_ci } 5061847f8eSopenharmony_ci return (checkResult && !tagCheckResult) || (!checkResult && tagCheckResult); 5161847f8eSopenharmony_ci } 5261847f8eSopenharmony_ci ); 5361847f8eSopenharmony_ci // 'namespace' 5461847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.ModuleDeclaration], ['namespace'], true, checkInfoMap); 5561847f8eSopenharmony_ci // 'param' 5661847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature, 5761847f8eSopenharmony_ci ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature, ts.SyntaxKind.Constructor, 5861847f8eSopenharmony_ci ts.SyntaxKind.TypeAliasDeclaration], ['param'], true, checkInfoMap, 5961847f8eSopenharmony_ci (currentNode, checkResult) => { 6061847f8eSopenharmony_ci if (!new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature, 6161847f8eSopenharmony_ci ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.Constructor]).has(currentNode.kind)) { 6261847f8eSopenharmony_ci return true; 6361847f8eSopenharmony_ci } 6461847f8eSopenharmony_ci return currentNode.parameters; 6561847f8eSopenharmony_ci } 6661847f8eSopenharmony_ci ); 6761847f8eSopenharmony_ci // 'returns' 6861847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature, 6961847f8eSopenharmony_ci ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature, ts.SyntaxKind.TypeAliasDeclaration], 7061847f8eSopenharmony_ci ['returns'], true, checkInfoMap, 7161847f8eSopenharmony_ci (currentNode, checkResult) => { 7261847f8eSopenharmony_ci if (!checkResult && !new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature, 7361847f8eSopenharmony_ci ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature, 7461847f8eSopenharmony_ci ts.SyntaxKind.TypeAliasDeclaration]).has(currentNode.kind)) { 7561847f8eSopenharmony_ci return false; 7661847f8eSopenharmony_ci } 7761847f8eSopenharmony_ci return !(!checkResult && !new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature, 7861847f8eSopenharmony_ci ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature, 7961847f8eSopenharmony_ci ts.SyntaxKind.TypeAliasDeclaration]).has(currentNode.kind)) && (currentNode.type && 8061847f8eSopenharmony_ci currentNode.type.kind !== ts.SyntaxKind.VoidKeyword); 8161847f8eSopenharmony_ci } 8261847f8eSopenharmony_ci ); 8361847f8eSopenharmony_ci // 'useinstead' 8461847f8eSopenharmony_ci legalityCheck(node, comments, commentNodeWhiteList, ['useinstead'], true, checkInfoMap, 8561847f8eSopenharmony_ci (currentNode, checkResult) => { 8661847f8eSopenharmony_ci return new Set(commentNodeWhiteList).has(currentNode.kind); 8761847f8eSopenharmony_ci } 8861847f8eSopenharmony_ci ); 8961847f8eSopenharmony_ci // typedef/interface 9061847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.InterfaceDeclaration, ts.SyntaxKind.TypeAliasDeclaration], 9161847f8eSopenharmony_ci ['interface', 'typedef'], true, checkInfoMap); 9261847f8eSopenharmony_ci // 'type', 'readonly' 9361847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.PropertyDeclaration, ts.SyntaxKind.PropertySignature], 9461847f8eSopenharmony_ci ['type', 'readonly'], false, checkInfoMap); 9561847f8eSopenharmony_ci // 'default' 9661847f8eSopenharmony_ci legalityCheck(node, comments, [ts.SyntaxKind.PropertyDeclaration, ts.SyntaxKind.PropertySignature, 9761847f8eSopenharmony_ci ts.SyntaxKind.VariableStatement], ['default'], false, checkInfoMap); 9861847f8eSopenharmony_ci return checkInfoMap; 9961847f8eSopenharmony_ci} 10061847f8eSopenharmony_ciexports.checkJsDocLegality = checkJsDocLegality; 10161847f8eSopenharmony_ci 10261847f8eSopenharmony_cifunction getIllegalKinds(legalKinds) { 10361847f8eSopenharmony_ci const illegalKinds = []; 10461847f8eSopenharmony_ci const legalKindSet = new Set(legalKinds); 10561847f8eSopenharmony_ci commentNodeWhiteList.forEach(kind => { 10661847f8eSopenharmony_ci if (!legalKindSet.has(kind)) { 10761847f8eSopenharmony_ci illegalKinds.push(kind); 10861847f8eSopenharmony_ci } 10961847f8eSopenharmony_ci }); 11061847f8eSopenharmony_ci return illegalKinds; 11161847f8eSopenharmony_ci} 11261847f8eSopenharmony_ci 11361847f8eSopenharmony_cifunction dealSpecialTag(comment, tagName) { 11461847f8eSopenharmony_ci let checkResult = false; 11561847f8eSopenharmony_ci const useinsteadResultObj = { 11661847f8eSopenharmony_ci hasUseinstead: false, 11761847f8eSopenharmony_ci hasDeprecated: false, 11861847f8eSopenharmony_ci }; 11961847f8eSopenharmony_ci let paramTagNum = 0; 12061847f8eSopenharmony_ci comment.tags.forEach(tag => { 12161847f8eSopenharmony_ci if (tagName === 'useinstead') { 12261847f8eSopenharmony_ci if (tag.tag === tagName) { 12361847f8eSopenharmony_ci useinsteadResultObj.hasUseinstead = true; 12461847f8eSopenharmony_ci } else if (tag.tag === 'deprecated') { 12561847f8eSopenharmony_ci useinsteadResultObj.hasDeprecated = true; 12661847f8eSopenharmony_ci } 12761847f8eSopenharmony_ci } else if (((tagName === 'interface' || tagName === 'typedef') && (tag.tag === 'interface' || 12861847f8eSopenharmony_ci tag.tag === 'typedef')) || tag.tag === tagName) { 12961847f8eSopenharmony_ci checkResult = true; 13061847f8eSopenharmony_ci } 13161847f8eSopenharmony_ci if (tag.tag === 'param') { 13261847f8eSopenharmony_ci paramTagNum++; 13361847f8eSopenharmony_ci } 13461847f8eSopenharmony_ci }); 13561847f8eSopenharmony_ci return { 13661847f8eSopenharmony_ci useinsteadResultObj: useinsteadResultObj, 13761847f8eSopenharmony_ci checkResult: checkResult, 13861847f8eSopenharmony_ci paramTagNum: paramTagNum, 13961847f8eSopenharmony_ci }; 14061847f8eSopenharmony_ci} 14161847f8eSopenharmony_ci 14261847f8eSopenharmony_cifunction legalityCheck(node, comments, legalKinds, tagsName, isRequire, checkInfoMap, extraCheckCallback) { 14361847f8eSopenharmony_ci const illegalKinds = getIllegalKinds(legalKinds); 14461847f8eSopenharmony_ci let illegalKindSet = new Set(illegalKinds); 14561847f8eSopenharmony_ci const legalKindSet = new Set(legalKinds); 14661847f8eSopenharmony_ci const isFunctionType = ts.SyntaxKind.FunctionType === node.type?.kind; 14761847f8eSopenharmony_ci const functionTag = ['param', 'returns', 'throws']; 14861847f8eSopenharmony_ci tagsName.forEach(tagName => { 14961847f8eSopenharmony_ci if (tagName === 'extends') { 15061847f8eSopenharmony_ci illegalKindSet = new Set(commentNodeWhiteList); 15161847f8eSopenharmony_ci } else if (tagName === 'syscap') { 15261847f8eSopenharmony_ci illegalKindSet = new Set([]); 15361847f8eSopenharmony_ci } 15461847f8eSopenharmony_ci if (functionTag.includes(tagName) && !isFunctionType) { 15561847f8eSopenharmony_ci legalKindSet.delete(ts.SyntaxKind.TypeAliasDeclaration); 15661847f8eSopenharmony_ci } 15761847f8eSopenharmony_ci if (tagName === 'returns' && node.kind === ts.SyntaxKind.TypeAliasDeclaration && isFunctionType && 15861847f8eSopenharmony_ci node.type?.type?.kind === ts.SyntaxKind.VoidKeyword) { 15961847f8eSopenharmony_ci legalKindSet.delete(ts.SyntaxKind.TypeAliasDeclaration); 16061847f8eSopenharmony_ci } 16161847f8eSopenharmony_ci comments.forEach((comment, index) => { 16261847f8eSopenharmony_ci if (!checkInfoMap[index]) { 16361847f8eSopenharmony_ci checkInfoMap[index] = { 16461847f8eSopenharmony_ci missingTags: [], 16561847f8eSopenharmony_ci illegalTags: [], 16661847f8eSopenharmony_ci }; 16761847f8eSopenharmony_ci } 16861847f8eSopenharmony_ci const dealSpecialTagResult = dealSpecialTag(comment, tagName); 16961847f8eSopenharmony_ci let parameterNum = 0; 17061847f8eSopenharmony_ci if (tagName === 'since') { 17161847f8eSopenharmony_ci } 17261847f8eSopenharmony_ci if (tagName === 'param' && (ts.isMethodDeclaration(node) || ts.isMethodSignature(node) || 17361847f8eSopenharmony_ci ts.isFunctionDeclaration(node) || ts.isCallSignatureDeclaration(node) || ts.isConstructorDeclaration(node) || 17461847f8eSopenharmony_ci ts.isTypeAliasDeclaration(node))) { 17561847f8eSopenharmony_ci const parameterLength = ts.isTypeAliasDeclaration(node) ? node.type.parameters?.length : node.parameters.length; 17661847f8eSopenharmony_ci parameterNum = parameterLength === undefined ? 0 : parameterLength; 17761847f8eSopenharmony_ci checkResult = parameterNum !== dealSpecialTagResult.paramTagNum; 17861847f8eSopenharmony_ci } 17961847f8eSopenharmony_ci let extraCheckResult = false; 18061847f8eSopenharmony_ci if (!extraCheckCallback) { 18161847f8eSopenharmony_ci extraCheckResult = true; 18261847f8eSopenharmony_ci } else { 18361847f8eSopenharmony_ci extraCheckResult = extraCheckCallback(node, dealSpecialTagResult.checkResult); 18461847f8eSopenharmony_ci } 18561847f8eSopenharmony_ci // useinstead特殊处理 18661847f8eSopenharmony_ci if (isRequire && tagName !== 'useinstead' && ((tagName !== 'useinstead' && tagName !== 'param' && 18761847f8eSopenharmony_ci !dealSpecialTagResult.checkResult && legalKindSet.has(node.kind)) || (tagName === 'param' && 18861847f8eSopenharmony_ci dealSpecialTagResult.paramTagNum < parameterNum)) && extraCheckResult) { 18961847f8eSopenharmony_ci // 报错 19061847f8eSopenharmony_ci checkInfoMap[index].missingTags.push(tagName); 19161847f8eSopenharmony_ci } else if (((tagName !== 'useinstead' && tagName !== 'param' && dealSpecialTagResult.checkResult && 19261847f8eSopenharmony_ci illegalKindSet.has(node.kind)) || (tagName === 'useinstead' && 19361847f8eSopenharmony_ci !dealSpecialTagResult.useinsteadResultObj.hasDeprecated && 19461847f8eSopenharmony_ci dealSpecialTagResult.useinsteadResultObj.hasUseinstead) || 19561847f8eSopenharmony_ci (tagName === 'param' && dealSpecialTagResult.paramTagNum > parameterNum)) && extraCheckResult) { 19661847f8eSopenharmony_ci // 报错 19761847f8eSopenharmony_ci let errorInfo = createErrorInfo(ErrorValueInfo.ERROR_USE, [tagName]); 19861847f8eSopenharmony_ci if (tagName === 'param') { 19961847f8eSopenharmony_ci errorInfo = createErrorInfo(ErrorValueInfo.ERROR_MORELABEL, [parameterNum + 1, tagName]); 20061847f8eSopenharmony_ci } 20161847f8eSopenharmony_ci checkInfoMap[index].illegalTags.push({ 20261847f8eSopenharmony_ci checkResult: false, 20361847f8eSopenharmony_ci errorInfo, 20461847f8eSopenharmony_ci index, 20561847f8eSopenharmony_ci }); 20661847f8eSopenharmony_ci } 20761847f8eSopenharmony_ci }); 20861847f8eSopenharmony_ci }); 20961847f8eSopenharmony_ci return checkInfoMap; 21061847f8eSopenharmony_ci} 21161847f8eSopenharmony_ci 21261847f8eSopenharmony_ci// 标签重复性检查 21361847f8eSopenharmony_cifunction checkTagsQuantity(comment, index, errorLogs) { 21461847f8eSopenharmony_ci const multipleTags = ['throws', 'param']; 21561847f8eSopenharmony_ci const tagCountObj = {}; 21661847f8eSopenharmony_ci comment.tags.forEach(tag => { 21761847f8eSopenharmony_ci if (!tagCountObj[tag.tag]) { 21861847f8eSopenharmony_ci tagCountObj[tag.tag] = 0; 21961847f8eSopenharmony_ci } 22061847f8eSopenharmony_ci tagCountObj[tag.tag] = tagCountObj[tag.tag] + 1; 22161847f8eSopenharmony_ci }); 22261847f8eSopenharmony_ci for (const tagName in tagCountObj) { 22361847f8eSopenharmony_ci if (tagCountObj[tagName] > 1 && multipleTags.indexOf(tagName) < 0) { 22461847f8eSopenharmony_ci errorLogs.push({ 22561847f8eSopenharmony_ci checkResult: false, 22661847f8eSopenharmony_ci errorInfo: createErrorInfo(ErrorValueInfo.ERROR_REPEATLABEL, [tagName]), 22761847f8eSopenharmony_ci index, 22861847f8eSopenharmony_ci }); 22961847f8eSopenharmony_ci } 23061847f8eSopenharmony_ci } 23161847f8eSopenharmony_ci // interface/typedef互斥校验 23261847f8eSopenharmony_ci if (tagCountObj.interface > 0 & tagCountObj.typedef > 0) { 23361847f8eSopenharmony_ci errorLogs.push({ 23461847f8eSopenharmony_ci checkResult: false, 23561847f8eSopenharmony_ci errorInfo: ErrorValueInfo.ERROR_USE_INTERFACE, 23661847f8eSopenharmony_ci index, 23761847f8eSopenharmony_ci }); 23861847f8eSopenharmony_ci } 23961847f8eSopenharmony_ci} 24061847f8eSopenharmony_ci 24161847f8eSopenharmony_cilet paramIndex = 0; 24261847f8eSopenharmony_cilet throwsIndex = 0; 24361847f8eSopenharmony_ci 24461847f8eSopenharmony_cifunction checkTagValue(tag, index, node, fileName, errorLogs) { 24561847f8eSopenharmony_ci const { JsDocValueChecker } = require('./check_jsdoc_value/check_rest_value'); 24661847f8eSopenharmony_ci const checker = JsDocValueChecker[tag.tag]; 24761847f8eSopenharmony_ci 24861847f8eSopenharmony_ci if (checker) { 24961847f8eSopenharmony_ci let valueCheckResult; 25061847f8eSopenharmony_ci if (tag.tag === 'param' && [ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature, 25161847f8eSopenharmony_ci ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature, ts.SyntaxKind.Constructor].indexOf(node.kind) >= 0) { 25261847f8eSopenharmony_ci valueCheckResult = checker(tag, node, fileName, paramIndex++); 25361847f8eSopenharmony_ci } else if (tag.tag === 'throws') { 25461847f8eSopenharmony_ci valueCheckResult = checker(tag, node, fileName, throwsIndex++); 25561847f8eSopenharmony_ci } else { 25661847f8eSopenharmony_ci valueCheckResult = checker(tag, node, fileName); 25761847f8eSopenharmony_ci } 25861847f8eSopenharmony_ci if (!valueCheckResult.checkResult) { 25961847f8eSopenharmony_ci valueCheckResult.index = index; 26061847f8eSopenharmony_ci // 输出告警 26161847f8eSopenharmony_ci errorLogs.push(valueCheckResult); 26261847f8eSopenharmony_ci } 26361847f8eSopenharmony_ci } 26461847f8eSopenharmony_ci} 26561847f8eSopenharmony_ci 26661847f8eSopenharmony_cifunction checkJsDocOfCurrentNode(node, sourcefile, fileName, isGuard) { 26761847f8eSopenharmony_ci const checkInfoArray = []; 26861847f8eSopenharmony_ci const lastComment = parseJsDoc(node).length > 0 ? [parseJsDoc(node).pop()] : []; 26961847f8eSopenharmony_ci const comments = isGuard ? lastComment : parseJsDoc(node); 27061847f8eSopenharmony_ci const checkInfoMap = checkJsDocLegality(node, comments, {}); 27161847f8eSopenharmony_ci const checkOrderResult = checkApiOrder(comments); 27261847f8eSopenharmony_ci checkOrderResult.forEach((result, index) => { 27361847f8eSopenharmony_ci checkInfoMap[index.toString()].orderResult = result; 27461847f8eSopenharmony_ci }); 27561847f8eSopenharmony_ci comments.forEach((comment, index) => { 27661847f8eSopenharmony_ci const errorLogs = []; 27761847f8eSopenharmony_ci // 继承校验 27861847f8eSopenharmony_ci checkInheritTag(comment, node, sourcefile, fileName, index); 27961847f8eSopenharmony_ci // 值检验 28061847f8eSopenharmony_ci comment.tags.forEach(tag => { 28161847f8eSopenharmony_ci const checkAPIDecorator = checkAPITagName(tag, node, sourcefile, fileName, index); 28261847f8eSopenharmony_ci if (!checkAPIDecorator.checkResult) { 28361847f8eSopenharmony_ci errorLogs.push(checkAPIDecorator); 28461847f8eSopenharmony_ci } 28561847f8eSopenharmony_ci checkTagValue(tag, index, node, fileName, errorLogs); 28661847f8eSopenharmony_ci }); 28761847f8eSopenharmony_ci paramIndex = 0; 28861847f8eSopenharmony_ci throwsIndex = 0; 28961847f8eSopenharmony_ci // 标签数量校验 29061847f8eSopenharmony_ci checkTagsQuantity(comment, index, errorLogs); 29161847f8eSopenharmony_ci checkInfoMap[index.toString()].illegalTags = checkInfoMap[index.toString()].illegalTags.concat(errorLogs); 29261847f8eSopenharmony_ci }); 29361847f8eSopenharmony_ci for (const key in checkInfoMap) { 29461847f8eSopenharmony_ci checkInfoArray.push(checkInfoMap[key]); 29561847f8eSopenharmony_ci } 29661847f8eSopenharmony_ci return checkInfoArray; 29761847f8eSopenharmony_ci} 29861847f8eSopenharmony_ciexports.checkJsDocOfCurrentNode = checkJsDocOfCurrentNode; 29961847f8eSopenharmony_ci 30061847f8eSopenharmony_cifunction checkJSDoc(node, sourcefile, fileName, isGuard) { 30161847f8eSopenharmony_ci const verificationResult = checkJsDocOfCurrentNode(node, sourcefile, fileName, isGuard); 30261847f8eSopenharmony_ci 30361847f8eSopenharmony_ci verificationResult.forEach(item => { 30461847f8eSopenharmony_ci let errorInfo = ''; 30561847f8eSopenharmony_ci if (item.missingTags.length > 0) { 30661847f8eSopenharmony_ci item.missingTags.forEach(lostLabel => { 30761847f8eSopenharmony_ci errorInfo = createErrorInfo(ErrorValueInfo.ERROR_LOST_LABEL, [lostLabel]); 30861847f8eSopenharmony_ci addAPICheckErrorLogs(node, sourcefile, fileName, ErrorType.WRONG_SCENE, errorInfo, FileType.JSDOC, 30961847f8eSopenharmony_ci ErrorLevel.MIDDLE); 31061847f8eSopenharmony_ci }); 31161847f8eSopenharmony_ci } 31261847f8eSopenharmony_ci if (item.illegalTags.length > 0) { 31361847f8eSopenharmony_ci item.illegalTags.forEach(wrongValueLabel => { 31461847f8eSopenharmony_ci errorInfo = wrongValueLabel.errorInfo; 31561847f8eSopenharmony_ci addAPICheckErrorLogs(node, sourcefile, fileName, ErrorType.WRONG_VALUE, errorInfo, FileType.JSDOC, 31661847f8eSopenharmony_ci ErrorLevel.MIDDLE); 31761847f8eSopenharmony_ci }); 31861847f8eSopenharmony_ci } 31961847f8eSopenharmony_ci if (!item.orderResult.checkResult) { 32061847f8eSopenharmony_ci errorInfo = item.orderResult.errorInfo; 32161847f8eSopenharmony_ci addAPICheckErrorLogs(node, sourcefile, fileName, ErrorType.WRONG_ORDER, errorInfo, FileType.JSDOC, 32261847f8eSopenharmony_ci ErrorLevel.MIDDLE); 32361847f8eSopenharmony_ci } 32461847f8eSopenharmony_ci }); 32561847f8eSopenharmony_ci} 32661847f8eSopenharmony_ciexports.checkJSDoc = checkJSDoc; 327