aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorTimur Tibeyev <timurtibeyev@gmail.com>2017-12-26 11:02:41 +0600
committerrnveach <rveach02@gmail.com>2017-12-27 10:12:10 -0500
commit1c73987f2f560ecabb6825943c8362fb11b67749 (patch)
tree27099598b0bf0b1a0cc14be804b202c78a94624e /config
parent06616102b1074fabb1a308bb74bcc9b159d11879 (diff)
downloadcheckstyle-1c73987f2f560ecabb6825943c8362fb11b67749.tar.gz
Issue #4421: Support suppression-xpath element in SuppressionLoader
Diffstat (limited to 'config')
-rw-r--r--config/ant-phase-verify.xml2
-rw-r--r--config/checkstyle_checks.xml3
-rw-r--r--config/suppressions-xpath.xml21
-rw-r--r--config/suppressions.xml8
4 files changed, 26 insertions, 8 deletions
diff --git a/config/ant-phase-verify.xml b/config/ant-phase-verify.xml
index b9a2331a4..feba93f94 100644
--- a/config/ant-phase-verify.xml
+++ b/config/ant-phase-verify.xml
@@ -38,6 +38,8 @@
<property key="checkstyle.importcontroltest.file" file="config/import-control-test.xml"/>
<property key="checkstyle.suppressions.file"
file="config/suppressions.xml"/>
+ <property key="checkstyle.suppressions-xpath.file"
+ file="config/suppressions-xpath.xml"/>
</checkstyle>
<tstamp>
diff --git a/config/checkstyle_checks.xml b/config/checkstyle_checks.xml
index c94e8f5c9..8e158f424 100644
--- a/config/checkstyle_checks.xml
+++ b/config/checkstyle_checks.xml
@@ -312,6 +312,9 @@
<property name="offCommentFormat" value="CSOFF\: .*"/>
<property name="onCommentFormat" value="CSON\: .*"/>
</module>
+ <module name="SuppressionXpathFilter">
+ <property name="file" value="${checkstyle.suppressions-xpath.file}"/>
+ </module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="-@cs\[(\w{8,}(\|\w{8,})*)\] \w[\(\)\-\.\'\`\,\:\;\w ]{10,}"/>
<property name="checkFormat" value="$1"/>
diff --git a/config/suppressions-xpath.xml b/config/suppressions-xpath.xml
new file mode 100644
index 000000000..65fba6de6
--- /dev/null
+++ b/config/suppressions-xpath.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Suppressions Xpath Experimental 1.2//EN"
+ "http://checkstyle.sourceforge.net/dtds/suppressions_1_2_xpath_experimental.dtd">
+
+<suppressions>
+ <!-- Tone down the checking for test code -->
+ <suppress-xpath checks="NPathComplexity"
+ query="/CLASS_DEF[@text='XdocsPagesTest']
+ //METHOD_DEF[@text='validateCheckSection']"/>
+
+ <suppress-xpath checks="CyclomaticComplexity"
+ query="/CLASS_DEF[@text='XdocsPagesTest']//METHOD_DEF"/>
+
+ <!-- Suppressions from PMD configuration-->
+ <!-- JavadocMethodCheck, JavadocStyleCheck, JavadocUtils.getJavadocTags() - deprecated -->
+ <suppress-xpath checks="CyclomaticComplexity"
+ query="/CLASS_DEF[@text='JavadocMethodCheck' or @text='JavadocStyleCheck'
+ or @text='CustomImportOrderCheck']//METHOD_DEF"/>
+</suppressions>
diff --git a/config/suppressions.xml b/config/suppressions.xml
index c589879c1..aeb9c3300 100644
--- a/config/suppressions.xml
+++ b/config/suppressions.xml
@@ -24,8 +24,6 @@
files="AbstractCheckTest.java|AbstractClassNameCheckTest.java|AbstractTypeAwareCheckTest.java|AbstractJavadocCheckTest.java|AbstractViolationReporterTest.java|AbstractFileSetCheckTest.java|AbstractNodeTest.java"/>
<!-- Tone down the checking for test code -->
- <suppress checks="CyclomaticComplexity" files="[\\/]XdocsPagesTest\.java"/>
- <suppress checks="NPathComplexity" files="[\\/]XdocsPagesTest\.java"/>
<suppress checks="IllegalCatch" files="[\\/]internal[\\/].*[\\/]\w+Util\.java"/>
<suppress checks="EmptyBlock" files=".*[\\/]src[\\/]test[\\/]"/>
<suppress message="Missing a Javadoc comment|Missing package-info.java file|Expected @throws tag for|missing an @author tag" files=".*[\\/]src[\\/](test|it)[\\/]"/>
@@ -85,12 +83,6 @@
<!-- Should be fixed after moving https://github.com/sevntu-checkstyle/sevntu.checkstyle/blob/master/sevntu-checks/src/main/java/com/github/sevntu/checkstyle/checks/coding/ReturnCountExtendedCheck.java into the main repo, to allow skip guard sentences(or by topLinesToIgnoreCount) -->
<suppress checks="ReturnCount" files="(ConfigurationLoader|LambdaHandler)\.java"/>
- <!-- Suppressions from PMD configuration-->
- <!-- JavadocMethodCheck, JavadocStyleCheck, JavadocUtils.getJavadocTags() - deprecated -->
- <suppress checks="CyclomaticComplexity" files="JavadocMethodCheck\.java"/>
- <suppress checks="CyclomaticComplexity" files="JavadocStyleCheck\.java"/>
- <suppress checks="CyclomaticComplexity" files="CustomImportOrderCheck\.java"/>
-
<!-- HandlerFactory crosses allowed limit for executable statements -->
<suppress checks="ExecutableStatementCount" files="HandlerFactory\.java"/>
</suppressions>