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

Simplify status checks output for "error" and "unstable" steps #125

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Omit step name and arguments if trivial

8ba8c0d
Select commit
Loading
Failed to load commit list.
Draft

Simplify status checks output for "error" and "unstable" steps #125

Omit step name and arguments if trivial
8ba8c0d
Select commit
Loading
Failed to load commit list.
ci.jenkins.io / CPD succeeded Jul 30, 2024 in 0s

24 new issues

Total New Outstanding Fixed Trend
24 24 0 0 👎

Reference build: Plugins » checks-api-plugin » master #255

Details

Severity distribution of new issues

Error Warning High Warning Normal Warning Low
0 0 0 24

Annotations

Check warning on line 75 in src/test/java/io/jenkins/plugins/checks/steps/WithChecksStepITest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>job.setDefinition(asStage(&#34;withChecks(&#39;test injection&#39;) { publishChecks() }&#34;)); buildSuccessfully(job); assertThat(PUBLISHER_FACTORY.getPublishedChecks().size()).isEqualTo(2); ChecksDetails autoChecks &#61; PUBLISHER_FACTORY.getPublishedChecks().get(0); ChecksDetails manualChecks &#61; PUBLISHER_FACTORY.getPublishedChecks().get(1); assertThat(autoChecks.getName()).isPresent().get().isEqualTo(&#34;test injection&#34;); assertThat(autoChecks.getStatus()).isEqualTo(ChecksStatus.IN_PROGRESS); assertThat(autoChecks.getConclusion()).isEqualTo(ChecksConclusion.NONE); assertThat(manualChecks.getName()).isPresent().get().isEqualTo(&#34;test injection&#34;);</code></pre>

Check warning on line 98 in src/test/java/io/jenkins/plugins/checks/steps/WithChecksStepITest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>job.setDefinition(asStage(&#34;withChecks(&#39;test injection&#39;) { publishChecks() }&#34;)); buildSuccessfully(job); assertThat(PUBLISHER_FACTORY.getPublishedChecks().size()).isEqualTo(2); ChecksDetails autoChecks &#61; PUBLISHER_FACTORY.getPublishedChecks().get(0); ChecksDetails manualChecks &#61; PUBLISHER_FACTORY.getPublishedChecks().get(1); assertThat(autoChecks.getName()).isPresent().get().isEqualTo(&#34;test injection&#34;); assertThat(autoChecks.getStatus()).isEqualTo(ChecksStatus.IN_PROGRESS); assertThat(autoChecks.getConclusion()).isEqualTo(ChecksConclusion.NONE); assertThat(manualChecks.getName()).isPresent().get().isEqualTo(&#34;test injection&#34;);</code></pre>

Check warning on line 31 in src/test/java/io/jenkins/plugins/checks/api/ChecksOutputTest.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 shouldBuildCorrectlyWithAllFields() { final List&lt;ChecksAnnotation&gt; annotations &#61; createAnnotations(); final List&lt;ChecksImage&gt; images &#61; createImages(); final ChecksOutput checksOutput &#61; new ChecksOutputBuilder() .withTitle(TITLE) .withSummary(SUMMARY) .withText(TEXT) .withAnnotations(annotations.subList(0, 1)) .addAnnotation(annotations.get(1)) .withImages(images.subList(0, 1)) .addImage(images.get(1)) .build();</code></pre>

Check warning on line 85 in src/test/java/io/jenkins/plugins/checks/api/ChecksOutputTest.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 shouldBuildCorrectlyWithAllFields() { final List&lt;ChecksAnnotation&gt; annotations &#61; createAnnotations(); final List&lt;ChecksImage&gt; images &#61; createImages(); final ChecksOutput checksOutput &#61; new ChecksOutputBuilder() .withTitle(TITLE) .withSummary(SUMMARY) .withText(TEXT) .withAnnotations(annotations.subList(0, 1)) .addAnnotation(annotations.get(1)) .withImages(images.subList(0, 1)) .addImage(images.get(1)) .build();</code></pre>

Check warning on line 42 in src/test/java/io/jenkins/plugins/checks/api/ChecksAnnotationTest.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(annotation) .hasPath(Optional.of(PATH)) .hasStartLine(Optional.of(20)).hasEndLine(Optional.of(20)) .hasAnnotationLevel(ChecksAnnotationLevel.NOTICE) .hasMessage(Optional.of(MESSAGE)) .hasStartColumn(Optional.of(33)).hasEndColumn(Optional.of(38)) .hasTitle(Optional.of(TITLE)) .hasRawDetails(Optional.of(RAW_DETAILS));</code></pre>

Check warning on line 84 in src/test/java/io/jenkins/plugins/checks/api/ChecksAnnotationTest.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(annotation) .hasPath(Optional.of(PATH)) .hasStartLine(Optional.of(20)).hasEndLine(Optional.of(20)) .hasAnnotationLevel(ChecksAnnotationLevel.NOTICE) .hasMessage(Optional.of(MESSAGE)) .hasStartColumn(Optional.of(33)).hasEndColumn(Optional.of(38)) .hasTitle(Optional.of(TITLE)) .hasRawDetails(Optional.of(RAW_DETAILS));</code></pre>

Check warning on line 201 in src/test/java/io/jenkins/plugins/checks/status/BuildStatusChecksPublisherITest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>details &#61; checksDetails.get(8); assertThat(details.getStatus()).isEqualTo(ChecksStatus.COMPLETED); assertThat(details.getConclusion()).isEqualTo(ChecksConclusion.FAILURE); assertThat(details.getOutput()).isPresent().get().satisfies(output -&gt; { assertThat(output.getTitle()).isPresent().get().isEqualTo(&#34;Fails: a fatal error occurs&#34;);</code></pre>

Check warning on line 264 in src/test/java/io/jenkins/plugins/checks/status/BuildStatusChecksPublisherITest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>details &#61; checksDetails.get(8); assertThat(details.getStatus()).isEqualTo(ChecksStatus.COMPLETED); assertThat(details.getConclusion()).isEqualTo(ChecksConclusion.FAILURE); assertThat(details.getOutput()).isPresent().get().satisfies(output -&gt; { assertThat(output.getTitle()).isPresent().get().isEqualTo(&#34;Fails: a fatal error occurs&#34;);</code></pre>

Check warning on line 103 in src/test/java/io/jenkins/plugins/checks/api/TruncatedStringTest.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(build(10)).isEqualTo(&#34;&#34;); assertThat(buildRawString()).isEqualTo(&#34;&#34;); builder.addText(&#34;xxxxxxxxxxxxxx\n&#34;); // 15 assertThat(build(10)).isEqualTo(&#34;Truncated&#34;); assertThatThrownBy(() -&gt; { build(5); }).isInstanceOf(IllegalArgumentException.class) .hasMessage(&#34;Maximum length is less than truncation text.&#34;); } &#64;Test public void shouldHandleReversedChunking() {<!-- --></code></pre>

Check warning on line 129 in src/test/java/io/jenkins/plugins/checks/api/TruncatedStringTest.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(build(10)).isEqualTo(&#34;&#34;); assertThat(buildRawString()).isEqualTo(&#34;&#34;); builder.addText(&#34;xxxxxxxxxxxxxx\n&#34;); // 15 assertThat(build(10)).isEqualTo(&#34;Truncated&#34;); assertThatThrownBy(() -&gt; { build(5); }).isInstanceOf(IllegalArgumentException.class) .hasMessage(&#34;Maximum length is less than truncation text.&#34;); } &#64;Test public void shouldHandleReversedChunking() {<!-- --></code></pre>

Check warning on line 60 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>ChecksConclusion.NONE); StepExecution execution &#61; step.start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(&#34;Jenkins&#34;) .withStatus(ChecksStatus.IN_PROGRESS) .withConclusion(ChecksConclusion.NONE)</code></pre>

Check warning on line 127 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>ChecksConclusion.NONE); StepExecution execution &#61; step.start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(&#34;Jenkins&#34;) .withStatus(ChecksStatus.IN_PROGRESS) .withConclusion(ChecksConclusion.NONE)</code></pre>

Check warning on line 59 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>PublishChecksStep step &#61; createPublishChecksStep(&#34;an in progress build&#34;, ChecksStatus.IN_PROGRESS, ChecksConclusion.NONE); StepExecution execution &#61; step.start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(&#34;Jenkins&#34;) .withStatus(ChecksStatus.IN_PROGRESS)</code></pre>

Check warning on line 81 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>PublishChecksStep step &#61; createPublishChecksStep(&#34;an in progress build&#34;, ChecksStatus.IN_PROGRESS, ChecksConclusion.NONE); StepExecution execution &#61; step.start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(&#34;Jenkins&#34;) .withStatus(ChecksStatus.IN_PROGRESS)</code></pre>

Check warning on line 81 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>ChecksConclusion.NONE); StepExecution execution &#61; step.start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(&#34;Jenkins&#34;) .withStatus(ChecksStatus.QUEUED)</code></pre>

Check warning on line 126 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>ChecksConclusion.NONE); StepExecution execution &#61; step.start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(&#34;Jenkins&#34;) .withStatus(ChecksStatus.QUEUED)</code></pre>

Check warning on line 33 in src/test/java/io/jenkins/plugins/checks/api/ChecksAnnotationTest.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 shouldBuildCorrectlyWithAllFields() { final ChecksAnnotation annotation &#61; new ChecksAnnotationBuilder() .withPath(PATH) .withStartLine(20).withEndLine(20) .withAnnotationLevel(ChecksAnnotationLevel.NOTICE) .withMessage(MESSAGE) .withStartColumn(33).withEndColumn(38) .withTitle(TITLE) .withRawDetails(RAW_DETAILS) .build();</code></pre>

Check warning on line 74 in src/test/java/io/jenkins/plugins/checks/api/ChecksAnnotationTest.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 shouldBuildCorrectlyWithAllFields() { final ChecksAnnotation annotation &#61; new ChecksAnnotationBuilder() .withPath(PATH) .withStartLine(20).withEndLine(20) .withAnnotationLevel(ChecksAnnotationLevel.NOTICE) .withMessage(MESSAGE) .withStartColumn(33).withEndColumn(38) .withTitle(TITLE) .withRawDetails(RAW_DETAILS) .build();</code></pre>

Check warning on line 181 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>private StepContext createStepContext() throws IOException, InterruptedException { StepContext context &#61; mock(StepContext.class); when(context.get(Run.class)).thenReturn(mock(Run.class)); when(context.get(TaskListener.class)).thenReturn(TaskListener.NULL);</code></pre>

Check warning on line 19 in src/test/java/io/jenkins/plugins/checks/steps/WithChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>private StepContext createStepContext() throws IOException, InterruptedException { StepContext context &#61; mock(StepContext.class); when(context.get(Run.class)).thenReturn(mock(Run.class)); when(context.get(TaskListener.class)).thenReturn(TaskListener.NULL);</code></pre>

Check warning on line 35 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>StepExecution execution &#61; new PublishChecksStep().start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(StringUtils.EMPTY)</code></pre>

Check warning on line 58 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>StepExecution execution &#61; new PublishChecksStep().start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(StringUtils.EMPTY)</code></pre>

Check warning on line 80 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>StepExecution execution &#61; new PublishChecksStep().start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(StringUtils.EMPTY)</code></pre>

Check warning on line 125 in src/test/java/io/jenkins/plugins/checks/steps/PublishChecksStepTest.java

See this annotation in the file changed.

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

CPD

LOW:
Found duplicated code.
Raw output
<pre><code>StepExecution execution &#61; new PublishChecksStep().start(createStepContext()); assertThat(execution).isInstanceOf(PublishChecksStep.PublishChecksStepExecution.class); assertThat(((PublishChecksStep.PublishChecksStepExecution)execution).extractChecksDetails()) .usingRecursiveComparison() .isEqualTo(new ChecksDetails.ChecksDetailsBuilder() .withName(StringUtils.EMPTY)</code></pre>