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

Improve consistency of hooks #486

Merged
merged 1 commit into from
Mar 8, 2023
Merged

Improve consistency of hooks #486

merged 1 commit into from
Mar 8, 2023

Conversation

basil
Copy link
Member

@basil basil commented Mar 6, 2023

Makes these hooks more consistent with each other.

@basil basil added the internal label Mar 6, 2023
@basil basil requested a review from a team as a code owner March 6, 2023 21:19
@@ -49,8 +48,7 @@ public boolean check(@NonNull BeforeExecutionContext context) {
}

@Override
public void action(@NonNull BeforeExecutionContext context)
throws PluginCompatibilityTesterException {
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing an unnecessary throws statement.

Comment on lines +21 to +23
return "org.jenkins-ci.plugins".equals(model.getGroupId())
&& "jacoco".equals(model.getArtifactId())
&& "hpi".equals(model.getPackaging());
Copy link
Member Author

Choose a reason for hiding this comment

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

Elsewhere we check group ID, artifact ID, and packaging, so do so here as well.

Copy link
Member

Choose a reason for hiding this comment

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

elsewhere we are going the wrong way - we should just check the pluginID as we are in the business of checking plugins not artifacts, but 🤷
aka context.getPlugin().name.equals("jacoco");

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess we just have different philosophies. I prefer to be as paranoid as possible, possibly from my days doing kernel development.

Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +28 to +31
return "io.jenkins.plugins".equals(model.getGroupId())
&& ARTIFACT_IDS.contains(model.getArtifactId())
&& "hpi".equals(model.getPackaging());
Copy link
Member Author

Choose a reason for hiding this comment

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

Elsewhere we check group ID, artifact ID, and packaging, so do so here as well.

Comment on lines +19 to +22
return "io.jenkins.plugins".equals(model.getGroupId())
&& ARTIFACT_IDS.contains(model.getArtifactId())
&& "hpi".equals(model.getPackaging());
Copy link
Member Author

Choose a reason for hiding this comment

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

Elsewhere we check group ID, artifact ID, and packaging, so do so here as well.

&& "hpi".equals(model.getPackaging());
}
return false;
VersionNumber pluginVersion = new VersionNumber(context.getPlugin().version);
Copy link
Member Author

Choose a reason for hiding this comment

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

This null check was redundant: we always set the plugin and version.

@basil basil requested a review from jtnord March 6, 2023 21:20
Comment on lines +21 to +23
return "org.jenkins-ci.plugins".equals(model.getGroupId())
&& "jacoco".equals(model.getArtifactId())
&& "hpi".equals(model.getPackaging());
Copy link
Member

Choose a reason for hiding this comment

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

elsewhere we are going the wrong way - we should just check the pluginID as we are in the business of checking plugins not artifacts, but 🤷
aka context.getPlugin().name.equals("jacoco");

@basil basil merged commit ed585f6 into master Mar 8, 2023
@basil basil deleted the consistency branch March 8, 2023 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants