From 35e07bf52e9bf8732cf4bf946e63719bfb7e2d05 Mon Sep 17 00:00:00 2001 From: Anatoly Karlov Date: Thu, 11 Mar 2021 19:33:12 +0700 Subject: [PATCH] add @SuppressWarnings and checkstyle-suppressions.xml opportunity (#13) update README --- README.md | 86 ++++++++++++++++++++++------- conf/checkstyle-suppressions.xml | 12 ++++ conf/rbkmoney_google_checkstyle.xml | 2 + 3 files changed, 80 insertions(+), 20 deletions(-) create mode 100644 conf/checkstyle-suppressions.xml diff --git a/README.md b/README.md index 02a3f17..c1dc212 100644 --- a/README.md +++ b/README.md @@ -2,27 +2,73 @@ Our check style config based on Google style Usage example: + ```xml - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.1 - - - validate - validate - - https://raw.githubusercontent.com/rbkmoney/java-checkstyle-config/master/conf/rbkmoney_google_checkstyle.xml - UTF-8 - true - true - warning - true - - - check - - - + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + + com.puppycrawl.tools + checkstyle + 8.41 + + + + + validate + validate + + ${checkstyle.config.path} + UTF-8 + true + true + warning + true + ${checkstyle.config.suppressions.path} + + + check + + + ``` + +### SuppressWarnings examples + +First path — override `${checkstyle.config.suppressions.path}` in project with `checkstyle-suppressions.xml` file and fill with your filters + +pom.xml: +```xml + + checkstyle-suppressions.xml + +``` + +checkstyle-suppressions.xml: +```xml + + + + + + + + + + +``` + +Other path — use: +```java +@SuppressWarnings({"checkstyle:%module_name%", "checkstyle:%module_name%""}) +``` + +Example: +```java +@SuppressWarnings({"checkstyle:parametername", "checkstyle:localvariablename"}) +``` diff --git a/conf/checkstyle-suppressions.xml b/conf/checkstyle-suppressions.xml new file mode 100644 index 0000000..ef2efcd --- /dev/null +++ b/conf/checkstyle-suppressions.xml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/conf/rbkmoney_google_checkstyle.xml b/conf/rbkmoney_google_checkstyle.xml index 5cc1ced..03956ef 100644 --- a/conf/rbkmoney_google_checkstyle.xml +++ b/conf/rbkmoney_google_checkstyle.xml @@ -33,6 +33,7 @@ default="checkstyle-suppressions.xml" /> + @@ -48,6 +49,7 @@ +