Last week I introduced Checkstyle to our team. I had enough of correcting all the code that was written in a totally different style.
We already had Sonar, so the real smells as errors were found but the code did not look consistent at all.
So we sat down and made our own Checkstyle ruleset together.
After that we imported this ruleset into everyone's IDE and we put the checkstyle-plugin to the project's pom, so no one would be able to successfully finish a Maven build if there are violations.
To mention a few, we included these:
- 4 spaces instead of a tab
- avoid trailing spaces
I know it was a bit harsh and the first week was a pain in the neck.
Why? We were not used to write Javadoc comments at all. Spaces were everywhere. Tabs were used.
So we decided to work on the Eclipse autoformat ruleset and when it was ready, we shared it with every team member.
It became a lot easier but it did not solve the Javadoc problem.
No worries, we made it, corrected every file, class and method.
Conventions are needed so the code at least looks consistent.
Now as the secod week started, we can see that we should make some minor modifications to refine this ruleset, but I guess it is normal.
Anyway I love this idea, and I planning to introduce similar tools for CSS, too.
So do you use Checkstyle or other syntax checking tools? Or are you planning to use one?