Checkstyle in the IDE

Created: 2013/09/29 15:06:28+0000

Shortly after I started using Maven I added the Maven Checkstyle plugin to my build to generate reports on the conformance of my code to my preferred coding style. Recently I added an Eclipse plugin to do the same. The effects of installing a Checkstyle plugin into an IDE are simple. It makes you far more likely to fix problems and causes you to check files more thoroughly.

What do I mean by more likely to fix problems? I mean that I don't have to check something to see what Checkstyle says the errors and warnings are reported to me as I work. This makes it much easier and more natural to work with.

What do I mean by more thoroughly, it's the same style rules isn't it? I mean these rules are now being applied to my tests as well. These are throwing up a lot of issues. Or rather false positives. I want my tests the way they are. I have some very large class files among my tests and large methods to. This is because I'm checking the same thing with lots of data and I'm checking returned collections as thoroughly as I can. They are reasonable tests, simple and repetitive, I don't want them to be style checked the same way as the rest of my code.

The Eclipse plugin allows packages to be excluded but my tests have the same package names in different source folders. If I had started using the Eclipse plugin from the beginning it would have been easier. I'd only check the files I wanted to. As it is Checkstyle is currently disabled in my project. It is worthwhile having Checkstyle or something like it enabled but as always it is easier to start as you mean to go on than cram it in later.