Skip to content

test to check indentation trailing comments are vertically aligned #17128

@mohitsatr

Description

@mohitsatr

I have read check documentation: https://checkstyle.org/checks/misc/indentation.html
I have downloaded the latest cli from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words

from #16627 (comment)

Unaligned trailing comments:
Image

Aligned trailing comments:
Image

I'd like a see a test which verifies indentation trailing comments are vertically aligned in all indentation input files.
we could use the column no. to for this purpose. there are some expection cases we need to keep in mind like:

Image

I feel it's better not to disturb the position of non-trailing ones

Here is suppression for files that are not updates to correct form yet:

private static final Set<String> ALLOWED_VIOLATION_FILES = Set.of(
// reason: IndentationCheckTest tests fail after alignment
"InputIndentationAnnArrInit.java",
"InputIndentationDifficultAnnotations.java",

until ALLOWED_VIOLATION_FILES is present, issue should be opened, help is appreciated.

here is latest state of this suppression list: https://github.com/checkstyle/checkstyle/blob/master/src/test/java/com/puppycrawl/tools/checkstyle/IndentationTrailingCommentsVerticalAlignmentTest.java#L43

Good example of expected update:
https://github.com/checkstyle/checkstyle/pull/17714/files

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