Skip to content

Commit 76ecba9

Browse files
Update README.md
1 parent f885506 commit 76ecba9

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,81 @@
11
# Checkstyle Suppression Generator
22

3+
A gem that takes as input the output of a maven checkstyle plugin checkstyle:check goal and generates a suppressions.xml file.
4+
5+
Example Input:
6+
```sh
7+
[INFO] Scanning for projects...
8+
[INFO] ------------------------------------------------------------------------
9+
[INFO] Reactor Build Order:
10+
[INFO]
11+
[INFO] my-project [jar]
12+
[INFO] ------------------< com.my-project:my-project >------------------
13+
[INFO] Building my-project 0.0.1-SNAPSHOT [1/1]
14+
[INFO] from my-project/pom.xml
15+
[INFO] --------------------------------[ jar ]---------------------------------
16+
[INFO]
17+
[INFO] --- checkstyle:3.3.0:check (default-cli) @ my-project ---
18+
[WARNING] src/main/java/com/test/DEF.java:[147,4] (coding) OverloadMethodsDeclarationOrder: All overloaded methods should be placed next to each other. Placing non-overloaded methods in between overloaded methods with the same type is a violation. Previous overloaded method located at line '119'.
19+
[WARNING] src/main/java/com/test/ABC.java:[26,11] (sizes) ParameterNumber: More than 7 parameters (found 9).
20+
[WARNING] src/main/java/com/test/ABC.java:[103,4] (coding) ReturnCount: Return count is 6 (max allowed for non-void methods/lambdas is 4).
21+
[WARNING] src/main/java/com/test/ABC.java:[103,4] (metrics) NPathComplexity: NPath Complexity is 720 (max allowed is 200).
22+
[INFO] ------------------------------------------------------------------------
23+
[INFO] Reactor Summary for my-project 0.0.1-SNAPSHOT:
24+
[INFO]
25+
[INFO] my-project .................................. FAILURE [ 1.957 s]
26+
[INFO] ------------------------------------------------------------------------
27+
[INFO] BUILD FAILURE
28+
[INFO] ------------------------------------------------------------------------
29+
[INFO] Total time: 2.841 s
30+
[INFO] Finished at: 2023-12-20T16:31:35-05:00
31+
[INFO] ------------------------------------------------------------------------
32+
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.3.0:check (default-cli) on project my-project: You have 4 Checkstyle violations. -> [Help 1]
33+
[ERROR]
34+
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
35+
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
36+
[ERROR]
37+
[ERROR] For more information about the errors and possible solutions, please read the following articles:
38+
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
39+
[ERROR]
40+
[ERROR] After correcting the problems, you can resume the build with the command
41+
[ERROR] mvn <args> -rf :my-project
42+
43+
```
44+
45+
Output:
46+
47+
```xml
48+
<?xml version="1.0"?>
49+
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
50+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
51+
52+
<suppressions>
53+
54+
<suppress checks="OverloadMethodsDeclarationOrder" files="src/main/java/com/test/DEF.java"/>
55+
<suppress checks="ParameterNumber" files="src/main/java/com/test/ABC.java"/>
56+
<suppress checks="ReturnCount" files="src/main/java/com/test/ABC.java"/>
57+
<suppress checks="NPathComplexity" files="src/main/java/com/test/ABC.java"/>
58+
59+
</suppressions>
60+
61+
```
62+
63+
64+
## Command Line Usage
65+
```sh
66+
Usage: checkstyle-suppression-generator command [OPTIONS]
67+
CHECKSTYLE_OUTPUT_FILE(STRING) [O=O]
68+
69+
Generate a Java checkstyle suppressions.xml file from a checkstyle:check output.
70+
71+
72+
Arguments:
73+
CHECKSTYLE_OUTPUT_FILE(STRING) Output from checkstyle:check goal
74+
75+
Keywords:
76+
O=O Name of the suppressions file to be generated (default
77+
"suppressions.xml")
78+
79+
Options:
80+
-h, --help Print usage
81+
```

0 commit comments

Comments
 (0)