diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/ant-phase-verify.xml | 2 | ||||
-rw-r--r-- | config/catalog.xml | 2 | ||||
-rw-r--r-- | config/checkstyle_checks.xml | 12 | ||||
-rw-r--r-- | config/findbugs-exclude.xml | 67 | ||||
-rw-r--r-- | config/import-control.xml | 10 | ||||
-rw-r--r-- | config/intellij-idea-inspections.xml | 5 | ||||
-rw-r--r-- | config/pmd-test.xml | 1 | ||||
-rw-r--r-- | config/pmd.xml | 4 | ||||
-rw-r--r-- | config/suppressions-xpath.xml | 21 | ||||
-rw-r--r-- | config/suppressions.xml | 16 | ||||
-rw-r--r-- | config/version-number-rules.xml | 31 |
11 files changed, 141 insertions, 30 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/catalog.xml b/config/catalog.xml index 896f017a7..20ce70769 100644 --- a/config/catalog.xml +++ b/config/catalog.xml @@ -8,7 +8,9 @@ <system systemId="http://checkstyle.sourceforge.net/dtds/packages_1_0.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/packages_1_0.dtd"/> <system systemId="http://checkstyle.sourceforge.net/dtds/suppressions_1_0.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/suppressions_1_0.dtd"/> <system systemId="http://checkstyle.sourceforge.net/dtds/suppressions_1_1.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/suppressions_1_1.dtd"/> + <system systemId="http://checkstyle.sourceforge.net/dtds/suppressions_1_2.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/suppressions_1_2.dtd"/> <system systemId="http://checkstyle.sourceforge.net/dtds/suppressions_1_1_xpath_experimental.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/suppressions_1_1_xpath_experimental.dtd"/> + <system systemId="http://checkstyle.sourceforge.net/dtds/suppressions_1_2_xpath_experimental.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/suppressions_1_2_xpath_experimental.dtd"/> <system systemId="http://checkstyle.sourceforge.net/dtds/import_control_1_0.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/checks/imports/import_control_1_0.dtd"/> <system systemId="http://checkstyle.sourceforge.net/dtds/import_control_1_1.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/checks/imports/import_control_1_1.dtd"/> <system systemId="http://checkstyle.sourceforge.net/dtds/import_control_1_2.dtd" uri="./../src/main/resources/com/puppycrawl/tools/checkstyle/checks/imports/import_control_1_2.dtd"/> diff --git a/config/checkstyle_checks.xml b/config/checkstyle_checks.xml index c94e8f5c9..1f5dce734 100644 --- a/config/checkstyle_checks.xml +++ b/config/checkstyle_checks.xml @@ -35,6 +35,15 @@ <property name="file" value="${checkstyle.suppressions.file}"/> </module> <module name="SuppressWarningsFilter"/> + <module name="SuppressWithPlainTextCommentFilter"> + <!-- + 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> <!-- Headers --> <module name="Header"> @@ -312,6 +321,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/findbugs-exclude.xml b/config/findbugs-exclude.xml index 0f4b8a21f..e9898d1df 100644 --- a/config/findbugs-exclude.xml +++ b/config/findbugs-exclude.xml @@ -91,16 +91,69 @@ <Bug pattern="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE" /> </Match> <Match> - <!-- Temporary disabled. Have to deal with Javadoc nodes as well - See https://github.com/checkstyle/checkstyle/issues/3432--> - <Class name="com.puppycrawl.tools.checkstyle.gui.TreeTable" /> - <Method name="makeCodeSelection"/> - <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/> - </Match> - <Match> <!-- false-positive. Bugs reported even though casting is done only after verification using instanceof --> <Class name="com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser"/> <Method name="parseJavadocAsDetailNode"/> <Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE"/> </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.Main"/> + <Method name="loadProperties"/> + <Bug pattern="NP_NULL_PARAM_DEREF"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.PackageNamesLoader"/> + <Method name="processFile"/> + <Bug pattern="NP_NULL_PARAM_DEREF"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.PropertyCacheFile"/> + <Method name="flushAndCloseOutStream"/> + <Bug pattern="NP_NULL_PARAM_DEREF"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.PropertyCacheFile"/> + <Method name="load"/> + <Bug pattern="NP_NULL_PARAM_DEREF"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.checks.header.AbstractHeaderCheck"/> + <Method name="loadHeaderFile"/> + <Bug pattern="NP_NULL_PARAM_DEREF"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask"/> + <Method name="createOverridingProperties"/> + <Bug pattern="NP_NULL_PARAM_DEREF"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.PropertyCacheFile"/> + <Method name="persist"/> + <Bug pattern="NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.PropertyCacheFile"/> + <Method name="persist"/> + <Bug pattern="NP_NULL_PARAM_DEREF"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.checks.TranslationCheck"/> + <Method name="getTranslationKeys"/> + <Bug pattern="NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH"/> + </Match> + <Match> + <!-- false-positive. See details at https://github.com/checkstyle/checkstyle/pull/5403 --> + <Class name="com.puppycrawl.tools.checkstyle.checks.UniquePropertiesCheck"/> + <Method name="processFiltered"/> + <Bug pattern="NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH"/> + </Match> </FindBugsFilter> diff --git a/config/import-control.xml b/config/import-control.xml index 126d2fcc3..2a9ce1b7f 100644 --- a/config/import-control.xml +++ b/config/import-control.xml @@ -95,11 +95,6 @@ local-only="true"/> <allow pkg="org.antlr.v4.runtime" local-only="true"/> - <!-- allowed till https://github.com/checkstyle/checkstyle/issues/3455 --> - <allow class="com.google.common.io.Closeables" local-only="true"/> - <allow class="com.google.common.collect.ImmutableCollection" local-only="true"/> - <allow class="com.google.common.collect.ImmutableMap" local-only="true"/> - <allow class="com.puppycrawl.tools.checkstyle.Checker" local-only="true"/> <!-- allowed till https://github.com/checkstyle/checkstyle/issues/3817 --> <allow pkg="com.puppycrawl.tools.checkstyle.utils"/> @@ -120,6 +115,9 @@ <allow class="com.google.common.collect.Multiset.Entry" local-only="true"/> <allow class="com.google.common.collect.SetMultimap" local-only="true"/> + <subpackage name="imports"> + <allow class="com.puppycrawl.tools.checkstyle.XmlLoader" local-only="true"/> + </subpackage> <subpackage name="indentation"> <allow pkg="java.lang.reflect"/> </subpackage> @@ -154,9 +152,11 @@ <allow class="java.lang.ref.WeakReference" local-only="true"/> <allow class="com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent" local-only="true"/> <allow class="com.puppycrawl.tools.checkstyle.TreeWalkerFilter" local-only="true"/> + <allow class="com.puppycrawl.tools.checkstyle.XmlLoader" local-only="true"/> <disallow pkg="com\.puppycrawl\.tools\.checkstyle\.checks\.[^.]+" regex="true"/> <allow pkg="com.puppycrawl.tools.checkstyle.utils"/> <allow pkg="com.puppycrawl.tools.checkstyle.xpath"/> + <allow class="java.nio.charset.StandardCharsets" local-only="true"/> </subpackage> <subpackage name="gui" strategyOnMismatch="disallowed"> diff --git a/config/intellij-idea-inspections.xml b/config/intellij-idea-inspections.xml index c35ca4569..33d284fd8 100644 --- a/config/intellij-idea-inspections.xml +++ b/config/intellij-idea-inspections.xml @@ -3,8 +3,7 @@ <option name="myName" value="Checkstyle" /> <inspection_tool class="AbsoluteAlignmentInUserInterface" enabled="true" level="ERROR" enabled_by_default="true" /> <inspection_tool class="AbstractBeanReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true" /> - <!-- till https://github.com/checkstyle/checkstyle/issues/4716 --> - <inspection_tool class="AbstractClassExtendsConcreteClass" enabled="false" level="ERROR" enabled_by_default="false" /> + <inspection_tool class="AbstractClassExtendsConcreteClass" enabled="true" level="ERROR" enabled_by_default="true" /> <inspection_tool class="AbstractClassNamingConvention" enabled="true" level="WARNING" enabled_by_default="true"> <option name="m_regex" value="[A-Z][A-Za-z\d]*|Check" /> <option name="m_minLength" value="5" /> @@ -2091,8 +2090,6 @@ isolated classes and we cannot put them to separate package as it will affect us See https://github.com/checkstyle/checkstyle/issues/2285--> <option value="ProhibitedExceptionThrown" /> <option value="MismatchedQueryAndUpdateOfCollection" /> - <!-- Till https://github.com/checkstyle/checkstyle/issues/3066 --> - <option value="ProhibitedExceptionCaught" /> <!-- No way to split apart huge if/else branches in test. --> <option value="IfStatementWithTooManyBranches" /> <!-- we have to catch Exception in Checker and rethrow it --> diff --git a/config/pmd-test.xml b/config/pmd-test.xml index a444b6073..13141609c 100644 --- a/config/pmd-test.xml +++ b/config/pmd-test.xml @@ -94,6 +94,7 @@ | //ClassOrInterfaceDeclaration[@Image='AstRegressionTest']//MethodDeclarator[@Image='testImpossibleValid'] | //ClassOrInterfaceDeclaration[@Image='AllChecksTest']//MethodDeclarator[@Image='testAllModulesAreReferencedInConfigFile'] | //ClassOrInterfaceDeclaration[@Image='DetailASTTest']//MethodDeclarator[@Image='testTreeStructure'] + | //ClassOrInterfaceDeclaration[@Image='SuppressWithPlainTextCommentFilterTest']//MethodDeclarator[@Image='testEqualsAndHashCodeOfTagClass'] "/> </properties> </rule> diff --git a/config/pmd.xml b/config/pmd.xml index cebf840ab..01eb897c9 100644 --- a/config/pmd.xml +++ b/config/pmd.xml @@ -184,7 +184,7 @@ <properties> <!-- Can not change API --> <property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='AbstractFileSetCheck' - or @Image='AbstractCheck' or @Image='AbstractJavadocCheck' or @Image='AbstractNode']"/> + or @Image='AbstractCheck' or @Image='AbstractJavadocCheck' or @Image='AbstractNode' or @Image='AbstractViolationReporter']"/> </properties> </rule> @@ -264,7 +264,7 @@ <rule ref="rulesets/java/naming.xml/AbstractNaming"> <properties> <!-- We can not brake compatibility with previous versions --> - <property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='AbstractClassNameCheck']"/> + <property name="violationSuppressXPath" value="//ClassOrInterfaceDeclaration[@Image='AbstractClassNameCheck' or @Image='AutomaticBean']"/> </properties> </rule> <rule ref="rulesets/java/naming.xml/LongVariable"> 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 1273406df..aeb9c3300 100644 --- a/config/suppressions.xml +++ b/config/suppressions.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!DOCTYPE suppressions PUBLIC - "-//Puppy Crawl//DTD Suppressions 1.1//EN" - "http://checkstyle.sourceforge.net/dtds/suppressions_1_1.dtd"> + "-//Puppy Crawl//DTD Suppressions 1.2//EN" + "http://checkstyle.sourceforge.net/dtds/suppressions_1_2.dtd"> <suppressions> <suppress checks="FileLength" @@ -21,14 +21,12 @@ files="AbstractClassNameCheck.java"/> <!-- test should be named as their main class --> <suppress checks="AbstractClassNameCheck" - files="AbstractCheckTest.java|AbstractClassNameCheckTest.java|AbstractTypeAwareCheckTest.java|AbstractJavadocCheckTest.java|AbstractViolationReporterTest.java|AbstractFileSetCheckTest.java|AbstractLoaderTest.java|AbstractNodeTest.java"/> + 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 checks="Javadoc" files=".*[\\/]src[\\/](test|it)[\\/]"/> + <suppress message="Missing a Javadoc comment|Missing package-info.java file|Expected @throws tag for|missing an @author tag" files=".*[\\/]src[\\/](test|it)[\\/]"/> <suppress checks="MagicNumber" files=".*[\\/]src[\\/](test|it)[\\/]"/> <suppress checks="AvoidStaticImport" files=".*[\\/]src[\\/](test|it)[\\/]"/> <suppress checks="ClassDataAbstractionCoupling" files="[\\/]IndentationCheckTest.java$|[\\/]SuppressWithNearbyCommentFilterTest.java$|[\\/]SuppressionCommentFilterTest.java|[\\/]DetailASTTest.java$"/> @@ -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> diff --git a/config/version-number-rules.xml b/config/version-number-rules.xml new file mode 100644 index 000000000..ab7b21a73 --- /dev/null +++ b/config/version-number-rules.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + comparisonMethod="maven" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 https://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd"> + + <ignoreVersions> + <ignoreVersion type="regex">.*[-_\.](alpha|Alpha|ALPHA|beta|Beta|BETA|rc|RC|M|EA)[-_\.]?[0-9]?.*</ignoreVersion> + </ignoreVersions> + <rules> + <rule groupId="com.google.guava" artifactId="guava"> + <ignoreVersions> + <ignoreVersion type="regex">.*-android</ignoreVersion> + </ignoreVersions> + </rule> + <rule groupId="antlr" artifactId="antlr"> + <ignoreVersions> + <!-- this is really old version before versioning become semantic --> + <ignoreVersion type="regex">20030911</ignoreVersion> + </ignoreVersions> + </rule> + <rule groupId="org.apache.maven.plugins" artifactId="maven-release-plugin"> + <ignoreVersions> + <!-- we use 2.1 version that is defined at our parent + http://central.maven.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom + It is better to use same version as in parent, we have to use such parent + to use nexus-staging-maven-plugin to deploy maven central + --> + <ignoreVersion type="regex">.*</ignoreVersion> + </ignoreVersions> + </rule> + </rules> +</ruleset> |