Added PMD & rules
This commit is contained in:
parent
ffe05f5b2e
commit
a32fde02d0
5 changed files with 134 additions and 1 deletions
8
.idea/misc.xml
generated
8
.idea/misc.xml
generated
|
@ -1,5 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<pattern value="rife2.render.Capitalize" />
|
||||
<pattern value="rife2.render.Lowercase" />
|
||||
<pattern value="rife2.render.SwapCase" />
|
||||
<pattern value="rife2.render.Trim" />
|
||||
<pattern value="rife2.render.Uncapitalize" />
|
||||
<pattern value="rife2.render.Uppercase" />
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="PDMPlugin">
|
||||
<option name="skipTestSources" value="false" />
|
||||
|
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -3,6 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
|
|||
|
||||
plugins {
|
||||
`java-library`
|
||||
pmd
|
||||
id("com.github.ben-manes.versions") version "0.46.0"
|
||||
}
|
||||
|
||||
|
@ -40,6 +41,13 @@ java {
|
|||
}
|
||||
}
|
||||
|
||||
pmd {
|
||||
isIgnoreFailures = true
|
||||
ruleSetFiles = files("${projectDir}/config/pmd.xml")
|
||||
isConsoleOutput = true
|
||||
}
|
||||
|
||||
|
||||
tasks {
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
|
|
112
lib/config/pmd.xml
Normal file
112
lib/config/pmd.xml
Normal file
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset name="erik"
|
||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
<description>Erik's Ruleset</description>
|
||||
<!-- BEST PRACTICES -->
|
||||
<rule ref="category/java/bestpractices.xml">
|
||||
<exclude name="AvoidPrintStackTrace"/>
|
||||
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
|
||||
<exclude name="JUnitTestContainsTooManyAsserts"/>
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
||||
<properties>
|
||||
<property name="violationSuppressXPath"
|
||||
value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
|
||||
<!-- CODE STYLE -->
|
||||
<rule ref="category/java/codestyle.xml">
|
||||
<exclude name="AtLeastOneConstructor"/>
|
||||
<exclude name="ClassNamingConventions"/>
|
||||
<exclude name="CommentDefaultAccessModifier"/>
|
||||
<exclude name="ConfusingTernary"/>
|
||||
<exclude name="DefaultPackage"/>
|
||||
<exclude name="FieldNamingConventions"/>
|
||||
<exclude name="LocalVariableCouldBeFinal"/>
|
||||
<exclude name="LongVariable"/>
|
||||
<exclude name="MethodArgumentCouldBeFinal"/>
|
||||
<exclude name="OnlyOneReturn"/>
|
||||
<exclude name="PackageCase"/>
|
||||
<exclude name="ShortClassName"/>
|
||||
<exclude name="ShortMethodName"/>
|
||||
<exclude name="ShortVariable"/>
|
||||
<exclude name="UselessParentheses"/>
|
||||
<exclude name="UseUnderscoresInNumericLiterals"/>
|
||||
</rule>
|
||||
|
||||
<!-- DESIGN -->
|
||||
<rule ref="category/java/design.xml">
|
||||
<exclude name="AvoidCatchingGenericException"/>
|
||||
<exclude name="AvoidDeeplyNestedIfStmts"/>
|
||||
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
||||
<exclude name="CognitiveComplexity"/>
|
||||
<exclude name="CyclomaticComplexity"/>
|
||||
<exclude name="ExcessiveClassLength"/>
|
||||
<exclude name="ExcessiveMethodLength"/>
|
||||
<exclude name="ExcessiveParameterList"/>
|
||||
<exclude name="ExcessivePublicCount"/>
|
||||
<exclude name="GodClass"/>
|
||||
<exclude name="LawOfDemeter"/>
|
||||
<exclude name="LoosePackageCoupling"/>
|
||||
<exclude name="NPathComplexity"/>
|
||||
<exclude name="NcssCount"/>
|
||||
<exclude name="TooManyFields"/>
|
||||
<exclude name="TooManyMethods"/>
|
||||
<exclude name="UseObjectForClearerAPI"/>
|
||||
</rule>
|
||||
|
||||
<!-- DOCUMENTATION -->
|
||||
<rule ref="category/java/documentation.xml">
|
||||
<exclude name="CommentRequired"/>
|
||||
<exclude name="CommentSize"/>
|
||||
</rule>
|
||||
|
||||
<!-- ERROR PRONE -->
|
||||
<rule ref="category/java/errorprone.xml">
|
||||
<exclude name="AssignmentInOperand"/>
|
||||
<exclude name="AvoidCatchingNPE"/>
|
||||
<exclude name="AvoidDuplicateLiterals"/>
|
||||
<exclude name="AvoidFieldNameMatchingMethodName"/>
|
||||
<exclude name="AvoidFieldNameMatchingTypeName"/>
|
||||
<exclude name="AvoidLiteralsInIfCondition"/>
|
||||
<exclude name="EmptyCatchBlock"/>
|
||||
<exclude name="NullAssignment"/>
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
|
||||
<properties>
|
||||
<property name="allowWhile" value="true"/>
|
||||
<property name="allowFor" value="true"/>
|
||||
<property name="allowIf" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
|
||||
<properties>
|
||||
<property name="skipAnnotations" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="category/java/errorprone.xml/EmptyCatchBlock">
|
||||
<properties>
|
||||
<property name="allowExceptionNameRegex">
|
||||
<value>^ignore$</value>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- MULTITHREADING -->
|
||||
<rule ref="category/java/multithreading.xml">
|
||||
</rule>
|
||||
|
||||
<!-- PERFORMANCE -->
|
||||
<rule ref="category/java/performance.xml">
|
||||
</rule>
|
||||
|
||||
<!-- SECURITY -->
|
||||
<rule ref="category/java/security.xml">
|
||||
</rule>
|
||||
</ruleset>
|
|
@ -21,7 +21,6 @@ import rife.template.Template;
|
|||
import rife.template.ValueRenderer;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p>Capitalizes a template value.</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue