From 9ec9692af0ff600a708a772bc91f6505cb4bf174 Mon Sep 17 00:00:00 2001 From: Yuanruitao <1075097840@qq.com> Date: Sun, 19 Dec 2021 20:43:20 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8DCodCC=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98=20#5802?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../codecc/defect/component/NewCCNDefectTracingComponent.java | 4 ++-- .../defect/component/NewLintDefectTracingComponent.java | 4 ++-- .../bk/codecc/defect/consumer/CLOCDefectCommitConsumer.java | 3 +-- .../bk/codecc/defect/consumer/DUPCDefectCommitConsumer.java | 2 +- .../defect/service/impl/UpdateDefectBizServiceImpl.java | 4 +--- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/component/NewCCNDefectTracingComponent.java b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/component/NewCCNDefectTracingComponent.java index 9ccf703c078..021b621d133 100644 --- a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/component/NewCCNDefectTracingComponent.java +++ b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/component/NewCCNDefectTracingComponent.java @@ -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()); diff --git a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/component/NewLintDefectTracingComponent.java b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/component/NewLintDefectTracingComponent.java index 96a0853527e..85c52253a3d 100644 --- a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/component/NewLintDefectTracingComponent.java +++ b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/component/NewLintDefectTracingComponent.java @@ -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()); diff --git a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/consumer/CLOCDefectCommitConsumer.java b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/consumer/CLOCDefectCommitConsumer.java index e0049ff914a..06a1cdfab31 100644 --- a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/consumer/CLOCDefectCommitConsumer.java +++ b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/consumer/CLOCDefectCommitConsumer.java @@ -203,8 +203,7 @@ private List checkMaskByPath(List 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; } diff --git a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/consumer/DUPCDefectCommitConsumer.java b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/consumer/DUPCDefectCommitConsumer.java index f61394223a7..3463ebf084f 100644 --- a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/consumer/DUPCDefectCommitConsumer.java +++ b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/consumer/DUPCDefectCommitConsumer.java @@ -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); diff --git a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/service/impl/UpdateDefectBizServiceImpl.java b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/service/impl/UpdateDefectBizServiceImpl.java index 8f4e471ef4f..c3df0ce2d99 100644 --- a/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/service/impl/UpdateDefectBizServiceImpl.java +++ b/src/backend/codecc/core/defect/biz-defect/src/main/java/com/tencent/bk/codecc/defect/service/impl/UpdateDefectBizServiceImpl.java @@ -246,9 +246,7 @@ private int checkMaskByPath(DefectEntity defectEntity, Set filterPathSet, Set 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)