Skip to content

Add checks for OpenJDK Style §3.10 - Variable Declarations #19641

@lithops-zty

Description

@lithops-zty

Parent issue: #19604 #19798

Image

Description

Add Checkstyle checks for all rules under §3.10 - Variable Declarations of the OpenJDK Java Style Guidelines v6.

Rules Covered

From §3.10 - Variable Declarations:

  1. One variable per declaration (and at most one declaration per line) - MultipleVariableDeclarations Check
  2. Square brackets of arrays should be at the type (String[] args) and not on the variable (String args[]). - ArrayTypeStyle Check with javaStyle set to true (default)
  3. Declare a local variable right before it is first used, and initialize it as close to the declaration as possible. - VariableDeclarationUsageDistance Check

Checks to add to openjdk_checks.xml

TreeWalker-level

<module name="TreeWalker">
  <module name="MultipleVariableDeclarations"/>
  <module name="ArrayTypeStyle"/>
  <module name="VariableDeclarationUsageDistance"/>
</module>

Progress Tracker

Check Rule PR
MultipleVariableDeclarations One variable per declaration & one declaration per line #19651
ArrayTypeStyle Java-style array declaration #19749
VariableDeclarationUsageDistance Local variable declaration right before first usage #19856

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