We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If your utility class has no private constructor, Sonarqube will complain with java:S1118 “Utility classes should not have public constructors”
which is right. The Sonarqube rule desciption has
class StringUtils { // Compliant private StringUtils() { throw new IllegalStateException("Utility class"); } public static String concatenate(String s1, String s2) { return s1 + s2; } }
It's best practice to throw an exception, as i learned. But when i use the exception i'll get
You should expand the filter for also private constructors throwing an exception, as this is best practice. Those filters where introduced with JaCoCo 0.8.0 https://github.com/jacoco/jacoco/wiki/FilteringOptions#filters-for-code-where-test-execution-is-questionable-or-impossible-by-design
Gilbert
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If your utility class has no private constructor, Sonarqube will complain with
java:S1118 “Utility classes should not have public constructors”
which is right. The Sonarqube rule desciption has
It's best practice to throw an exception, as i learned.
But when i use the exception i'll get
You should expand the filter for also private constructors throwing an exception, as this is best practice.
Those filters where introduced with JaCoCo 0.8.0
https://github.com/jacoco/jacoco/wiki/FilteringOptions#filters-for-code-where-test-execution-is-questionable-or-impossible-by-design
Gilbert
The text was updated successfully, but these errors were encountered: