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

Require Jenkins 2.479 #346

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.2</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -44,8 +44,9 @@
<changelist>999999-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.452</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<jenkins.baseline>2.479</jenkins.baseline>
<!-- update to the latest LTS once 2.479.1 ships -->
<jenkins.version>${jenkins.baseline}</jenkins.version>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
<spotless.check.skip>false</spotless.check.skip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
*/
package org.jenkinsci.plugins.badge;

import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.Whitelisted;

public class EmbeddableBadgeConfig implements Serializable {
@Serial
private static final long serialVersionUID = 1L;

private final Map<String, String> colors = new HashMap<>() {
@Serial
private static final long serialVersionUID = 1L;

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import hudson.model.BuildBadgeAction;
import hudson.model.Job;
import hudson.model.Run;
import java.io.Serial;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -20,7 +21,9 @@
*/
@ExportedBean(defaultVisibility = 2)
public class EmbeddableBadgeConfigsAction implements Action, Serializable, BuildBadgeAction {
@Serial
private static final long serialVersionUID = 1L;

private Map<String, EmbeddableBadgeConfig> badgeConfigs = new HashMap<>();

public EmbeddableBadgeConfigsAction() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

@Override
public String resolve(Actionable actionable, String parameter) {
if (actionable instanceof Run) {
Run<?, ?> run = (Run<?, ?>) actionable;
if (actionable instanceof Run<?, ?> run) {

ParametersAction params = run.getAction(ParametersAction.class);
if (params != null) {
Expand Down Expand Up @@ -68,8 +67,8 @@
}
}
}
} else if (actionable instanceof Job<?, ?>) {
parameter = resolve(((Job<?, ?>) actionable).getLastBuild(), parameter);
} else if (actionable instanceof Job<?, ?> job) {

Check warning on line 70 in src/main/java/org/jenkinsci/plugins/badge/extensions/BuildParameterResolverExtension.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 70 is only partially covered, one branch is missing
parameter = resolve(job.getLastBuild(), parameter);

Check warning on line 71 in src/main/java/org/jenkinsci/plugins/badge/extensions/BuildParameterResolverExtension.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 71 is not covered by tests
}
return parameter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
@Override
public String resolve(Actionable actionable, String parameter) {
if (parameter != null) {
if (actionable instanceof Run<?, ?>) {
Run<?, ?> run = (Run<?, ?>) actionable;
if (actionable instanceof Run<?, ?> run) {

Check warning on line 20 in src/main/java/org/jenkinsci/plugins/badge/extensions/SpecialValueParameterResolverExtension.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 20 is only partially covered, one branch is missing
/* try to match any custom value:
${buildId}
${buildNumber}
Expand All @@ -36,8 +35,8 @@
.replace("displayName", run.getDisplayName())
.replace("startTime", run.getTimestampString());

} else if (actionable instanceof Job<?, ?>) {
parameter = resolve(((Job<?, ?>) actionable).getLastBuild(), parameter);
} else if (actionable instanceof Job<?, ?> job) {
parameter = resolve(job.getLastBuild(), parameter);

Check warning on line 39 in src/main/java/org/jenkinsci/plugins/badge/extensions/SpecialValueParameterResolverExtension.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 38-39 are not covered by tests
}
}
return parameter;
Expand Down