8000 incompatibility with google-java-format: CatchFormalParameter is indented by 4 spaces instead of 2 · Issue #14654 · checkstyle/checkstyle · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
incompatibility with google-java-format: CatchFormalParameter is indented by 4 spaces instead of 2 #14654
Closed
@sdavids

Description

@sdavids
$ curl -L -O -s https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.14.1/checkstyle-10.14.1-all.jar
$ curl -L -O -s https://github.com/google/google-java-format/releases/download/v1.21.0/google-java-format-1.21.0-all-deps.jar
$ echo 'class CatchFormalParameterIndention{void test(){try{throw new UnsupportedOperationException();} catch(@SuppressWarnings("PMD.AvoidCatchingGenericException") Exception e){java.util.logging.Logger.getAnonymousLogger().severe(e.toString());}}}' > CatchFormalParameterIndention.java
$ cat CatchFormalParameterIndention.java
class CatchFormalParameterIndention{void test(){try{throw new UnsupportedOperationException();} catch(@SuppressWarnings("PMD.AvoidCatchingGenericException") Exception e){java.util.logging.Logger.getAnonymousLogger().severe(e.toString());}}}
$ java -jar google-java-format-1.21.0-all-deps.jar --replace 
62F5
CatchFormalParameterIndention.java
$ javac CatchFormalParameterIndention.java
$ cat CatchFormalParameterIndention.java
class CatchFormalParameterIndention {
  void test() {
    try {
      throw new UnsupportedOperationException();
    } catch (
        @SuppressWarnings("PMD.AvoidCatchingGenericException")
        Exception e) {
      java.util.logging.Logger.getAnonymousLogger().severe(e.toString());
    }
  }
}
$ RUN_LOCALE="-Duser.language=en -Duser.country=US"
$ java $RUN_LOCALE -jar checkstyle-10.14.1-all.jar -c /google_checks.xml CatchFormalParameterIndention.java
Starting audit...
[WARN] /private/tmp/CatchFormalParameterIndention.java:6:9: 'catch' child has incorrect indentation level 8, expected level should be 4. [Indentation]
Audit done.

Code formatted by google-java-format (the de-facto standard Google Java Style formatter) should be compatible with the google_checks.xml configuration out-of-the-box.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0