gpt4 book ai didi

Checkstyle 不适用于 SuppressionCommentFilter

转载 作者:行者123 更新时间:2023-12-03 14:57:04 29 4
gpt4 key购买 nike

下面是我关于检查样式的代码 - 但它似乎并没有抑制抑制注释行之间的审计。我还尝试使用内联注释//而不是/* */

请帮忙。我尝试了很多方法 - 排列/组合这些方法来解决这个问题。谢谢你。
如果您需要更多信息,请告诉我。

/* CHECKSTYLE:OFF */
private abc createTimerChart(String title, String yAxisLabel, XYDataset dataset) {
final abc chart = ChartFactory.createXYLineChart(title, // chart title
"Time Elapsed (" + pollUnit.toString() + ")", // x axis label
yAxisLabel, // y axis label
dataset, // data
PlotOrientation.VERTICAL, true, // include legend
true, // tooltips
false // urls
);
/* CHECKSTYLE:ON */

CONFIG.XML 读取:
    <module name="FileContentsHolder">
<module name="SuppressionCommentFilter">
<property name="checkFormat" value="IndentationCheck"/>
</module>
</module>

在检查器下移动 SuppressionCommentFilter 后:
<module name="Checker">

<!-- setting the default severity to warning -->
<property name="severity" value="warning" />

<module name="SuppressionCommentFilter">
<property name="checkFormat" value="Indentation"/>
</module>

<!-- No TAB characters in the source code -->
<module name="FileTabCharacter" />

<!-- List of files to ignore . -->
<!-- TODO Add all auto-generated files to this file -->
<module name="SuppressionFilter">
<property name="file" value="checkstyle/kepler-checkstyle-suppressions.xml"/>
</module>
<module name="TreeWalker">
..
..
..

最佳答案

缩进检查称为 Indentation .如果您更改 checkFormat,它将起作用属性(property)只是Indentation :

<?xml version="1.0" encoding="utf-8"?>
<!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="TreeWalker">
<module name="JavadocType" />
<module name="Indentation" />
<module name="FileContentsHolder"/>
</module>
<module name="SuppressionCommentFilter">
<property name="checkFormat" value="Indentation" />
</module>
</module>

或者,更一般地说,我建议不要设置 checkFormat属性,这将使抑制注释抑制该代码块的所有警告。

关于Checkstyle 不适用于 SuppressionCommentFilter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13349016/

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