CheckStyle: SuppressionFilter told us how
An XML suppression XML document contains a set of suppress elements, where each suppress element can have the following attributes:
- files - a regular expression that matches the file name associated with the audit event. It is necessary.
- Validates — The regular expression matched against the validation name associated with the audit event. Optional if an identifier is specified.
- id is a string associated with the verification identifier associated with the audit event. Optional if validations are specified.
- strings - a list of values separated by commas, where each value is an integer or a range of integers denoted by integer-integer. It's not obligatory.
- columns - a list of values separated by commas, where each value is an integer or a range of integers denoted by integer-integer. It's not obligatory.
Since files is regular expression , you can check the network configuration on the regular expression page for Java .
If files is **/*.java when regular expression is applied with com.test.My.java , the result is a crash like Dangling meta character '*' near index 0 **/*.java ^
The solution then sets the files as .*\.java , when regular expression with com.test.My.java , the result is matches (): yes , lookAt (): yes , find (): yes and group (0): com. test.My.java .
The plugin configuration should be as follows: -
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.10</version> <configuration> <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation> <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression> </configuration> </plugin>
checkstyle: checkstyle told us how
suppressionsLocation . Specifies the location of the suppression XML file. This parameter is resolved as a resource, URL, and then a file . If successfully resolved, the contents of the XML suppression files will be copied to the ${project.build.directory}/checkstyle-supressions.xml before ${project.build.directory}/checkstyle-supressions.xml it to Checkstyle for download.
suppressionionsFileExpression The key to be used in the suppression file properties. The default value is checkstyle.suppressions.file .
For more information, see Maven Checkstyle Plugin: Using the Prohibition Filter .
Hope this helps.
source share