gpt4 book ai didi

java - Checkstyle SuppressionCommentFilter 不忽略指定的规则

转载 作者:搜寻专家 更新时间:2023-10-30 19:51:49 25 4
gpt4 key购买 nike

我有一个看起来像这样的 checkstyle.xml:

<module name="Checker">
....

<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CSOFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CSON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>

<module name="TreeWalker">
<module name="LineLength">
<property name="max" value="200"/>
</module>
....
</module>
</module>

在我的一个类(class)中,我有一行超过 200 个字符,并在其周围放置了以下内容:

// CSOFF: LineLength
...
// CSON: LineLength

然而,有问题的行不会作为 checkstyle 的一部分被忽略。

我在 pom.xml 中指定了以下内容:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.6</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
</build>

并执行这个:

mvn checkstyle:checkstyle

最佳答案

您是否将 FileContentsHolder 配置为 documented

<module name="TreeWalker">
...
<module name="FileContentsHolder"/>
...
</module>

关于java - Checkstyle SuppressionCommentFilter 不忽略指定的规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5761188/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com