mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-23 15:20:17 +00:00
fix:api_check门禁报错修复
Signed-off-by: fanjiaojiao <fanjiaojiao@huawei.com>
This commit is contained in:
parent
ea097eae85
commit
22fc0b2eb8
@ -17,7 +17,7 @@
|
||||
|
||||
### permission文件配置
|
||||
|
||||
在api_check_plugin/config文件夹下,创建名为“config.json”的文件,用于存放permission配置文件。打开链接中的仓库,打开systemres/main/config.json文件,将文件内容复制到刚创建的api_check_plugin/config/config.json中
|
||||
在api_check_plugin/config文件夹下,存在名为“config.json”的文件,用于存放permission配置文件。打开链接中的仓库,打开systemres/main/config.json文件,将文件内容复制到api_check_plugin/config/config.json中(覆盖原内容)
|
||||
|
||||
[utils_system_resources: Providing system resources such as fonts | 字体等系统资源 (gitee.com)](https://gitee.com/openharmony/utils_system_resources)
|
||||
|
||||
|
5
build-tools/api_check_plugin/config/config.json
Normal file
5
build-tools/api_check_plugin/config/config.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"module": {
|
||||
"definePermissions": []
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ const urlSuffix = '/systemres/main/config.json';
|
||||
|
||||
exports.checkJSDoc = function (node, sourceFile, fileName) {
|
||||
const checkLegality = require('./src/check_legality');
|
||||
return checkLegality.checkJsDocOfCurrentNode(node, sourceFile, undefined, fileName);
|
||||
return checkLegality.checkJsDocOfCurrentNode(node, sourceFile, fileName);
|
||||
};
|
||||
|
||||
exports.initEnv = function (version) {
|
||||
|
@ -84,8 +84,7 @@ function checkAllNode(node, sourcefile, fileName) {
|
||||
checkPermission(node, sourcefile, fileName);
|
||||
|
||||
if (commentNodeWhiteList.includes(node.kind)) {
|
||||
const permissionConfigPath = require('../config/config.json');
|
||||
checkJSDoc(node, sourcefile, permissionConfigPath, fileName);
|
||||
checkJSDoc(node, sourcefile, fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,26 +54,26 @@ function checkJsDocLegality(node, comments, checkInfoMap) {
|
||||
// 'param'
|
||||
legalityCheck(node, comments, [ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
|
||||
ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature, ts.SyntaxKind.Constructor], ['param'], true, checkInfoMap,
|
||||
(currentNode, checkResult) => {
|
||||
if (!new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
|
||||
(currentNode, checkResult) => {
|
||||
if (!new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
|
||||
ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.Constructor]).has(currentNode.kind)) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return currentNode.parameters && currentNode.parameters.length > 0;
|
||||
}
|
||||
return currentNode.parameters && currentNode.parameters.length > 0;
|
||||
}
|
||||
);
|
||||
// 'returns'
|
||||
legalityCheck(node, comments, [ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
|
||||
ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature], ['returns'], true, checkInfoMap,
|
||||
(currentNode, checkResult) => {
|
||||
if (!checkResult && !new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
|
||||
(currentNode, checkResult) => {
|
||||
if (!checkResult && !new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
|
||||
ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature]).has(currentNode.kind)) {
|
||||
return false;
|
||||
}
|
||||
return !(!checkResult && !new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
|
||||
ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature]).has(currentNode.kind)) && (currentNode.type
|
||||
return false;
|
||||
}
|
||||
return !(!checkResult && !new Set([ts.SyntaxKind.FunctionDeclaration, ts.SyntaxKind.MethodSignature,
|
||||
ts.SyntaxKind.MethodDeclaration, ts.SyntaxKind.CallSignature]).has(currentNode.kind)) && (currentNode.type
|
||||
&& currentNode.type.kind !== ts.SyntaxKind.VoidKeyword);
|
||||
}
|
||||
}
|
||||
);
|
||||
// 'useinstead'
|
||||
legalityCheck(node, comments, commentNodeWhiteList, ['useinstead'], true, checkInfoMap,
|
||||
@ -244,11 +244,7 @@ function checkTagValue(tag, index, node, fileName, errorLogs) {
|
||||
}
|
||||
}
|
||||
|
||||
function checkJsDocOfCurrentNode(node, sourcefile, permissionConfigPath, fileName) {
|
||||
let { permissionFile } = require('./utils');
|
||||
if (permissionConfigPath && fs.existsSync(permissionConfigPath)) {
|
||||
permissionFile = permissionConfigPath;
|
||||
}
|
||||
function checkJsDocOfCurrentNode(node, sourcefile, fileName) {
|
||||
const checkInfoArray = [];
|
||||
const comments = parseJsDoc(node);
|
||||
const checkInfoMap = checkJsDocLegality(node, comments, {});
|
||||
@ -281,8 +277,8 @@ function checkJsDocOfCurrentNode(node, sourcefile, permissionConfigPath, fileNam
|
||||
}
|
||||
exports.checkJsDocOfCurrentNode = checkJsDocOfCurrentNode;
|
||||
|
||||
function checkJSDoc(node, sourcefile, permissionConfigPath, fileName) {
|
||||
const verificationResult = checkJsDocOfCurrentNode(node, sourcefile, permissionConfigPath, fileName);
|
||||
function checkJSDoc(node, sourcefile, fileName) {
|
||||
const verificationResult = checkJsDocOfCurrentNode(node, sourcefile, fileName);
|
||||
|
||||
let isMissingTagWhitetFile = true;
|
||||
let isIllegalTagWhitetFile = true;
|
||||
|
Loading…
Reference in New Issue
Block a user