Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#120 Elements of Java Style implementation

open
nobody
None
5
2012-10-10
2002-11-18
J.D. Fagan
No

Would be simply brilliant to have the "Elements of Java
Style" implemented as a configurable file to turn on
these great set of coding standards by Scott Ambler.

http://www.ambysoft.com/javaCodingStandards.html

Discussion

  • Lars Kühne
    Lars Kühne
    2002-12-29

    Logged In: YES
    user_id=401384

    J.D.,

    we have a new directory contrib/examples/conf where such
    examples would go.

    I don't have access to Ambler's book, but you are most
    welcome to provide a configuration file that covers Ambler's
    recommendations.

    Please make sure the file is suitable for the new
    configuration system (XML based) of Checkstyle 3.0, and
    attach the file here or send it to the user mailing list.

     
  • Logged In: YES
    user_id=192367

    A lot of the "Elements of java style" are higher level than can
    be be checked by CheckStyle.

    Some specific checks could be added:

    12 Join the vowel generation, do not shorten identifiers by
    leaving out the vowels. check for now abbreviation and max
    number of consecutive consonants
    <module name="VowelGeneration">
    <property name="illegalString" value="msg">
    <property name="maxNoVowel" value="4"> -->
    </module>
    13 Capitalize only the first letter of an acronym, check for
    know acronyms and for max number of consecutive uppercase
    letters
    <module name="AcrononymCapitalization">
    <property name="acronyms" value="Http,Xml,Sax">
    <property name="maxCapitals" value= "3"
    </module>
    27 pluralize the name of collection references
    <module name="PluralCollectionReferences">
    <property name="pluralEndings" value="s"/>
    <property name="collectionClassess"
    value="java.util...."/>
    </module>
    29 Qualify field variables with this. to distinguish them from
    local vars
    <module name="ThisMemberVariables"/>
    11 Question excessively long names
    <module name="IdentifierLength"/>
    46 establish and use a fixed ordering for javadoc tags
    <module name="OrderJavaDocTags">
    <property name="order"
    value="author,version,param,return,exception,see,since,deprec
    ated">
    </module>
    62 explain localvariable with an end-of-line comment
    <module name="ExplainLocalVariables"/>
    81 do not call nonfinal methods from within a constructor
    <module name="NonFinalsFromConstructor"/>
    82 use nested constructor to eliminate redundant code.
    there should be only 1 constructor without a this(...)
    <module name="NestConstructors"/>