Closed
Description
$ 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.