Issue #2268: require all filters appear in checkstyle_checks.xml

This commit is contained in:
rnveach 2015-10-30 10:52:49 -04:00 committed by Roman Ivanov
parent 9a39d19a31
commit aa89a8aa52
3 changed files with 51 additions and 7 deletions

View File

@ -380,4 +380,31 @@
<module name="Translation">
<property name="requiredTranslations" value="de, fr, fi, es, pt, ja, tr"/>
</module>
<module name="SuppressWarningsFilter"/>
<module name="SeverityMatchFilter">
<!--
report all violations except ignore
-->
<property name="severity" value="ignore"/>
<property name="acceptOnMatch" value="false"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<!--
Use suppressions.xml for suppressions, this is only example.
checkFormat will prevent suppression comments from being valid.
-->
<property name="checkFormat" value="IGNORETHIS"/>
<property name="commentFormat" value="SUPPRESS CHECKSTYLE, (\w+)"/>
<property name="messageFormat" value="$1"/>
<property name="influenceFormat" value="-1"/>
</module>
<module name="SuppressionCommentFilter">
<!--
Use suppressions.xml for suppressions, this is only example.
checkFormat will prevent suppression comments from being valid.
-->
<property name="checkFormat" value="IGNORETHIS"/>
<property name="offCommentFormat" value="CSOFF\: .*"/>
<property name="onCommentFormat" value="CSON\: .*"/>
</module>
</module>

View File

@ -191,13 +191,6 @@ public class AllChecksTest extends BaseCheckTestSupport {
final Set<String> configChecks = getCheckStyleChecksReferencedInConfig(CONFIG_PATH);
for (String moduleName : getSimpleNames(getCheckstyleModules())) {
if ("SuppressionCommentFilter".equals(moduleName)
|| "SeverityMatchFilter".equals(moduleName)
|| "SuppressWithNearbyCommentFilter".equals(moduleName)
|| "SuppressWarningsFilter".equals(moduleName)) {
continue;
}
Assert.assertTrue("checkstyle_checks.xml is missing module: " + moduleName,
configChecks.contains(moduleName));
}

View File

@ -73,6 +73,12 @@
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L384-L390">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filters </p>
@ -528,6 +534,12 @@ HashSet hashSet; // Warning here: Declaring variables, return values or paramete
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L401-L409">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filters </p>
@ -713,6 +725,12 @@ public static final int [] array; // @cs.suppress ConstantName | NoWhitespaceAft
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L391-L400">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filters </p>
@ -774,6 +792,12 @@ private int [] ARRAY; // should NOT fail MemberNameCheck and NoWhitespaceAfterCh
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L383">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filters </p>