mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-23 15:20:17 +00:00
!8748 api check命名校验--禁用词汇位置修改
Merge pull request !8748 from fanjiaojiao/master
This commit is contained in:
commit
d69a17de03
@ -64,7 +64,7 @@ function checkApiNamingWords(node, sourcefile, fileName, lowIdentifier) {
|
||||
);
|
||||
break;
|
||||
} else {
|
||||
const isIgnoreWord = checkIgnoreWord(lowercaseIgnoreWordArr, lowIdentifier);
|
||||
const isIgnoreWord = checkIgnoreWord(lowercaseIgnoreWordArr, lowIdentifier, value.badWord);
|
||||
if (isIgnoreWord === false) {
|
||||
addAPICheckErrorLogs(node, sourcefile, fileName, ErrorType.NAMING_ERRORS, errorInfo, FileType.LOG_API,
|
||||
ErrorLevel.MIDDLE
|
||||
@ -74,14 +74,18 @@ function checkApiNamingWords(node, sourcefile, fileName, lowIdentifier) {
|
||||
}
|
||||
}
|
||||
|
||||
function checkIgnoreWord(lowercaseIgnoreWordArr, lowIdentifier) {
|
||||
function checkIgnoreWord(lowercaseIgnoreWordArr, lowIdentifier, badWord) {
|
||||
let isIgnoreWord = false;
|
||||
const isNamingFoot = lowIdentifier.substring(lowIdentifier.length - badWord.length, lowIdentifier.length) === badWord;
|
||||
for (let i = 0; i < lowercaseIgnoreWordArr.length; i++) {
|
||||
if (lowercaseIgnoreWordArr[i] && lowIdentifier.indexOf(lowercaseIgnoreWordArr[i]) !== -1) {
|
||||
isIgnoreWord = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isNamingFoot) {
|
||||
isIgnoreWord = true;
|
||||
}
|
||||
return isIgnoreWord;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user