does anyone share the need for such code style rules ?

Hi

the local coding conventions I found in my new team include :

1) space required before the "(" in method declarations and calls only
if the method has arguments, e.g.

callToMyMethod();
callToMyMtehodWithArgs (arg1, arg2);



2) throws clause indented and multiple exceptions vertically aligned

class Foo
{
...
public MyType myMethod()
throws com.MyException1,
com.MyException2



3) variable declarations aligned:

class Foo
{
private int myvar1 = 0;
protected MyType myType = null;



does anyone share the need to have these ?
does anyone know of how to write a plugin / external checker at least
for rule 1) which I can't have my fingers type ;) ?

cheers,
Edo


1 comment

Incredible what people come up with in their coding guidelines...

I'm one of the developers of an open source tool to check coding conventions, http://checkstyle.sourceforge.net. Checkstyle comes with an Ant task and a commandline frontend.

Checkstyle 3.0 allows users to write their own checks as a plugin. Checks for the conventions you presented would probably be quite easy to implement, especially 1 should be very straightforward.

Please read the "writing checks" document and don't hesitate to ask on the checkstyle-user mailing list if you have any questions about the implementation of your check.

Hope this helps,
Lars

0

Please sign in to leave a comment.