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

added project_id to defined variables #1722

Closed
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
private final ActionType actionType;
private final Integer sourceProjectId;
private final Integer targetProjectId;
private final Integer projectId;
private final String branch;
private final String sourceBranch;
private final String userName;
Expand Down Expand Up @@ -68,6 +69,7 @@
ActionType actionType,
Integer sourceProjectId,
Integer targetProjectId,
Integer projectId,
String branch,
String sourceBranch,
String userName,
Expand Down Expand Up @@ -113,6 +115,7 @@
this.actionType = Objects.requireNonNull(actionType, "actionType must not be null.");
this.sourceProjectId = Objects.requireNonNull(sourceProjectId, "sourceProjectId must not be null.");
this.targetProjectId = Objects.requireNonNull(targetProjectId, "targetProjectId must not be null.");
this.projectId = projectId == null ? 0 : projectId;

Check warning on line 118 in src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 118 is only partially covered, one branch is missing

Check warning on line 118 in src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java

View check run for this annotation

ci.jenkins.io / SpotBugs

BX_UNBOXING_IMMEDIATELY_REBOXED

NORMAL: Boxed value is unboxed and then immediately reboxed in new com.dabsquared.gitlabjenkins.cause.CauseData(CauseData$ActionType, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, String, String, Integer, Integer, Integer, List, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String)
Raw output
<p>A boxed value is unboxed and then immediately reboxed. </p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.projectId = projectId == null ? 0 : projectId;
this.projectId = Objects.requireNonNull(projectId, "projectId must not be null.");

We should not change the original logic for handling the projectId in "src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java"

this.branch = Objects.requireNonNull(branch, "branch must not be null.");
this.sourceBranch = Objects.requireNonNull(sourceBranch, "sourceBranch must not be null.");
this.userName = Objects.requireNonNull(userName, "userName must not be null.");
Expand Down Expand Up @@ -160,6 +163,7 @@
@Exported
public Map<String, String> getBuildVariables() {
MapWrapper<String, String> variables = new MapWrapper<>(new HashMap<String, String>());
variables.put("gitlabProjectId", projectId == null ? "" : projectId.toString());

Check warning on line 166 in src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 166 is only partially covered, one branch is missing
variables.put("gitlabBranch", branch);
variables.put("gitlabSourceBranch", sourceBranch);
variables.put("gitlabActionType", actionType.name());
Expand Down
Loading