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

Bump analysis-pom from 4.7.0 to 5.0.0 #89

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
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-pom</artifactId>
<version>4.7.0</version>
<version>5.0.0</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -116,6 +116,7 @@
<artifactId>revapi-maven-plugin</artifactId>
<configuration>
<versionFormat>\d+\.\d+\.\d+</versionFormat>
<checkDependencies>false</checkDependencies>
<analysisConfiguration>
<revapi.ignore combine.children="append">
<item>
Expand All @@ -124,6 +125,11 @@
<serialVersionUID>1</serialVersionUID>
<justification>Adding actions list with an initial empty value should not break the compatibility.</justification>
</item>
<item>
<regex>true</regex>
<code>java.missing.*</code>
<justification>Dependencies are not being checked, so they are reported as missing</justification>
</item>
</revapi.ignore>
</analysisConfiguration>
</configuration>
Expand Down
36 changes: 27 additions & 9 deletions src/main/java/io/jenkins/plugins/checks/api/ChecksAnnotation.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.jenkins.plugins.checks.api;

import edu.umd.cs.findbugs.annotations.CheckForNull;

import java.util.Optional;

import static java.util.Objects.*;
Expand All @@ -9,24 +11,31 @@
*/
@SuppressWarnings("PMD.DataClass")
public class ChecksAnnotation {
@CheckForNull
private final String path;
@CheckForNull
private final Integer startLine;
@CheckForNull
private final Integer endLine;
private final ChecksAnnotationLevel annotationLevel;
@CheckForNull
private final String message;
@CheckForNull
private final Integer startColumn;
@CheckForNull
private final Integer endColumn;
@CheckForNull
private final String title;
@CheckForNull
private final String rawDetails;

private final ChecksAnnotationLevel annotationLevel;

@SuppressWarnings("ParameterNumber")
private ChecksAnnotation(final String path,
final Integer startLine, final Integer endLine,
final ChecksAnnotationLevel annotationLevel,
final String message,
final Integer startColumn, final Integer endColumn,
final String title,
final String rawDetails) {
private ChecksAnnotation(@CheckForNull final String path,
@CheckForNull final Integer startLine, @CheckForNull final Integer endLine,
final ChecksAnnotationLevel annotationLevel, @CheckForNull final String message,
@CheckForNull final Integer startColumn, @CheckForNull final Integer endColumn,
@CheckForNull final String title, @CheckForNull final String rawDetails) {
this.path = path;
this.startLine = startLine;
this.endLine = endLine;
Expand Down Expand Up @@ -116,16 +125,25 @@ public String toString() {
* Builder for {@link ChecksAnnotation}.
*/
public static class ChecksAnnotationBuilder {
@CheckForNull
private String path;
@CheckForNull
private Integer startLine;
@CheckForNull
private Integer endLine;
private ChecksAnnotationLevel annotationLevel;
@CheckForNull
private String message;
@CheckForNull
private Integer startColumn;
@CheckForNull
private Integer endColumn;
@CheckForNull
private String title;
@CheckForNull
private String rawDetails;

private ChecksAnnotationLevel annotationLevel;

/**
* Constructs a builder for {@link ChecksAnnotation}.
*/
Expand Down
30 changes: 23 additions & 7 deletions src/main/java/io/jenkins/plugins/checks/api/ChecksDetails.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.jenkins.plugins.checks.api;

import edu.umd.cs.findbugs.annotations.CheckForNull;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -13,19 +15,26 @@
*/
@SuppressWarnings("PMD.DataClass")
public class ChecksDetails {
@CheckForNull
private final String name;
private final ChecksStatus status;
@CheckForNull
private final String detailsURL;
@CheckForNull
private final LocalDateTime startedAt;
private final ChecksConclusion conclusion;
@CheckForNull
private final LocalDateTime completedAt;
@CheckForNull
private final ChecksOutput output;

private final ChecksStatus status;
private final ChecksConclusion conclusion;
private final List<ChecksAction> actions;

@SuppressWarnings("ParameterNumber")
private ChecksDetails(final String name, final ChecksStatus status, final String detailsURL,
final LocalDateTime startedAt, final ChecksConclusion conclusion, final LocalDateTime completedAt,
final ChecksOutput output, final List<ChecksAction> actions) {
private ChecksDetails(@CheckForNull final String name, final ChecksStatus status,
@CheckForNull final String detailsURL, @CheckForNull final LocalDateTime startedAt,
final ChecksConclusion conclusion, @CheckForNull final LocalDateTime completedAt,
@CheckForNull final ChecksOutput output, final List<ChecksAction> actions) {
this.name = name;
this.status = status;
this.detailsURL = detailsURL;
Expand Down Expand Up @@ -126,19 +135,26 @@ public String toString() {
* Builder for {@link ChecksDetails}.
*/
public static class ChecksDetailsBuilder {
@CheckForNull
private String name;
private ChecksStatus status;
@CheckForNull
private String detailsURL;
@CheckForNull
private LocalDateTime startedAt;
private ChecksConclusion conclusion;
@CheckForNull
private LocalDateTime completedAt;
@CheckForNull
private ChecksOutput output;

private ChecksStatus status;
private ChecksConclusion conclusion;
private List<ChecksAction> actions;

/**
* Construct a builder for {@link ChecksDetails}.
*/
public ChecksDetailsBuilder() {
this.status = ChecksStatus.NONE;
this.conclusion = ChecksConclusion.NONE;
this.actions = new ArrayList<>();
}
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/io/jenkins/plugins/checks/api/ChecksOutput.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.jenkins.plugins.checks.api;

import edu.umd.cs.findbugs.annotations.CheckForNull;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand All @@ -12,14 +14,19 @@
* annotations, etc.
*/
public class ChecksOutput {
@CheckForNull
private final String title;
@CheckForNull
private final TruncatedString summary;
@CheckForNull
private final TruncatedString text;

private final List<ChecksAnnotation> annotations;
private final List<ChecksImage> images;

private ChecksOutput(final String title, final TruncatedString summary, final TruncatedString text,
final List<ChecksAnnotation> annotations, final List<ChecksImage> images) {
private ChecksOutput(@CheckForNull final String title, @CheckForNull final TruncatedString summary,
@CheckForNull final TruncatedString text, final List<ChecksAnnotation> annotations,
final List<ChecksImage> images) {
this.title = title;
this.summary = summary;
this.text = text;
Expand Down Expand Up @@ -95,9 +102,13 @@ public String toString() {
* Builder for {@link ChecksOutput}.
*/
public static class ChecksOutputBuilder {
@CheckForNull
private String title;
@CheckForNull
private TruncatedString summary;
@CheckForNull
private TruncatedString text;

private List<ChecksAnnotation> annotations;
private List<ChecksImage> images;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.jenkins.plugins.checks.steps;

import edu.hm.hafner.util.VisibleForTesting;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
Expand Down Expand Up @@ -250,9 +251,13 @@ public static class StepChecksAnnotation extends AbstractDescribableImpl<StepChe
private final int endLine;
private final String message;

@CheckForNull
private Integer startColumn;
@CheckForNull
private Integer endColumn;
@CheckForNull
private String title;
@CheckForNull
private String rawDetails;

private ChecksAnnotation.ChecksAnnotationLevel annotationLevel = ChecksAnnotation.ChecksAnnotationLevel.WARNING;
Expand Down Expand Up @@ -320,18 +325,22 @@ public String getMessage() {
return message;
}

@CheckForNull
public Integer getStartColumn() {
return startColumn;
}

@CheckForNull
public Integer getEndColumn() {
return endColumn;
}

@CheckForNull
public String getTitle() {
return title;
}

@CheckForNull
public String getRawDetails() {
return rawDetails;
}
Expand Down
19 changes: 11 additions & 8 deletions src/main/java/io/jenkins/plugins/checks/steps/WithChecksStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public boolean start() {
ChecksInfo info = extractChecksInfo();
getContext().newBodyInvoker()
.withContext(info)
.withCallback(new WithChecksCallBack(info))
.withCallback(new WithChecksCallBack(info, this))
.start();
return false;
}
Expand All @@ -122,7 +122,8 @@ private boolean publish(final StepContext context, final ChecksDetails.ChecksDet
listener = fixNull(context.get(TaskListener.class), TaskListener.NULL);
}
catch (IOException | InterruptedException e) {
SYSTEM_LOGGER.log(Level.WARNING, "Failed getting TaskListener from the context: " + e);
SYSTEM_LOGGER.log(Level.WARNING,
("Failed getting TaskListener from the context: " + e).replaceAll("\r\n", ""));
}

PluginLogger pluginLogger = new PluginLogger(listener.getLogger(), "Checks API");
Expand All @@ -133,8 +134,8 @@ private boolean publish(final StepContext context, final ChecksDetails.ChecksDet
}
catch (IOException | InterruptedException e) {
String msg = "Failed getting Run from the context on the start of withChecks step: " + e;
pluginLogger.log(msg);
SYSTEM_LOGGER.log(Level.WARNING, msg);
pluginLogger.log(msg.replaceAll("\r\n", ""));
SYSTEM_LOGGER.log(Level.WARNING, msg.replaceAll("\r\n", ""));
context.onFailure(new IllegalStateException(msg));
return false;
}
Expand All @@ -153,20 +154,22 @@ private boolean publish(final StepContext context, final ChecksDetails.ChecksDet
return true;
}

class WithChecksCallBack extends BodyExecutionCallback {
static class WithChecksCallBack extends BodyExecutionCallback {
private static final long serialVersionUID = 1L;

private final ChecksInfo info;
private final WithChecksStepExecution execution;

WithChecksCallBack(final ChecksInfo info) {
WithChecksCallBack(final ChecksInfo info, final WithChecksStepExecution execution) {
super();

this.info = info;
this.execution = execution;
}

@Override
public void onStart(final StepContext context) {
publish(context, new ChecksDetails.ChecksDetailsBuilder()
execution.publish(context, new ChecksDetails.ChecksDetailsBuilder()
.withName(info.getName())
.withStatus(ChecksStatus.IN_PROGRESS)
.withConclusion(ChecksConclusion.NONE));
Expand Down Expand Up @@ -203,7 +206,7 @@ public void onFailure(final StepContext context, final Throwable t) {
.withTitle("Failed")
.withText(t.toString()).build());
}
publish(context, builder);
execution.publish(context, builder);
context.onFailure(t);
}
}
Expand Down