checkstyle / checkstyle/checkstyle

A false negative about the rule Indentation

Open
#13,782 5 comments 0 reactions 0 assignees View on GitHub
approved indentation
Dominant language
Java
Stars
9.6k
Forks
4.2k
Avg merge
21h 32m
Merged PRs (30d)
233

Description

I have read check documentation: https://checkstyle.sourceforge.io/checks/misc/indentation.html#Indentation
I have downloaded the latest checkstyle 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

```bash
/var/tmp $ cat T.java
import util.MyAnnotation;
@MyAnnotation
public @Ann
@Ann2 class T
implements TestInterface {
}

/var/tmp $ cat config.xml













/var/tmp $ java -Duser.language=en -Duser.country=US -jar checkstyle-10.12.3-all.jar -c config.xml T.java
Starting audit...
Audit done.
```

I would expect Checkstyle to show the warning message like:
```bash
Starting audit...
[WARN] T.java:4:1: '@' has incorrect indentation level 0, expected level should be 4. [Indentation]
Audit done.
```
but no warnings, hence, I think this is an FN.

UPDATE: recommended to fix https://github.com/checkstyle/checkstyle/issues/14716 first.
PR for this issue: https://github.com/checkstyle/checkstyle/pull/14149

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with T.java, config.xml, and the Checkstyle CLI command shown in the issue. Read issue 14716 first, then review pull request 14149 for the work already proposed. Done means the Indentation check reports the expected warning for the annotation indentation without introducing regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.