Skip to content

Add checks for OpenJDK Style §3.7 - Indentation #19619

@vivek-0509

Description

@vivek-0509

Parent issue: #19604

Image

Description

Add Checkstyle checks for all rules under §3.7 - Indentation of the OpenJDK Java Style Guidelines v6.

Rules covered

From §3.7 - Indentation:

  1. Indentation level is four spaces - Indentation Check
  2. Only space characters may be used for indentation. No tabs - FileTabCharacter Check
  3. Empty lines must not be indented. (This is implied by the no trailing white space rule.) - covered by RegexpSingleline in §2
  4. case lines should be indented with four spaces, and statements within the case should be indented with another four spaces - Indentation Check
  5. Refer to Section Wrapping Lines for guidelines on how to indent continuation lines - Indentation Check

Checks to add to openjdk_checks.xml

Checker-level (non-TreeWalker):

<module name="FileTabCharacter">
  <property name="eachLine" value="true"/>
</module>

TreeWalker-level:

<module name="Indentation">
  <property name="basicOffset" value="4"/>
  <property name="caseIndent" value="4"/>
  <property name="throwsIndent" value="8"/>
  <property name="lineWrappingIndentation" value="8"/>
  <property name="arrayInitIndent" value="4"/>
</module>

Progress tracker

Check Rule PR
FileTabCharacter No tabs, only spaces
Indentation Four-space indentation, case indent, continuation lines

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions