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

(Sonar) Fixed finding: "Utility classes should not have public constructors" #1397

Conversation

pixeebot[bot]
Copy link
Contributor

@pixeebot pixeebot bot commented Jun 7, 2024

Remediation

This change fixes "Utility classes should not have public constructors" (id = java:S1118) identified by Sonar.

Details

This change adds private constructors to utility classes. Utility classes are only meant to be accessed statically. Since they're not meant to be instantiated, we can use the Java's code visibility protections to hide the constructor and prevent unintended or malicious access.

Our changes look something like this:

   public class Utils {
+    private Utils() {}
     ...
More reading

I have additional improvements ready for this repo! If you want to see them, leave the comment:

@pixeebot next

... and I will open a new PR right away!

🧚🤖 Powered by Pixeebot

💬Feedback | 👥Community | 📚Docs | Codemod ID: sonar:java/avoid-implicit-public-constructor-s1118

@pixeebot pixeebot bot requested a review from Frooodle as a code owner June 7, 2024 07:52
Copy link

sonarqubecloud bot commented Jun 7, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@Frooodle Frooodle merged commit 4f5b19e into main Jun 7, 2024
4 checks passed
@pixeebot pixeebot bot deleted the pixeebot/drip-2024-06-07-sonar-java/avoid-implicit-public-constructor-s1118 branch June 7, 2024 08:09
szinn referenced this pull request in szinn/k8s-homelab Jun 9, 2024
…0.25.3 ) (#3802)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[ghcr.io/stirling-tools/s-pdf](https://togithub.com/Stirling-Tools/Stirling-PDF)
| patch | `0.25.2` -> `0.25.3` |

---

### Release Notes

<details>
<summary>Stirling-Tools/Stirling-PDF
(ghcr.io/stirling-tools/s-pdf)</summary>

###
[`v0.25.3`](https://togithub.com/Stirling-Tools/Stirling-PDF/releases/tag/v0.25.3):
0.25.3 fix for version number not showing

[Compare
Source](https://togithub.com/Stirling-Tools/Stirling-PDF/compare/v0.25.2...v0.25.3)

fix for version number not showing

#### What's Changed

- (Sonar) Fixed finding: "`@Override` should be used on overriding and
implementing methods" by
[@&#8203;pixeebot](https://togithub.com/pixeebot) in
[https://github.com/Stirling-Tools/Stirling-PDF/pull/1396](https://togithub.com/Stirling-Tools/Stirling-PDF/pull/1396)
- (Sonar) Fixed finding: "Utility classes should not have public
constructors" by [@&#8203;pixeebot](https://togithub.com/pixeebot) in
[https://github.com/Stirling-Tools/Stirling-PDF/pull/1397](https://togithub.com/Stirling-Tools/Stirling-PDF/pull/1397)
- 💾 Update Version by
[@&#8203;github-actions](https://togithub.com/github-actions) in
[https://github.com/Stirling-Tools/Stirling-PDF/pull/1399](https://togithub.com/Stirling-Tools/Stirling-PDF/pull/1399)
- Enhance Test Coverage for SPDF/Utils Classes by
[@&#8203;jimdouk](https://togithub.com/jimdouk) in
[https://github.com/Stirling-Tools/Stirling-PDF/pull/1385](https://togithub.com/Stirling-Tools/Stirling-PDF/pull/1385)

**Full Changelog**:
Stirling-Tools/Stirling-PDF@v0.25.2...v0.25.3

</details>

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTkuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM5OS44IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Co-authored-by: repo-jeeves[bot] <106431701+repo-jeeves[bot]@users.noreply.github.com>
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.

1 participant