Maven Checkstyle Plugin: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==References== {| | valign="top" | * [https://stackoverflow.com/questions/27688426/ Ignoring of Checkstyle warnings with <code>@SuppressWarnings</code>] * [https://maven.apach...") |
No edit summary |
||
Line 1: | Line 1: | ||
<source lang="xml"> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-checkstyle-plugin</artifactId> | |||
<version>3.1.2</version> | |||
<configuration> | |||
<suppressionsLocation>configs/checkstyle/suppressions.xml</suppressionsLocation> | |||
<configLocation>configs/checkstyle/checkstyle.xml</configLocation> | |||
<consoleOutput>true</consoleOutput> | |||
<failsOnError>true</failsOnError> | |||
<encoding>UTF-8</encoding> | |||
<linkXRef>false</linkXRef> | |||
</configuration> | |||
<executions> | |||
<execution> | |||
<id>validate</id> | |||
<phase>validate</phase> | |||
<goals> | |||
<goal>check</goal> | |||
</goals> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
</source> | |||
==Suppressions== | |||
<source lang="xml"> | |||
<?xml version="1.0"?> | |||
<!DOCTYPE suppressions PUBLIC | |||
"-//Puppy Crawl//DTD Suppressions 1.0//EN" | |||
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> | |||
<suppressions> | |||
<suppress files="Service.java" checks="HideUtilityClassConstructor"/> | |||
<suppress files="DataService.java" checks="HideUtilityClassConstructor"/> | |||
<suppress files="UserService.java" checks="HideUtilityClassConstructor"/> | |||
<suppress files="PolicyService.java" checks="HideUtilityClassConstructor"/> | |||
</suppressions> | |||
</source> | |||
==Checkstyle== | |||
<source lang="xml"> | |||
<!DOCTYPE module PUBLIC | |||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN" | |||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> | |||
<module name="Checker"> | |||
<property name="severity" value="warning"/> | |||
<module name="SuppressWarningsFilter"/> | |||
<module name="TreeWalker"> | |||
<module name="HiddenField"> | |||
<property name="ignoreSetter" value="true"/> | |||
<property name="ignoreConstructorParameter" value="true"/> | |||
</module> | |||
<module name="SuppressWarnings"> | |||
<property name="id" value="checkstyle:suppresswarnings"/> | |||
</module> | |||
</module> | |||
</module> | |||
</source> | |||
==References== | ==References== | ||
{| | {| |
Revision as of 23:25, 14 September 2022
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<suppressionsLocation>configs/checkstyle/suppressions.xml</suppressionsLocation>
<configLocation>configs/checkstyle/checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<encoding>UTF-8</encoding>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Suppressions
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.0//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
<suppressions>
<suppress files="Service.java" checks="HideUtilityClassConstructor"/>
<suppress files="DataService.java" checks="HideUtilityClassConstructor"/>
<suppress files="UserService.java" checks="HideUtilityClassConstructor"/>
<suppress files="PolicyService.java" checks="HideUtilityClassConstructor"/>
</suppressions>
Checkstyle
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="severity" value="warning"/>
<module name="SuppressWarningsFilter"/>
<module name="TreeWalker">
<module name="HiddenField">
<property name="ignoreSetter" value="true"/>
<property name="ignoreConstructorParameter" value="true"/>
</module>
<module name="SuppressWarnings">
<property name="id" value="checkstyle:suppresswarnings"/>
</module>
</module>
</module>
References
| ||