Skip to content

Commit

Permalink
Merge pull request #5851 from Yuanruitao/bugfix_codecc_whitelist
Browse files Browse the repository at this point in the history
bugfix: 修复CodCC白名单无效问题 #5802
  • Loading branch information
irwinsun authored Dec 22, 2021
2 parents 11692d2 + b2f63bd commit 7ffb801
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/backend/codecc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ buildscript {
commonsHttpclientVersion = "3.1"
ciVersion = "1.5.8-RELEASE"
jsonVersion = "20180130"
log4jVersion = "2.16.0"
log4jVersion = "2.17.0"
}

def mavenRepoUrl = System.getProperty("mavenRepoUrl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,14 +450,14 @@ private boolean checkMaskByPath(CCNDefectEntity ccnDefectEntity,
&& (ccnDefectEntity.getStatus() & ComConstants.DefectStatus.FIXED.value()) == 0
&& (PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, filterPaths)
|| (CollectionUtils.isNotEmpty(pathList)
&& !PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, pathList)))) {
&& !PathUtils.checkIfMaskByPath(filePath, pathList)))) {
ccnDefectEntity.setStatus(ccnDefectEntity.getStatus() | ComConstants.DefectStatus.PATH_MASK.value());
ccnDefectEntity.setExcludeTime(curTime);
return true;
}
// 如果已经是被路径屏蔽的,但是实质没有被路径屏蔽,则要把屏蔽状态去掉
else if ((CollectionUtils.isEmpty(pathList)
|| PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, pathList))
|| PathUtils.checkIfMaskByPath(filePath, pathList))
&& !PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, filterPaths)
&& (ccnDefectEntity.getStatus() & ComConstants.DefectStatus.PATH_MASK.value()) > 0) {
ccnDefectEntity.setStatus(ccnDefectEntity.getStatus() - ComConstants.DefectStatus.PATH_MASK.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,14 @@ private boolean checkMaskByPath(LintDefectV2Entity lintDefectV2Entity,
&& (lintDefectV2Entity.getStatus() & DefectStatus.FIXED.value()) == 0
&& (PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, filterPaths)
|| (CollectionUtils.isNotEmpty(pathList)
&& !PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, pathList)))) {
&& !PathUtils.checkIfMaskByPath(filePath, pathList)))) {
lintDefectV2Entity.setStatus(lintDefectV2Entity.getStatus() | ComConstants.TaskFileStatus.PATH_MASK.value());
lintDefectV2Entity.setExcludeTime(curTime);
return true;
}
// 如果已经是被路径屏蔽的,但是实质没有被路径屏蔽,则要把屏蔽状态去掉
else if ((CollectionUtils.isEmpty(pathList)
|| PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, pathList))
|| PathUtils.checkIfMaskByPath(filePath, pathList))
&& !PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, filterPaths)
&& (lintDefectV2Entity.getStatus() & ComConstants.TaskFileStatus.PATH_MASK.value()) > 0) {
lintDefectV2Entity.setStatus(lintDefectV2Entity.getStatus() - ComConstants.TaskFileStatus.PATH_MASK.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ private List<CLOCDefectEntity> checkMaskByPath(List<CLOCDefectEntity> clocDefect
// 命中黑名单 或 没有命中白名单
if (PathUtils.checkIfMaskByPath(it.getFileName(), filterPath)
|| (CollectionUtils.isNotEmpty(pathSet)
&& !PathUtils.checkIfMaskByPath(StringUtils.isBlank(it.getRelPath())
? it.getFileName() : it.getRelPath(), pathSet))) {
&& !PathUtils.checkIfMaskByPath(it.getFileName(), pathSet))) {
pathMaskDefectList.add(it.getFileName());
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ private boolean checkMaskByPath(DUPCDefectEntity dupcDefectEntity,
&& (dupcDefectEntity.getStatus() & ComConstants.DefectStatus.FIXED.value()) == 0
&& (PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, filterPaths)
|| (CollectionUtils.isNotEmpty(pathSet)
&& !PathUtils.checkIfMaskByPath(StringUtils.isNotEmpty(relPath) ? relPath : filePath, pathSet))))
&& !PathUtils.checkIfMaskByPath(filePath, pathSet))))
{
dupcDefectEntity.setStatus(dupcDefectEntity.getStatus() | ComConstants.TaskFileStatus.PATH_MASK.value());
dupcDefectEntity.setExcludeTime(curTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ private int checkMaskByPath(DefectEntity defectEntity,
Set<String> filterPathSet,
Set<String> pathSet,
long currTime) {
String path = StringUtils.isBlank(defectEntity.getRelPath())
? defectEntity.getFilePathname()
: defectEntity.getRelPath();
String path = defectEntity.getFilePathname();
// 当前未被屏蔽但是命中屏蔽路径的,需要把告警屏蔽掉
if ((status & ComConstants.DefectStatus.PATH_MASK.value()) == 0
&& (PathUtils.checkIfMaskByPath(path, filterPathSet)
Expand Down

0 comments on commit 7ffb801

Please sign in to comment.