At https://markmail.org/message/3mhzlqew3igad3r2 I reported an issue that I was
not able to really qualify. After exchanging with a Checkstyle expert
(see markmail thread).
I was unable to find what in our checkstyle.xml file was wrongly throwing these
warnings. I decided that there was no reason to throw those warnings.
So I decided to put the SuppressionCommentFilter in our checkstyle.xml file and
use CHECKSTYLE_OFF: ALMOST_ALL/CHECKSTYLE_ON: ALMOST_ALL around
the concerned lines as documented here
https://checkstyle.sourceforge.io/config_filters.html#SuppressionCommentFilter_Examples
We currently have 54 checkstyle errors, few are related to too long methods
Obviously nobody have currently time to work on this issue.
This commit increases the max MethodLength to 784 to hide all current related
errors. This reduces checkstyle errors to 48. It also allows to easier focus on
other errors.
It still possible to works on OFBIZ-12338 by temporary reverting this commit or
replacing max ParameterNumber by the number wanted (was 500, is 60 by default)
We currently have 115 checkstyle errors, most are related to methods using a too
high number of params.
Obviously nobody have currently time to work on this issue.
This commit increases the max ParameterNumber to 26 to hide all current related
errors. This reduces checkstyle errors to 54. It also allows to easier focus on
other errors.
It still possible to works on OFBIZ-12335 by temporary reverting this commit or
replacing max ParameterNumber by the number wanted (was 10, is 7 by default)
Currently Checkstyle returns 222 occurrences of the message
"Utility classes should not have a public or default constructor."
This is due to https://checkstyle.sourceforge.io/config_design.html#HideUtilityClassConstructor
I don't think we need to follow the "prevents calls from subclass" suggestion there.
I rather suggest to comment out the related class in checkstyle.xml:
ie <!-- <module name="HideUtilityClassConstructor"/> -->
Then should remain only 280 errors and hopefully most will be easy to fix.
At least they will be easier to spot...
Note: I'm working on something else, so I will change
tasks.checkstyleMain.maxErrors from 502 to 280 later...
Thanks: Suraj and Aditya for confirmation
(OFBIZ-11661)
Fixes a known issue with config/checkstyle/checkstyle.xml:
TreeWalker is not allowed as a parent of LineLength Please review 'Parent Module'
section for this Check in web documentation if Check is standard
Mostly manually-automated, so some changes are not perfect. I have manually
changed back excessive ones
Comments out ArrayTypeStyle checkstyle
Updates checkstyleMain.maxErrors
(OFBIZ-11428)
Setting checkstyle to use LF line endings means that a newline at the
end of a source file is correctly detected no matter whether it is
checked out with LF or CRLF line endings.
(OFBIZ-11251)
Linting [1] is a software engineering practice which make the code more
readable and maintainable by improving its consistency and avoiding
potential programming mistakes. Gradle provides a core plugin for the
‘checkstyle’ tool [2][3] which implement a linting facility for the Java
language.
The check is done with the ‘gradlew check’ command.
There are currently a lot reported errors that will need to be fixed
incrementally in the future. We ensure that new errors will not be
introduced by defining a global threshold of “allowed” errors
corresponding to the sum of errors found in the framework and in the
official plugins.
[1] https://en.wikipedia.org/wiki/Lint_(software)
[2] https://checkstyle.org/
[3] https://docs.gradle.org/current/userguide/checkstyle_plugin.html
Thanks: Taher Alkhateeb and Jacques Le Roux for their feedback
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868597 13f79535-47bb-0310-9956-ffa450edef68