Checkstyle Errors Explained


You can consult the checkstyle documentation for a complete explanation of all checks.

Most checkstyle messages are self-explanatory: 

Kaboom.java:70:5: warning: Method length is 67 lines (max allowed is 50).
Kaboom.java:75: Line is longer than 89 characters.
Kaboom.java:77: One character variable name not allowed: c
Kaboom.java:80: 'if' construct must use '{}'s.
Kaboom.java:97:51: ',' is not followed by whitespace.
Kaboom.java:538:46: '{' should be on a new line.




Here are explanations for a few of the more obscure messages.

Kaboom.java:9:12: Name 'FEET_PER_MILE' must match pattern '^k[A-Z][a-zA-Z0-9]*$'

        The old C-style constants in all caps is not used in our coding standard.  Consult the coding standard definition for Constants to see the correct way to name constant identifiers.  For fun, see this humorous explanation.


Kaboom.java:51:52: '5000' is a magic number.

Use a named constant, not a numeric literal.  And don't name the constant static int fivethousand = 5000;  Tell us what five thousand means, e.g.,  static int kMaxBoards = 5000;



Kaboom.java:460:13: Must have at least one statement.


    Don't use empty braces.


Kaboom.java:250: Logic structure must be preceded by a comment.

The coding standard says "Every control structure block (loop, decision, case, sequence block) has a descriptive comment on the preceeding line."


Kaboom.java:640:9: Missing a Javadoc comment.
Kaboom.java:728:63: Expected @param tag for 'table'.
Kaboom.java:729:13: Expected @param tag for 'value'.
Kaboom.java:515: Expected an @return tag.

Provide complete Javadoc comments on all public methods.



Kaboom.java:728:63: 'table' hides a field.

You have a local variable with the same name as an instance variable (field).   Change the name of the local variable.


Kaboom.java:340:5: warning: Cyclomatic Complexity is 16 (max allowed is 10).

You logic is too complex, that is, too many nested decisions or loops.  Here is the complete explanation.  You should simplify your logic or decompose a large method into smaller ones.


Kaboom.java:15:1: Class Fan-Out Complexity is 30 (max allowed is 20).

The number of other classes a given class relies on.  The instructor may allow exceptions to this rule in special circumstances (must be negotiated in advance).