checkstyle / checkstyle/checkstyle

Google style false positive for internal block of code

Open
#9,326 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.6k
Forks
4.2k
Avg merge
22h 23m
Merged PRs (30d)
232

Description

When using the google style, Checkstyle reports: `src/main/java/io/github/oliviercailloux/jaris/credentials/CredsReader.java:[186,5] (indentation) Indentation: 'block lcurly'`. It wants [that block](https://github.com/oliviercailloux/JARiS/blob/master/src/main/java/io/github/oliviercailloux/jaris/credentials/CredsReader.java#L186-L196) to be indented. That is because of the [Indentation module configuration](https://github.com/oliviercailloux/JARiS/blob/master/relaxed_google_style.xml#L245-L252), which comes straight from the original google check [corresponding configuration](https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml#L248-L255).

(The example project uses a local variant of Google style, but I verified that using the original also exhibit the problem.)

I do not think that [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) really mandates the (IMHO odd) indentation that Checkstyle wants to enforce.

Is it possible to fix the checkstyle google style implementation, by changing the Indentation configuration or otherwise, so that those blocks can be left indented as I like them to be?

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the indentation report at CredsReader.java lines 186-196 and compare the related Indentation configuration in relaxed_google_style.xml with google_checks.xml. Determine whether the Google-style configuration or another check should change so this block is accepted without violating the cited Google Java Style Guide; done means the false positive no longer appears.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.