Skip to content

Files

Latest commit

 

History

History
46 lines (31 loc) · 1.18 KB

CommentsIndentation.md

File metadata and controls

46 lines (31 loc) · 1.18 KB

Pattern: Malformed comment indentation

Issue: -

Description

This rule controls the indentation between comments and surrounding code. By default it enforces recommendation by Google Java Style Guide - comments should be indented at the same level as the surrounding code.

Note: if comment block appears to be at the same level as surrounding code it's most likely caused by usage of mixed spaces and tabs.

Default configuration

<module name="CommentsIndentation"/>

Examples

Example of incorrect code:

// comment at the same indentation level
boolean bool = true;

  /* violation
  * (block comment should have the same indentation level as line below)
  */
double d = 3.14;

Example of correct code:

// comment at the same indentation level
boolean bool = true;

/* Block comment
*  at the same indentation level
*/
double d = 3.14;

Further Reading