Skip to content

Conversation

@singghh
Copy link

@singghh singghh commented Mar 25, 2025

Description

This pull request addresses the following:

  • Fixed Checkstyle errors related to parameter finalization and line length.
  • Declared DockerTemplateLabelAssignmentAction as final to meet Checkstyle requirements.

Changes

  • Parameters like wi, li, and item have been marked as final.
  • Lines longer than 80 characters have been refactored for better readability.
  • The class DockerTemplateLabelAssignmentAction has been made final.

How to Test

Run the Checkstyle tool to verify that all errors have been fixed.

Checklist

  • I have tested these changes locally.
  • These changes solve the reported Checkstyle errors.
  • No additional issues or side effects were introduced.

@singghh singghh requested a review from a team as a code owner March 25, 2025 19:23
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Please provide a detailed description of how you tested these changes interactively. The pull request template specifically notes that you need to describe the tests that validate the changes are working. Running mvn checkstyle:checkstyle is not enough.

Fixed Checkstyle errors related to parameter finalization and line length.

Please don't attempt to fix checkstyle complaints about line length. The spotless formatter handles line length automatically.

I'm not yet persuaded that adding checkstyle and resolving its complaints add enough value to the plugin. The automated code formatting from spotless already provides much of the value

Comment on lines +195 to +206
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.2.0</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed, since it is already provided by the parent pom.

Suggested change
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.2.0</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

Comment on lines +207 to +212
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>3.37</version> <!-- Ensure this is the latest stable version -->
<extensions>true</extensions>
</plugin>
Copy link
Contributor

Choose a reason for hiding this comment

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

Already provided by the parent pom.

Suggested change
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>3.37</version> <!-- Ensure this is the latest stable version -->
<extensions>true</extensions>
</plugin>

Comment on lines +213 to +229
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.17.0</version>
<executions>
<execution>
<goals>
<goal>apply</goal>
</goals>
</execution>
</executions>
<configuration>
<java>
<googleJavaFormat />
</java>
</configuration>
</plugin>
Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed. Provided by the parent pom.

Suggested change
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.17.0</version>
<executions>
<execution>
<goals>
<goal>apply</goal>
</goals>
</execution>
</executions>
<configuration>
<java>
<googleJavaFormat />
</java>
</configuration>
</plugin>

if (cloud != null) {
final String uuid = UUID.randomUUID().toString();
final DockerTemplate template = jobTemplate.getTemplate().cloneWithLabel(uuid);
final DockerTemplate template =
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use mvn spotless:apply rather than performing manual formatting of the files. The Jenkins plugin parent pom provides spotless with a configuration that works well for Jenkins plugins. It is enabled in this plugin.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the most recent release of the checkstyle plugin.

Suggested change
<version>3.1.1</version>
<version>3.6.0</version>

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your previous comments and guidance,
I noticed that we don't currently have a checkstyle.xml file in the repository or a clear indication of where it might be referenced. I'm wondering if there is a plan to introduce this file, or if we're using an external/shared configuration that I might have overlooked? I ran mvn spotless:apply successfully, but just wanted to make sure we're not missing any custom style rules that might come with Checkstyle.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if there is a plan to introduce this file, or if we're using an external/shared configuration that I might have overlooked? I ran mvn spotless:apply successfully, but just wanted to make sure we're not missing any custom style rules that might come with Checkstyle.

I'm not planning to introduce checkstyle into this repository. The Jenkins plugins that I maintain do not use checkstyle. I've not found it to be valuable enough to be worth the effort to enable it.

If you're serious about enabling checkstyle in this repository, then you'll need to provide a complete implementation that includes the checkstyle settings to persuade me that it will be useful. The default checkstyle settings conflict with spotless formatting. I value spotless formatting much more than I value checkstyle warnings. If your pull request proposes to accept many new, unresolved checkstyle warnings, then I'll reject it. I'm not willing to add new warnings output because it will be a distraction and will create extra work for me to resolve the warnings.

@MarkEWaite
Copy link
Contributor

MarkEWaite commented Mar 26, 2025

@singghh you should confirm locally that mvn clean verify passes without error before submitting a pull request. If you know that a pull request is not yet ready for review, please submit it as a draft pull request. I've marked this pull request as a draft because it is failing with mvn clean verify.

if you decide to continue with this pull request, I'll rely on you to mark it as "ready for review" when you've completed the changes that allow it to pass mvn clean verify and pass the ci.jenkins.io verification checks.

If you'd like to see a reference implementation of checkstyle checks for a Jenkins plugin, refer to:

@MarkEWaite MarkEWaite marked this pull request as draft March 26, 2025 00:24
@MarkEWaite
Copy link
Contributor

Closing after 6 weeks with no response. Can be reopened if responses are provided in the future.

@MarkEWaite MarkEWaite closed this May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants