About coding style
See original GitHub issueI read .github/CONTRIBUTING.md
and https://github.com/graphhopper/graphhopper/issues/770, and it states that the line width is required to be 100
chars.
However, this requirement is largely violated in the current code base.
I run CheckStyle
with LineLength
as 100
and there are 1056
violations
It seems that 120
-char is more accepted.
(running CheckStyle
with LineLength
as 120
reduces #violations to 353
).
A more general question is "shall we use CheckStyle
or something alike to enforce the code style as a part of integration testing?
Relying on the description in CONTRIBUTING.md
seems not very effective.
btw, I see the use of CheckStyle
being commented out in the current pom.xml
.
Is there a reason that we intentionally try to avoid CheckStyle
?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
I added a basic checkstyle & findbugs configuration here: https://github.com/ammagamma/graphhopper/tree/issue_1109 Right now there are 361 checkstyle violations (it only checks for the line length to be 120 at the moment). Findbugs finds 5 bugs with severity 7 or lower (lower means more severe) and for demonstration I configured
findbugs-exclude.xml
to exclude some of them. Rules can be excluded by rule type or only for certain classes/methods etc. Both tools are configured so they run in the maven integration-test phase and fail the build if there are any violations. Right now we can makemvn install
run successfully for example if we adjust the line length limit to 500 (yes there are some very long lines) and if we set themaxRank
configuration of the findbugs maven plugin to 4 (which means it only checks for the ‘scariest’ bugs). To use more strict settings some of the current code needs to be adjusted…This is now integrated although I don’t find the checkstyle plugin too useful at the moment. Have not adapted the contributing guide, so over time we should migrate to the 100 columns but accept more like 120 for now.
Closing here.