[Hawkular-dev] checkstyle/enforcer

Peter Palaga ppalaga at redhat.com
Mon Feb 2 04:19:01 EST 2015


On 01/31/2015 06:09 PM, Heiko W.Rupp wrote:
>
>> Am 31.01.2015 um 00:16 schrieb John Mazzitelli <mazz at redhat.com>:
>>
>> I just converted the bus code to use hawkular-parent which in turn brought checkstyle/enforcer into play.
>>
>> I highly recommend everyone do this for your code as soon as you can - the earlier you integrate parent, and especially checkstyle/enforcer, the easier it will be on yourself. Lots of checkstyle and enforcer errors in my stuff that I had to go about fixing... you don't want to do this after you have lots of code that needs to be cleaned up.

+1

> I think those checks (while sometimes are annoying) are good.
>
> Having said that, I'd like to see a way to apply them as pre-commit and not on each
> mvn compile run.
> While devlopping in
>
> while (!working) {
>      change_some_stuff();
>      compile();
>      deploy();
>      test();
> }
>
> mode, being forced to fix import or line length issues is certainly reducing my productivity.
>
> And to repeat: I am very much in favor of enforcing all those checks once the code has left the
> above loop.

-Dlicense.skip and -Dcheckstyle.skip can help.

However, learning to code in a way acceptable for checkstyle is the way 
to go, IMO. Hence, I do not recommend using -Dcheckstyle.skip at any 
time unless you are 99.9% sure that you can comply with Checkstyle 
expectations. This is because the code you are changing should be 
formatted straight away rather than in a subsequent commit.

Your IDE can help a lot too:

* Turn on the displaying of non-printable characters in editors - to see 
tabs indentation, and trailing spaces

* Turn on the rendering of max line length border at 120. This is called 
"Show print margin" in Eclipse.

* Set automatic trailing whitespace removal on save. For Eclipse: 
http://stackoverflow.com/questions/1043433/how-to-auto-remove-trailing-whitespace-in-eclipse/26140346#26140346 
This was buggy in older Eclipse versions. You may want to try AnyEdit 
plugin from Marketplace

* Set all the Java stuff properly: import preferences, '{' placement, ...

-- P


More information about the hawkular-dev mailing list