Skip to content

Fix warnings.

ci.jenkins.io / CPD succeeded Feb 27, 2024 in 0s

75 new issues, 326 total

Total New Outstanding Fixed Trend
326 75 251 55 👎

Reference build: Plugins » warnings-ng-plugin » main #47

Details

Severity distribution of new issues

Error Warning High Warning Normal Warning Low
0 7 13 55

Annotations

Check warning on line 300 in plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesRecorder.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

HIGH:
Found duplicated code.
Raw output
<pre><code>&#64;SuppressWarnings(&#34;unused&#34;) // used by Stapler view data binding public List&lt;WarningsQualityGate&gt; getQualityGates() { return qualityGates; } /** * Defines the ID of the results. The ID is used as URL of the results and as name in UI elements. If no ID is * given, then the ID of the associated result object is used. * &lt;p&gt; * Note: this property is not used if {&#64;link #isAggregatingResults} is {&#64;code false}. It is also not visible in the * UI in order to simplify the user interface. * &lt;/p&gt; * * &#64;param id * the ID of the results */ &#64;DataBoundSetter public void setId(final String id) { VALIDATION_UTILITIES.ensureValidId(id); this.id &#61; id; } public String getId() { return id; } /** * Defines the name of the results. The name is used for all labels in the UI. If no name is given, then the name of * the associated {&#64;link StaticAnalysisLabelProvider} is used. * &lt;p&gt; * Note: this property is not used if {&#64;link #isAggregatingResults} is {&#64;code false}. It is also not visible in the * UI in order to simplify the user interface. * &lt;/p&gt; * * &#64;param name * the name of the results */ &#64;DataBoundSetter public void setName(final String name) { this.name &#61; name; } public String getName() { return name; } /** * Gets the static analysis tools that will scan files and create issues. * * &#64;return the static analysis tools (wrapped as {&#64;link ToolProxy}) * &#64;see #getTools * &#64;deprecated this method is only intended to be called by the UI */ &#64;CheckForNull &#64;Deprecated public List&lt;ToolProxy&gt; getToolProxies() { return analysisTools.stream().map(ToolProxy::new).collect(Collectors.toList()); } /** * Sets the static analysis tools that will scan files and create issues. * * &#64;param toolProxies * the static analysis tools (wrapped as {&#64;link ToolProxy}) * * &#64;see #setTools(List) * &#64;deprecated this method is only intended to be called by the UI */ &#64;DataBoundSetter &#64;Deprecated public void setToolProxies(final List&lt;ToolProxy&gt; toolProxies) { analysisTools &#61; toolProxies.stream().map(ToolProxy::getTool).collect(Collectors.toList()); } /** * Sets the static analysis tools that will scan files and create issues. * * &#64;param tools * the static analysis tools */ &#64;DataBoundSetter public void setTools(final List&lt;Tool&gt; tools) { analysisTools &#61; new ArrayList&lt;&gt;(tools); } /** * Sets the static analysis tools that will scan files and create issues. * * &#64;param tool * the static analysis tool * &#64;param additionalTools * additional static analysis tools (might be empty) * * &#64;see #setTools(List) */ public void setTools(final Tool tool, final Tool... additionalTools) {<!-- --></code></pre>

Check warning on line 238 in plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/RecordIssuesStep.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

HIGH:
Found duplicated code.
Raw output
<pre><code>&#64;SuppressWarnings(&#34;unused&#34;) // used by Stapler view data binding public List&lt;WarningsQualityGate&gt; getQualityGates() { return qualityGates; } /** * Defines the ID of the results. The ID is used as URL of the results and as name in UI elements. If no ID is * given, then the ID of the associated result object is used. * &lt;p&gt; * Note: this property is not used if {&#64;link #isAggregatingResults} is {&#64;code false}. It is also not visible in the * UI in order to simplify the user interface. * &lt;/p&gt; * * &#64;param id * the ID of the results */ &#64;DataBoundSetter public void setId(final String id) { VALIDATION_UTILITIES.ensureValidId(id); this.id &#61; id; } public String getId() { return id; } /** * Defines the name of the results. The name is used for all labels in the UI. If no name is given, then the name of * the associated {&#64;link StaticAnalysisLabelProvider} is used. * &lt;p&gt; * Note: this property is not used if {&#64;link #isAggregatingResults} is {&#64;code false}. It is also not visible in the * UI in order to simplify the user interface. * &lt;/p&gt; * * &#64;param name * the name of the results */ &#64;DataBoundSetter public void setName(final String name) { this.name &#61; name; } public String getName() { return name; } /** * Gets the static analysis tools that will scan files and create issues. * * &#64;return the static analysis tools (wrapped as {&#64;link ToolProxy}) * &#64;see #getTools * &#64;deprecated this method is only intended to be called by the UI */ &#64;CheckForNull &#64;Deprecated public List&lt;ToolProxy&gt; getToolProxies() { return analysisTools.stream().map(ToolProxy::new).collect(Collectors.toList()); } /** * Sets the static analysis tools that will scan files and create issues. * * &#64;param toolProxies * the static analysis tools (wrapped as {&#64;link ToolProxy}) * * &#64;see #setTools(List) * &#64;deprecated this method is only intended to be called by the UI */ &#64;DataBoundSetter &#64;Deprecated public void setToolProxies(final List&lt;ToolProxy&gt; toolProxies) { analysisTools &#61; toolProxies.stream().map(ToolProxy::getTool).collect(Collectors.toList()); } /** * Sets the static analysis tools that will scan files and create issues. * * &#64;param tools * the static analysis tools */ &#64;DataBoundSetter public void setTools(final List&lt;Tool&gt; tools) { analysisTools &#61; new ArrayList&lt;&gt;(tools); } /** * Sets the static analysis tools that will scan files and create issues. * * &#64;param tool * the static analysis tool * &#64;param additionalTools * additional static analysis tools (might be empty) * * &#64;see #setTools(List) */ public void setTools(final Tool tool, final Tool... additionalTools) {<!-- --></code></pre>

Check warning on line 686 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ReferenceFinderITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

NORMAL:
Found duplicated code.
Raw output
<pre><code>FreeStyleProject reference &#61; createEmptyReferenceJob(REFERENCE_JOB_NAME, &#34;eclipse2Warnings.txt&#34;); enableWarnings(reference, recorder -&gt; { recorder.setEnabledForFailure(true); recorder.setQualityGates(List.of( new WarningsQualityGate(3, QualityGateType.NEW, QualityGateCriticality.UNSTABLE))); }); scheduleBuildAndAssertStatus(reference, Result.SUCCESS, analysisResult -&gt; assertThat(analysisResult).hasTotalSize(2) .hasNewSize(0) .hasQualityGateStatus(QualityGateStatus.PASSED)); // #2 FAILURE cleanAndCopy(reference, &#34;eclipse4Warnings.txt&#34;); Builder failureStep &#61; addFailureStep(reference); Run&lt;?, ?&gt; expectedReference &#61; scheduleBuildAndAssertStatus(reference, Result.FAILURE, analysisResult -&gt; assertThat(analysisResult).hasTotalSize(4) .hasNewSize(2) .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner(); removeBuilder(reference, failureStep); // #1 SUCCESS (Reference #1) FreeStyleProject project &#61; createJob(JOB_NAME, &#34;eclipse6Warnings.txt&#34;, Result.FAILURE, REFERENCE_JOB_NAME); enableWarnings(project, recorder -&gt; { recorder.setQualityGates(List.of( new WarningsQualityGate(2, QualityGateType.NEW, QualityGateCriticality.UNSTABLE)));</code></pre>

Check warning on line 811 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ReferenceFinderITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

NORMAL:
Found duplicated code.
Raw output
<pre><code>FreeStyleProject reference &#61; createEmptyReferenceJob(REFERENCE_JOB_NAME, &#34;eclipse2Warnings.txt&#34;); enableWarnings(reference, recorder -&gt; { recorder.setEnabledForFailure(true); recorder.setQualityGates(List.of( new WarningsQualityGate(3, QualityGateType.NEW, QualityGateCriticality.UNSTABLE))); }); scheduleBuildAndAssertStatus(reference, Result.SUCCESS, analysisResult -&gt; assertThat(analysisResult).hasTotalSize(2) .hasNewSize(0) .hasQualityGateStatus(QualityGateStatus.PASSED)); // #2 FAILURE cleanAndCopy(reference, &#34;eclipse4Warnings.txt&#34;); Builder failureStep &#61; addFailureStep(reference); Run&lt;?, ?&gt; expectedReference &#61; scheduleBuildAndAssertStatus(reference, Result.FAILURE, analysisResult -&gt; assertThat(analysisResult).hasTotalSize(4) .hasNewSize(2) .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner(); removeBuilder(reference, failureStep); // #1 SUCCESS (Reference #1) FreeStyleProject project &#61; createJob(JOB_NAME, &#34;eclipse6Warnings.txt&#34;, Result.FAILURE, REFERENCE_JOB_NAME); enableWarnings(project, recorder -&gt; { recorder.setQualityGates(List.of( new WarningsQualityGate(2, QualityGateType.NEW, QualityGateCriticality.UNSTABLE)));</code></pre>

Check warning on line 182 in plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/AnalysisStepDescriptor.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

HIGH:
Found duplicated code.
Raw output
<pre><code>return new ListBoxModel(); } /** * Performs on-the-fly validation of the health report thresholds. * * &#64;param project * the project that is configured * &#64;param healthy * the healthy threshold * &#64;param unhealthy * the unhealthy threshold * * &#64;return the validation result */ &#64;POST public FormValidation doCheckHealthy(&#64;AncestorInPath final BuildableItem project, &#64;QueryParameter final int healthy, &#64;QueryParameter final int unhealthy) { if (!JENKINS.hasPermission(Item.CONFIGURE, project)) { return FormValidation.ok(); } return model.validateHealthy(healthy, unhealthy); } /** * Performs on-the-fly validation of the health report thresholds. * * &#64;param project * the project that is configured * &#64;param healthy * the healthy threshold * &#64;param unhealthy * the unhealthy threshold * * &#64;return the validation result */ &#64;POST public FormValidation doCheckUnhealthy(&#64;AncestorInPath final BuildableItem project, &#64;QueryParameter final int healthy, &#64;QueryParameter final int unhealthy) { if (!JENKINS.hasPermission(Item.CONFIGURE, project)) { return FormValidation.ok(); } return model.validateUnhealthy(healthy, unhealthy); } /** * Returns a model with all aggregation trend chart positions. * * &#64;return a model with all aggregation trend chart positions */ &#64;POST public ListBoxModel doFillTrendChartTypeItems() { if (JENKINS.hasPermission(Jenkins.READ)) { return model.getAllTrendChartTypes(); } return new ListBoxModel(); } /** * Performs on-the-fly validation of the ID. * * &#64;param project * the project that is configured * &#64;param id * the ID of the tool * * &#64;return the validation result */ &#64;POST</code></pre>

Check warning on line 135 in plugin/src/test/java/io/jenkins/plugins/analysis/core/util/QualityGateEvaluatorTest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>result &#61; evaluate(qualityGates, builder, new FilteredLog()); assertThat(result.getOverallStatus()).isEqualTo(io.jenkins.plugins.util.QualityGateStatus.WARNING); assertThat(result.getMessages()).hasSize(2).first().asString() .contains(&#34;≪Unstable≫&#34;, QualityGateType.TOTAL.getDisplayName(), &#34;Actual value: 1&#34;, &#34;Quality gate: 1.00&#34;); assertThat(result.getMessages()).hasSize(2).last().asString() .contains(&#34;≪Unstable≫&#34;, QualityGateType.NEW.getDisplayName(), &#34;Actual value: 1&#34;, &#34;Quality gate: 1.00&#34;);</code></pre>

Check warning on line 188 in plugin/src/test/java/io/jenkins/plugins/analysis/core/util/QualityGateEvaluatorTest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>result &#61; evaluate(qualityGates, builder, new FilteredLog()); assertThat(result.getOverallStatus()).isEqualTo(io.jenkins.plugins.util.QualityGateStatus.WARNING); assertThat(result.getMessages()).hasSize(2).first().asString() .contains(&#34;≪Unstable≫&#34;, QualityGateType.TOTAL.getDisplayName(), &#34;Actual value: 1&#34;, &#34;Quality gate: 1.00&#34;); assertThat(result.getMessages()).hasSize(2).last().asString() .contains(&#34;≪Unstable≫&#34;, QualityGateType.NEW.getDisplayName(), &#34;Actual value: 1&#34;, &#34;Quality gate: 1.00&#34;);</code></pre>

Check warning on line 99 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/GitForensicsITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>void shouldObtainBlamesAndForensicsInFreestyleJob() throws IOException { FreeStyleProject job &#61; createFreeStyleProject(); createFileInWorkspace(job, &#34;java-issues.txt&#34;, createJavaWarning(SCM_RESOLVER, AFFECTED_LINE)); GitSCM scm &#61; new GitSCM(GitSCM.createRepoList(FORENSICS_API_PLUGIN, null), Collections.singletonList(new BranchSpec(COMMIT)), null, null, Collections.singletonList(new RelativeTargetDirectory(&#34;forensics-api&#34;))); job.setScm(scm); job.getPublishersList().add(new RepositoryMinerStep()); enableGenericWarnings(job, new Java());</code></pre>

Check warning on line 222 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/GitForensicsITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>void shouldObtainBlamesAndForensicsInFreestyleJob() throws IOException { FreeStyleProject job &#61; createFreeStyleProject(); createFileInWorkspace(job, &#34;java-issues.txt&#34;, createJavaWarning(SCM_RESOLVER, AFFECTED_LINE)); GitSCM scm &#61; new GitSCM(GitSCM.createRepoList(FORENSICS_API_PLUGIN, null), Collections.singletonList(new BranchSpec(COMMIT)), null, null, Collections.singletonList(new RelativeTargetDirectory(&#34;forensics-api&#34;))); job.setScm(scm); job.getPublishersList().add(new RepositoryMinerStep()); enableGenericWarnings(job, new Java());</code></pre>

Check warning on line 186 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ReferenceFinderITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>void shouldCreateSuccessResultWithIgnoredUnstableInBetween() { // #1 SUCCESS FreeStyleProject project &#61; createEmptyReferenceJob(); enableWarnings(project, recorder -&gt; recorder.setQualityGates(List.of( new WarningsQualityGate(3, QualityGateType.NEW, QualityGateCriticality.UNSTABLE)))); Run&lt;?, ?&gt; expectedReference &#61; scheduleBuildAndAssertStatus(project, Result.SUCCESS, analysisResult -&gt; assertThat(analysisResult) .hasTotalSize(2) .hasNewSize(0) .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner(); // #2 UNSTABLE cleanAndCopy(project, &#34;eclipse8Warnings.txt&#34;);</code></pre>

Check warning on line 225 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ReferenceFinderITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>void shouldCreateSuccessResultWithIgnoredUnstableInBetween() { // #1 SUCCESS FreeStyleProject project &#61; createEmptyReferenceJob(); enableWarnings(project, recorder -&gt; recorder.setQualityGates(List.of( new WarningsQualityGate(3, QualityGateType.NEW, QualityGateCriticality.UNSTABLE)))); Run&lt;?, ?&gt; expectedReference &#61; scheduleBuildAndAssertStatus(project, Result.SUCCESS, analysisResult -&gt; assertThat(analysisResult) .hasTotalSize(2) .hasNewSize(0) .hasQualityGateStatus(QualityGateStatus.PASSED)).getOwner(); // #2 UNSTABLE cleanAndCopy(project, &#34;eclipse8Warnings.txt&#34;);</code></pre>

Check warning on line 659 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ReferenceFinderITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>FreeStyleProject project &#61; createJob(JOB_NAME, &#34;eclipse6Warnings.txt&#34;, Result.UNSTABLE, REFERENCE_JOB_NAME); enableWarnings(project, recorder -&gt; { recorder.setQualityGates(List.of( new WarningsQualityGate(3, QualityGateType.NEW, QualityGateCriticality.UNSTABLE))); recorder.setEnabledForFailure(true); }); scheduleBuildAndAssertStatus(project, Result.UNSTABLE, analysisResult -&gt; assertThat(analysisResult) .hasTotalSize(6) .hasNewSize(4) .hasQualityGateStatus(QualityGateStatus.WARNING) .hasReferenceBuild(Optional.of(expectedReference))); } /** * Checks if the plugin ignores failed builds if the reference finder is configured accordingly. * * &#64;see #shouldCreateUnstableResultWithOverAllMustBeSuccessWithReferenceBuild */ &#64;Test void shouldUseFailedBuildsIfConfigured() {<!-- --></code></pre>

Check warning on line 785 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ReferenceFinderITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>FreeStyleProject project &#61; createJob(JOB_NAME, &#34;eclipse6Warnings.txt&#34;, Result.UNSTABLE, REFERENCE_JOB_NAME); enableWarnings(project, recorder -&gt; { recorder.setQualityGates(List.of( new WarningsQualityGate(3, QualityGateType.NEW, QualityGateCriticality.UNSTABLE))); recorder.setEnabledForFailure(true); }); scheduleBuildAndAssertStatus(project, Result.UNSTABLE, analysisResult -&gt; assertThat(analysisResult) .hasTotalSize(6) .hasNewSize(4) .hasQualityGateStatus(QualityGateStatus.WARNING) .hasReferenceBuild(Optional.of(expectedReference))); } /** * Checks if the plugin ignores failed builds if the reference finder is configured accordingly. * * &#64;see #shouldCreateUnstableResultWithOverAllMustBeSuccessWithReferenceBuild */ &#64;Test void shouldUseFailedBuildsIfConfigured() {<!-- --></code></pre>

Check warning on line 278 in plugin/src/test/java/io/jenkins/plugins/analysis/core/model/AnalysisHistoryTest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>.setTestName(&#34;Job should have analysis result if quality gate has a warning (SUCCESS)&#34;) .build(), new BuildHistoryBuilder().setExpectedResult(FIRST) .setJobResult(Result.FAILURE) .setQualityGateResult(createResult(QualityGateStatus.INACTIVE)) .setTestName(&#34;Job should have analysis result even if quality gate is not active (FAILED)&#34;) .build(), new BuildHistoryBuilder().setExpectedResult(FIRST) .setJobResult(Result.FAILURE) .setQualityGateResult(createResult(QualityGateStatus.PASSED)) .setTestName(&#34;Job should have analysis result even if quality gate has been passed (FAILED)&#34;) .build() ); } /** * Method to provide test element that return a present optional. * * &#64;return list of test data objects */ private static Stream&lt;Arguments&gt; createTestDataForSuccessfulQualityGateAndIgnoredBuildResult() {<!-- --></code></pre>

Check warning on line 329 in plugin/src/test/java/io/jenkins/plugins/analysis/core/model/AnalysisHistoryTest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>.setTestName(&#34;Job should have analysis result if quality gate has a warning (SUCCESS)&#34;) .build(), new BuildHistoryBuilder().setExpectedResult(FIRST) .setJobResult(Result.FAILURE) .setQualityGateResult(createResult(QualityGateStatus.INACTIVE)) .setTestName(&#34;Job should have analysis result even if quality gate is not active (FAILED)&#34;) .build(), new BuildHistoryBuilder().setExpectedResult(FIRST) .setJobResult(Result.FAILURE) .setQualityGateResult(createResult(QualityGateStatus.PASSED)) .setTestName(&#34;Job should have analysis result even if quality gate has been passed (FAILED)&#34;) .build() ); } /** * Method to provide test element that return a present optional. * * &#64;return list of test data objects */ private static Stream&lt;Arguments&gt; createTestDataForSuccessfulQualityGateAndIgnoredBuildResult() {<!-- --></code></pre>

Check warning on line 741 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ReferenceFinderITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>FreeStyleProject project &#61; createJob(JOB_NAME, &#34;eclipse6Warnings.txt&#34;, Result.UNSTABLE, REFERENCE_JOB_NAME); enableWarnings(project, recorder -&gt; { recorder.setQualityGates(List.of( new WarningsQualityGate(3, QualityGateType.NEW, QualityGateCriticality.UNSTABLE))); recorder.setEnabledForFailure(true); }); scheduleBuildAndAssertStatus(project, Result.SUCCESS, analysisResult -&gt; assertThat(analysisResult).hasTotalSize(6) .hasNewSize(2) .hasQualityGateStatus(QualityGateStatus.PASSED) .hasReferenceBuild(Optional.of(expectedReference))); } /** * Checks if the reference only looks at the eclipse result of a build and not the overall success. Should return an * unstable result. Uses a different freestyle project for the reference. */ &#64;Test</code></pre>

Check warning on line 826 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ReferenceFinderITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>FreeStyleProject project &#61; createJob(JOB_NAME, &#34;eclipse6Warnings.txt&#34;, Result.UNSTABLE, REFERENCE_JOB_NAME); enableWarnings(project, recorder -&gt; { recorder.setQualityGates(List.of( new WarningsQualityGate(3, QualityGateType.NEW, QualityGateCriticality.UNSTABLE))); recorder.setEnabledForFailure(true); }); scheduleBuildAndAssertStatus(project, Result.SUCCESS, analysisResult -&gt; assertThat(analysisResult).hasTotalSize(6) .hasNewSize(2) .hasQualityGateStatus(QualityGateStatus.PASSED) .hasReferenceBuild(Optional.of(expectedReference))); } /** * Checks if the reference only looks at the eclipse result of a build and not the overall success. Should return an * unstable result. Uses a different freestyle project for the reference. */ &#64;Test</code></pre>

Check warning on line 233 in plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/PublishIssuesStep.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

HIGH:
Found duplicated code.
Raw output
<pre><code>public void setSkipPublishingChecks(final boolean skipPublishingChecks) { this.skipPublishingChecks &#61; skipPublishingChecks; } /** * Sets the scope of the annotations that should be published to SCM checks. * * &#64;param checksAnnotationScope * the scope to use */ &#64;DataBoundSetter public void setChecksAnnotationScope(final ChecksAnnotationScope checksAnnotationScope) { this.checksAnnotationScope &#61; checksAnnotationScope; } public ChecksAnnotationScope getChecksAnnotationScope() { return checksAnnotationScope; } /** * Returns whether all issues should be published using the Checks API. If set to {&#64;code false} only new issues will * be published. * * &#64;return {&#64;code true} if all issues should be published, {&#64;code false} if only new issues should be published * &#64;deprecated use {&#64;link #getChecksAnnotationScope()} instead */ &#64;Deprecated public boolean isPublishAllIssues() { return getChecksAnnotationScope() &#61;&#61; ChecksAnnotationScope.ALL; } /** * Returns whether all issues should be published to SCM checks. * * &#64;param publishAllIssues if {&#64;code true} then all issues should be published, otherwise only new issues * &#64;deprecated use {&#64;link #setChecksAnnotationScope(ChecksAnnotationScope)} instead */ &#64;Deprecated &#64;DataBoundSetter public void setPublishAllIssues(final boolean publishAllIssues) { checksAnnotationScope &#61; publishAllIssues ? ChecksAnnotationScope.ALL : ChecksAnnotationScope.NEW; } /** * If {&#64;code true}, then the result of the quality gate is ignored when selecting a reference build. This option is * disabled by default, so a failing quality gate will be passed from build to build until the original reason for * the failure has been resolved. * * &#64;param ignoreQualityGate * if {&#64;code true} then the result of the quality gate is ignored, otherwise only build with a successful * quality gate are selected */ &#64;DataBoundSetter</code></pre>

Check warning on line 468 in plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/RecordIssuesStep.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

HIGH:
Found duplicated code.
Raw output
<pre><code>public void setSkipPublishingChecks(final boolean skipPublishingChecks) { this.skipPublishingChecks &#61; skipPublishingChecks; } /** * Sets the scope of the annotations that should be published to SCM checks. * * &#64;param checksAnnotationScope * the scope to use */ &#64;DataBoundSetter public void setChecksAnnotationScope(final ChecksAnnotationScope checksAnnotationScope) { this.checksAnnotationScope &#61; checksAnnotationScope; } public ChecksAnnotationScope getChecksAnnotationScope() { return checksAnnotationScope; } /** * Returns whether all issues should be published using the Checks API. If set to {&#64;code false} only new issues will * be published. * * &#64;return {&#64;code true} if all issues should be published, {&#64;code false} if only new issues should be published * &#64;deprecated use {&#64;link #getChecksAnnotationScope()} instead */ &#64;Deprecated public boolean isPublishAllIssues() { return getChecksAnnotationScope() &#61;&#61; ChecksAnnotationScope.ALL; } /** * Returns whether all issues should be published to SCM checks. * * &#64;param publishAllIssues if {&#64;code true} then all issues should be published, otherwise only new issues * &#64;deprecated use {&#64;link #setChecksAnnotationScope(ChecksAnnotationScope)} instead */ &#64;Deprecated &#64;DataBoundSetter public void setPublishAllIssues(final boolean publishAllIssues) { checksAnnotationScope &#61; publishAllIssues ? ChecksAnnotationScope.ALL : ChecksAnnotationScope.NEW; } /** * If {&#64;code true}, then the result of the quality gate is ignored when selecting a reference build. This option is * disabled by default, so a failing quality gate will be passed from build to build until the original reason for * the failure has been resolved. * * &#64;param ignoreQualityGate * if {&#64;code true} then the result of the quality gate is ignored, otherwise only build with a successful * quality gate are selected */ &#64;DataBoundSetter</code></pre>

Check warning on line 376 in plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/RecordIssuesStep.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

NORMAL:
Found duplicated code.
Raw output
<pre><code>return new ArrayList&lt;&gt;(sourceDirectories); } /** * Defines the retention strategy for source code files. * * &#64;param sourceCodeRetention * the retention strategy for source code files */ &#64;DataBoundSetter public void setSourceCodeRetention(final SourceCodeRetention sourceCodeRetention) { this.sourceCodeRetention &#61; sourceCodeRetention; } public SourceCodeRetention getSourceCodeRetention() { return sourceCodeRetention; } /** * Returns whether the results for each configured static analysis result should be aggregated into a single result * or if every tool should get an individual result. * * &#64;return {&#64;code true} if the results of each static analysis tool should be aggregated into a single result, * {&#64;code false} if every tool should get an individual result. */ &#64;SuppressWarnings(&#34;PMD.BooleanGetMethodName&#34;) public boolean getAggregatingResults() { return isAggregatingResults; } &#64;DataBoundSetter public void setAggregatingResults(final boolean aggregatingResults) { isAggregatingResults &#61; aggregatingResults; } /** * Returns whether report logging should be enabled. * * &#64;return {&#64;code true} report logging is disabled * {&#64;code false} report logging is enabled */ public boolean isQuiet() { return quiet; } &#64;DataBoundSetter public void setQuiet(final boolean quiet) { this.quiet &#61; quiet; }</code></pre>

Check warning on line 149 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/GitForensicsITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>assertThat(result).hasTotalSize(1).hasNewSize(0).hasFixedSize(0); assertThat(result.getBlames().contains(SCM_RESOLVER)).isTrue(); FileBlame blame &#61; result.getBlames().getBlame(SCM_RESOLVER); assertThat(blame.getFileName()).isEqualTo(SCM_RESOLVER); assertThat(blame.getEmail(AFFECTED_LINE)).isEqualTo(&#34;ullrich.hafner&#64;gmail.com&#34;); assertThat(blame.getCommit(AFFECTED_LINE)).isEqualTo(&#34;43dde5d4f7a06122216494a896c51830ed684572&#34;); assertThat(getConsoleLog(result)).contains(</code></pre>

Check warning on line 171 in plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/GitForensicsITest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>assertThat(result).hasTotalSize(1).hasNewSize(0).hasFixedSize(0); assertThat(result.getBlames().contains(SCM_RESOLVER)).isTrue(); FileBlame blame &#61; result.getBlames().getBlame(SCM_RESOLVER); assertThat(blame.getFileName()).isEqualTo(SCM_RESOLVER); assertThat(blame.getEmail(AFFECTED_LINE)).isEqualTo(&#34;ullrich.hafner&#64;gmail.com&#34;); assertThat(blame.getCommit(AFFECTED_LINE)).isEqualTo(&#34;43dde5d4f7a06122216494a896c51830ed684572&#34;); assertThat(getConsoleLog(result)).contains(</code></pre>

Check warning on line 213 in plugin/src/test/java/io/jenkins/plugins/analysis/core/model/AnalysisHistoryTest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>.setTestName(&#34;Job should have no analysis result if quality gate has a warning (SUCCESS)&#34;) .build(), new BuildHistoryBuilder().setExpectedResult(NONE) .setJobResult(Result.FAILURE) .setQualityGateResult(createResult(QualityGateStatus.INACTIVE)) .setTestName(&#34;Job should have no analysis result even if quality gate is not active (FAILED)&#34;) .build(), new BuildHistoryBuilder().setExpectedResult(NONE) .setJobResult(Result.FAILURE) .setQualityGateResult(createResult(QualityGateStatus.PASSED)) .setTestName(&#34;Job should have no analysis result even if quality gate has been passed (FAILED)&#34;) .build() ); }</code></pre>

Check warning on line 374 in plugin/src/test/java/io/jenkins/plugins/analysis/core/model/AnalysisHistoryTest.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>.setTestName(&#34;Job should have no analysis result if quality gate has a warning (SUCCESS)&#34;) .build(), new BuildHistoryBuilder().setExpectedResult(NONE) .setJobResult(Result.FAILURE) .setQualityGateResult(createResult(QualityGateStatus.INACTIVE)) .setTestName(&#34;Job should have no analysis result even if quality gate is not active (FAILED)&#34;) .build(), new BuildHistoryBuilder().setExpectedResult(NONE) .setJobResult(Result.FAILURE) .setQualityGateResult(createResult(QualityGateStatus.PASSED)) .setTestName(&#34;Job should have no analysis result even if quality gate has been passed (FAILED)&#34;) .build() ); }</code></pre>

Check warning on line 130 in plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/AnalysisStepDescriptor.java

See this annotation in the file changed.

@ci-jenkins-io ci-jenkins-io / CPD

CPD

NORMAL:
Found duplicated code.
Raw output
<pre><code>return VALIDATION_UTILITIES.validateCharset(sourceCodeEncoding); } /** * Returns a model with all {&#64;link SourceCodeRetention} strategies. * * &#64;return a model with all {&#64;link SourceCodeRetention} strategies. */ &#64;POST &#64;SuppressWarnings(&#34;unused&#34;) // used by Stapler view data binding public ListBoxModel doFillSourceCodeRetentionItems() { if (JENKINS.hasPermission(Jenkins.READ)) { return SourceCodeRetention.fillItems(); } return new ListBoxModel(); } /** * Returns a model with all available severity filters. * * &#64;return a model with all available severity filters */ &#64;POST public ListBoxModel doFillMinimumSeverityItems() { if (JENKINS.hasPermission(Jenkins.READ)) { return model.getAllSeverityFilters(); } return new ListBoxModel(); } /** * Performs on-the-fly validation of the health report thresholds. * * &#64;param project * the project that is configured * &#64;param healthy * the healthy threshold * &#64;param unhealthy * the unhealthy threshold * * &#64;return the validation result */ &#64;POST public FormValidation doCheckHealthy(&#64;AncestorInPath final BuildableItem project,</code></pre>