Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: 修复CodCC白名单无效问题 #5802 #5853

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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