incubator-crunch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Friedrich <m...@mafr.de>
Subject Checkstyle config
Date Sat, 14 Jul 2012 09:31:22 GMT
Hi,

some of you mentioned that you're interested in using Checkstyle
for Crunch. I realize that people making style proposals aren't the
most popular bunch, but I'll give it a try anyway ;-)

I took a first stab at a checkstyle configuration [1] that can serve
as a basis for discussion. It's mostly the default config for Eclipse
tweaked to fit Crunch's existing code base. Basically, I changed the
following things:

  * Only require Javadoc for types (classes/interfaces/enums), but
    eventually the entire pusblished API should be documented
  * Indent by 2 spaces instead of 4 (Indentation)
  * Set line limit from 80 to 120 characters (LineLength)
  * Don't allow tabs (FileTabCharacter)
  * Disabled DesignForExtension (we should really have this though)
  * Parameters may shadow fields (HiddenField)
  * Parameters don't need to be final (FinalParameters)
  * Allow magic numbers, otherwise it's too annoying (MagicNumers)

I've created a sample report [2] to give you a first impression.
Checkstyle flags 900 warnings for 20000 LoC which is a pretty good
value for a project that hasn't used Checkstyle during development.
A relatively large number of warnings is caused by a small number of
files (mostly code indented by 4 instead of 2 spaces), so there are
lots of quick wins.

The 2-space indenting my prove to be difficult; I haven't been able to
suppress some warnings concerning line wrapping ("ctor def throws at
indentation ..."). But perhaps I've overlooked something.

What do you think? Should we continue working on this?

Regards,
  Matthias

[1] http://users.mafr.de/~matthias/crunch/checkstyle.xml
[2] http://users.mafr.de/~matthias/crunch/checkstyle/checkstyle.html

Mime
View raw message