Java Developer Tools

Audit - Rules - Comments

This group contains audit rules that look for the correct usage of non-Javadoc comments within your code.



Code in Comments

Code that has been commented-out should be removed.

This rule searches for comments that appear to contain code and flags them. Such code should either be removed or made conditional (for example, by testing a logging level).

The following comment would be flagged:

    //System.out.println("Entering method");

Comment Local Variables

Local variables should be commented.

This audit rule checks for local variable declarations that are not followed by an end-of-line style comment. The comment is intended to describe the purpose of the variable.

If there are multiple local variables declared on a single line, the comment (if there is one) is assumed to belong to the first variable.

The following local variable declaration would be flagged because it is not commented:

    int sum = 0;

Document Closing Braces

Closing braces should be documented with a comment.

This audit rule checks for closing braces for specified statements that are not followed by a specified end-of-line comment. The comments are used to make it easier for readers to see the structure of the code.

The closing brace for the following if statement would be flagged as needing to be commented:

    if (employee.isHourly()) {

File Comment

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.