Skip to content

fix(spotbugs) Added an exclusion file for SpotBugs.#132

Merged
MarkEWaite merged 4 commits into
jenkinsci:masterfrom
gounthar:4.80
Mar 25, 2024
Merged

fix(spotbugs) Added an exclusion file for SpotBugs.#132
MarkEWaite merged 4 commits into
jenkinsci:masterfrom
gounthar:4.80

Conversation

@gounthar

@gounthar gounthar commented Mar 25, 2024

Copy link
Copy Markdown
Contributor

As #131 was risky (thanks, @MarkEWaite), here is another approach.
We're using an exclusion file.

What has been done

Move to 4.80.
https://github.com/jenkinsci/plugin-pom/releases/tag/plugin-4.77
https://github.com/jenkinsci/plugin-pom/releases/tag/plugin-4.78
https://github.com/jenkinsci/plugin-pom/releases/tag/plugin-4.79
https://github.com/jenkinsci/plugin-pom/releases/tag/plugin-4.80

I changed 3 files ending with CRLF into LF (as SpotBugs was unhappy about that).

[INFO] There are 3 errors reported by Checkstyle 9.3 with /mnt/c/support/users/dev/jenkins/plugins/plot-plugin/checkstyle/checkstyle.xml ruleset.
[ERROR] src/main/java/hudson/plugins/plot/MatrixPlotPublisher.java:[1] (misc) NewlineAtEndOfFile: Expected line ending for file is LF(\n), but CRLF(\r\n) is detected.
[ERROR] src/main/java/hudson/plugins/plot/Plot.java:[1] (misc) NewlineAtEndOfFile: Expected line ending for file is LF(\n), but CRLF(\r\n) is detected.
[ERROR] src/main/java/hudson/plugins/plot/PlotBuilder.java:[1] (misc) NewlineAtEndOfFile: Expected line ending for file is LF(\n), but CRLF(\r\n) is detected.

Added an exclusion file, and referenced it in pom.xml.

[INFO] --- spotbugs:4.8.3.1:check (spotbugs) @ plot ---
[INFO] BugInstance size is 9
[INFO] Error size is 0
[INFO] Total bugs: 9
[ERROR] Medium: Primitive field hudson.plugins.plot.Plot.csvFileName is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.Plot] At Plot.java:[line 344] PA_PUBLIC_PRIMITIVE_ATTRIBUTE
[ERROR] Medium: Primitive field hudson.plugins.plot.Plot.description is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.Plot] At Plot.java:[line 352] PA_PUBLIC_PRIMITIVE_ATTRIBUTE
[ERROR] Medium: Primitive field hudson.plugins.plot.Plot.urlNumBuilds is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.Plot] At Plot.java:[line 516] PA_PUBLIC_PRIMITIVE_ATTRIBUTE
[ERROR] Medium: Primitive field hudson.plugins.plot.Plot.urlStyle is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.Plot] At Plot.java:[line 476] PA_PUBLIC_PRIMITIVE_ATTRIBUTE
[ERROR] Medium: Primitive field hudson.plugins.plot.Plot.urlTitle is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.Plot] At Plot.java:[line 464] PA_PUBLIC_PRIMITIVE_ATTRIBUTE
[ERROR] Medium: Primitive field hudson.plugins.plot.Plot.urlUseDescr is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.Plot] At Plot.java:[line 486] PA_PUBLIC_PRIMITIVE_ATTRIBUTE
[ERROR] Medium: Primitive field hudson.plugins.plot.PlotBuilder.csvSeries is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.PlotBuilder] At PlotBuilder.java:[line 190] PA_PUBLIC_PRIMITIVE_ATTRIBUTE
[ERROR] Medium: Primitive field hudson.plugins.plot.PlotBuilder.propertiesSeries is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.PlotBuilder] At PlotBuilder.java:[line 199] PA_PUBLIC_PRIMITIVE_ATTRIBUTE
[ERROR] Medium: Primitive field hudson.plugins.plot.PlotBuilder.xmlSeries is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility. [hudson.plugins.plot.PlotBuilder] At PlotBuilder.java:[line 208] PA_PUBLIC_PRIMITIVE_ATTRIBUTE

How to test

mvn clean verify

Checklist

  • Git commits follow best practices
  • Build passes in Jenkins
  • Appropriate tests or explanation to why this change has no tests
  • Pull Request is marked with appropriate label (see .github/release-drafter.yml)
  • JIRA issue is well described (problem explanation, steps to reproduce, screenshots)
  • For dependency updates: links to external changelogs and, if possible, full diffs

@gounthar gounthar added dependencies Dependencies update chore General project maintenance labels Mar 25, 2024

@MarkEWaite MarkEWaite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I pushed changes to only exclude the specific bug pattern and to use the default spotbugs exclusion file name so that no additional entry is needed in pom.xml for the spotbugs file.

@gounthar
gounthar marked this pull request as ready for review March 25, 2024 18:39
@gounthar

gounthar commented Mar 25, 2024

Copy link
Copy Markdown
Contributor Author

Thank you, @MarkEWaite 👍

@MarkEWaite
MarkEWaite enabled auto-merge (squash) March 25, 2024 18:40
@MarkEWaite
MarkEWaite merged commit 131b8b9 into jenkinsci:master Mar 25, 2024
@gounthar
gounthar deleted the 4.80 branch March 25, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore General project maintenance dependencies Dependencies update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants