checkstyle / checkstyle/checkstyle

False Negative: LeftCurlyCheck

Closed
#11,410 10 comments 0 reactions 0 assignees View on GitHub
approved
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/config_blocks.html#LeftCurly
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

default `option` value is `eol`.

```bash
/var/tmp $ javac Test.java

/var/tmp $ cat config.xml
```
```



```
```
/var/tmp $ cat Test.java
public class Test {

void method1 ()
/* violation but not reported */ { }

void method2 ()
{ } /* violation and reported */
}
```
```
/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java $RUN_LOCALE -jar checkstyle-10.0-all.jar -c config.xml Test.java
Starting audit...
[ERROR] /var/tmp/Test.java:7:6: '{' at column 6 should be on the previous line. [LeftCurly]
Audit done.
Checkstyle ends with 1 errors.
```

---
**Describe what you expect in detail.**
```
/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java $RUN_LOCALE -jar checkstyle-10.0-all.jar -c config.xml Test.java
Starting audit...
[ERROR] /var/tmp/Test.java:4:38: '{' at column 38 should be on the previous line. [LeftCurly]
[ERROR] /var/tmp/Test.java:7:6: '{' at column 6 should be on the previous line. [LeftCurly]
Audit done.
Checkstyle ends with 2 errors.

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with Test.java, config.xml, and the Checkstyle CLI using the LeftCurly check. Start by tracing how LeftCurly handles a method declaration whose opening brace is on a later line; done means the CLI reports violations for both method1 and method2.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.