[英]Count number of checkstyle errors in repository ignoring suppressions file
I have a maven application.我有一个 maven 应用程序。 In pom.xml it has a
maven-checkstyle-plugin
3.1.1 configured with suppressions.xml
file.在 pom.xml 中,它有一个
maven-checkstyle-plugin
3.1.1 配置了suppressions.xml
.xml 文件。
I need to count the number of checkstyle errors in the code ignoring the suppressions.xml file.我需要计算代码中忽略了 suppresss.xml文件的 checkstyle 错误的数量。
Is there a way to do it via command line?有没有办法通过命令行来做到这一点?
For now I have come up with the following:现在我想出了以下几点:
mvn clean checkstyle:checkstyle
-Dcheckstyle.config.location=http://example.com/checkstyle.xml
-Dcheckstyle.config.logViolationsToConsole=true
-Dcheckstyle.includeResources=false
-Dcheckstyle.includeTestResources=false
or或者
mvn clean org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle
-Dcheckstyle.config.location=http://example.com/checkstyle.xml
-Dcheckstyle.config.logViolationsToConsole=true
-Dcheckstyle.includeResources=false
-Dcheckstyle.includeTestResources=false
but it still takes suppressions.xml into account.但它仍然需要抑制。xml 考虑在内。
There is no good way to do that, but there is a workaround没有好的方法可以做到这一点,但是有一个解决方法
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
</suppressions>
Also, you can replace path to suppressions file in checkstyle config and override it with property in same way.此外,您可以在 checkstyle 配置中替换抑制文件的路径,并以相同的方式用属性覆盖它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.