为什么我的 checkstyle-supressions 被忽略了?
Why my checkstyle-supressions are ignored?
我有问题。看起来我的 checkstyle-supressions 被忽略了。我确定文件路径是正确的(checkstyle.xml 已正确加载),但 checkstyle-supressions 不起作用。你知道谁可能是错的吗?
下面是我的 Maven 配置:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
...
<profiles>
<profile>
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<configLocation>custom-checkstyle.xml</configLocation>
<suppressionsLocation>custom-checkstyle-suppressions.xml</suppressionsLocation>
<includeTestSourceDirectory>false</includeTestSourceDirectory>
<enableFilesSummary>true</enableFilesSummary>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...
</project>
还有我的自定义检查样式抑制文件:
<?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 checks=".*"
files="src/main/java/model/Player.java"/>
</suppressions>
非常感谢
我必须添加
<module name="SuppressionFilter">
<property name="file" value="custom-checkstyle-suppressions.xml"/>
</module>
到 checstyle.xml
中的 Checker 模块
我有问题。看起来我的 checkstyle-supressions 被忽略了。我确定文件路径是正确的(checkstyle.xml 已正确加载),但 checkstyle-supressions 不起作用。你知道谁可能是错的吗? 下面是我的 Maven 配置:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
...
<profiles>
<profile>
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<configLocation>custom-checkstyle.xml</configLocation>
<suppressionsLocation>custom-checkstyle-suppressions.xml</suppressionsLocation>
<includeTestSourceDirectory>false</includeTestSourceDirectory>
<enableFilesSummary>true</enableFilesSummary>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
...
</project>
还有我的自定义检查样式抑制文件:
<?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 checks=".*"
files="src/main/java/model/Player.java"/>
</suppressions>
非常感谢
我必须添加
<module name="SuppressionFilter">
<property name="file" value="custom-checkstyle-suppressions.xml"/>
</module>
到 checstyle.xml
中的 Checker 模块