123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <?xml version="1.0"?>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
- <ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Default Maven PMD Plugin Ruleset" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
- <description>
- GeoTools ruleset. See https://pmd.github.io/latest/pmd_userdocs_understanding_rulesets.html
- </description>
- <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
- <rule ref="category/java/bestpractices.xml/CheckResultSet"/>
- <rule ref="category/java/bestpractices.xml/UnusedLocalVariable"/>
- <rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
- <rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"/>
- <rule ref="category/java/bestpractices.xml/SystemPrintln"/>
- <rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach" />
- <rule ref="category/java/bestpractices.xml/UseTryWithResources" >
- <description>
- Use try-with-resources to avoid memory / resources leaks.
- </description>
- <properties>
- <!-- The rule reports false positives for closeable arguments that are used -->
- <!-- closed within the method body. This suppression tries to avoid false positives for -->
- <!-- this case, until we can switch to Java 9 and just use try(variable) {...} without -->
- <!-- the need to instatiate the variable in the try -->
- <property name="violationSuppressXPath">
- <value>
- <![CDATA[
- ./FinallyStatement//Name[
- substring-after(@Image, '.') = 'close' or
- substring-after(@Image, '.') = 'closeQuietly'
- ]
- [ pmd-java:typeIs('java.lang.AutoCloseable') and
- fn:substring-before(@Image, '.') = ancestor::MethodDeclaration/MethodDeclarator//VariableDeclaratorId/@Name
- ]"/>
- ]]>
- </value>
- </property>
- </properties>
- </rule>
- <rule ref="category/java/bestpractices.xml/ReplaceHashtableWithMap" />
- <rule ref="category/java/bestpractices.xml/ReplaceVectorWithList" />
- <rule ref="category/java/bestpractices.xml/AvoidPrintStackTrace" />
- <rule ref="category/java/bestpractices.xml/MissingOverride" />
- <rule ref="category/java/bestpractices.xml/UseStandardCharsets" />
- <rule ref="category/java/performance.xml/UseArrayListInsteadOfVector" />
- <rule ref="category/java/codestyle.xml/ExtendsObject"/>
- <rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop"/>
- <rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName"/>
- <rule ref="category/java/codestyle.xml/UseDiamondOperator" />
- <rule ref="category/java/codestyle.xml/UnnecessaryReturn"/>
- <rule ref="category/java/codestyle.xml/UselessParentheses"/>
- <rule ref="category/java/codestyle.xml/UselessQualifiedThis"/>
- <rule ref="category/java/codestyle.xml/UnnecessaryCast" />
- <rule ref="category/java/codestyle.xml/IdenticalCatchBranches" />
- <rule ref="category/java/codestyle.xml/UseShortArrayInitializer" />
- <rule ref="category/java/codestyle.xml/UnnecessaryImport" />
- <rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
- <rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators"/>
- <rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
- <rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
- <rule ref="category/java/errorprone.xml/CheckSkipResult"/>
- <rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray"/>
- <rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices"/>
- <rule ref="category/java/errorprone.xml/EmptyFinallyBlock"/>
- <rule ref="category/java/errorprone.xml/EmptyIfStmt"/>
- <rule ref="category/java/errorprone.xml/EmptyInitializer"/>
- <rule ref="category/java/errorprone.xml/EmptyStatementBlock"/>
- <rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop"/>
- <rule ref="category/java/errorprone.xml/EmptySwitchStatements"/>
- <rule ref="category/java/errorprone.xml/EmptySynchronizedBlock"/>
- <rule ref="category/java/errorprone.xml/EmptyTryBlock"/>
- <rule ref="category/java/errorprone.xml/EmptyWhileStmt"/>
- <rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
- <rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
- <rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode"/>
- <rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock"/>
- <rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
- <rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary"/>
- <rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals"/>
- <rule ref="category/java/errorprone.xml/UselessOperationOnImmutable"/>
- <rule ref="category/java/errorprone.xml/CloseResource">
- <properties>
- <!-- When calling the store to close, PMD wants the full prefix before the call to -->
- <!-- the method to match, so let's try to use common var names for store ... -->
- <property name="closeTargets" value="releaseConnection,store.releaseConnection,closeQuietly,closeConnection,closeSafe,store.closeSafe,dataStore.closeSafe,getDataStore().closeSafe,close,closeResultSet,closeStmt,closeFinally,JDBCUtils.close"/>
- <property name="allowedResourceTypes" value="java.io.ByteArrayOutputStream|java.io.ByteArrayInputStream|java.io.StringWriter|java.io.CharArrayWriter|java.util.stream.Stream|java.util.stream.IntStream|java.util.stream.LongStream|java.util.stream.DoubleStream|java.io.StringReader" />
- </properties>
- </rule>
- <rule ref="category/java/multithreading.xml/AvoidThreadGroup"/>
- <rule ref="category/java/multithreading.xml/DontCallThreadRun"/>
- <rule ref="category/java/multithreading.xml/DoubleCheckedLocking"/>
- <rule ref="category/java/performance.xml/BigIntegerInstantiation"/>
- <rule ref="category/java/bestpractices.xml/PrimitiveWrapperInstantiation"/>
- <rule ref="category/java/performance.xml/StringInstantiation"/>
- <rule name="wildcards" language="java" message="No Wildcard Imports" class="net.sourceforge.pmd.lang.rule.XPathRule">
- <description>
- Don't use wildcard imports
- </description>
- <priority>3</priority>
- <properties>
- <property name="version" value="2.0"/>
- <property name="xpath">
- <value><![CDATA[
- //ImportDeclaration[@ImportedName=@PackageName]
- ]]></value>
- </property>
- </properties>
- </rule>
- <rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty" />
- <rule ref="category/java/design.xml/CognitiveComplexity">
- <properties>
- <property name="reportLevel" value="130"/>
- </properties>
- </rule>
- </ruleset>
|