From e511c890e4a401a8b8b3503275cace332fc197aa Mon Sep 17 00:00:00 2001 From: Ulli Hafner Date: Wed, 10 Jan 2024 20:26:15 +0100 Subject: [PATCH] Limit property `skipPostProcessing` to package and module detection. --- .../analysis/core/steps/IssuesScanner.java | 26 +++++++++++++------ .../issues/scan-parameters.properties | 2 +- .../warnings/steps/ModuleDetectorITest.java | 2 +- .../warnings/steps/PackageDetectorsITest.java | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesScanner.java b/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesScanner.java index 5d3aac8e3d..8f2e6ce8d6 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesScanner.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesScanner.java @@ -89,7 +89,8 @@ enum PostProcessingMode { IssuesScanner(final Tool tool, final List filters, final Charset sourceCodeEncoding, final FilePath workspace, final Set sourceDirectories, final Run run, final FilePath jenkinsRootDir, final TaskListener listener, - final String scm, final BlameMode blameMode, final PostProcessingMode postProcessingMode, final boolean quiet) { + final String scm, final BlameMode blameMode, final PostProcessingMode postProcessingMode, + final boolean quiet) { this.filters = new ArrayList<>(filters); this.sourceCodeEncoding = sourceCodeEncoding; this.tool = tool; @@ -130,8 +131,7 @@ private RepositoryStatistics getRepositoryStatistics(final Report report) { private AnnotatedReport postProcessReport(final Report report) throws IOException, InterruptedException { if (tool.getDescriptor().isPostProcessingEnabled() - && report.isNotEmpty() - && postProcessingMode == PostProcessingMode.ENABLED) { + && report.isNotEmpty()) { report.logInfo("Post processing issues on '%s' with source code encoding '%s'", getAgentName(), sourceCodeEncoding); AnnotatedReport result = workspace.act(createPostProcessor(report)); @@ -146,7 +146,8 @@ private AnnotatedReport postProcessReport(final Report report) throws IOExceptio private ReportPostProcessor createPostProcessor(final Report report) { return new ReportPostProcessor(tool.getActualId(), report, sourceCodeEncoding.name(), - createBlamer(report), filters, getPermittedSourceDirectories(), sourceDirectories); + createBlamer(report), filters, getPermittedSourceDirectories(), sourceDirectories, + postProcessingMode); } private Set getPermittedSourceDirectories() { @@ -246,6 +247,7 @@ private static Report filter(final Report report, final List filte @SuppressWarnings("checkstyle:ClassDataAbstractionCoupling") private static class ReportPostProcessor extends MasterToSlaveFileCallable { private static final long serialVersionUID = -9138045560271783096L; + private static final String SKIPPING_POST_PROCESSING = "Skipping detection of missing package and module names"; private final String id; private final Report originalReport; @@ -253,11 +255,13 @@ private static class ReportPostProcessor extends MasterToSlaveFileCallable permittedSourceDirectories; private final Set requestedSourceDirectories; + private final PostProcessingMode postProcessingMode; private final List filters; + @SuppressWarnings("checkstyle:ParameterNumber") ReportPostProcessor(final String id, final Report report, final String sourceCodeEncoding, final Blamer blamer, final List filters, final Set permittedSourceDirectories, - final Set requestedSourceDirectories) { + final Set requestedSourceDirectories, final PostProcessingMode postProcessingMode) { super(); this.id = id; @@ -267,15 +271,21 @@ private static class ReportPostProcessor extends MasterToSlaveFileCallable