chore: revert Lavalink timeout to 30s, add PMD + stricter checkstyle
- LavalinkManager: httpTimeout back to 30s (stagger delays are the real fix) - checkstyle: comprehensive ruleset from LoParkour (200-line files, complexity, naming) - PMD: ruleset with CognitiveComplexity, CloseResource, TooManyMethods etc - Both tools run with ignoreFailures=true (warnings only, don't block build)
This commit is contained in:
parent
10acbc5ecb
commit
74be4214aa
5 changed files with 208 additions and 186 deletions
|
|
@ -1,95 +1,45 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset name="LokiBot PMD Rules"
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="Loki Bot PMD rules"
|
||||
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">
|
||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||
|
||||
<description>PMD rules for Loki Discord Bot</description>
|
||||
<description>
|
||||
PMD rules complementing checkstyle. Adds checks checkstyle does not
|
||||
cover: resource leaks, string ==, empty control flow, god-class/size
|
||||
hints and complexity.
|
||||
UnusedImports is excluded (handled by checkstyle).
|
||||
</description>
|
||||
|
||||
<rule ref="category/java/bestpractices.xml">
|
||||
<exclude name="AbstractClassWithoutAbstractMethod" />
|
||||
<exclude name="AccessorMethodGeneration" />
|
||||
<exclude name="ArrayIsStoredDirectly" />
|
||||
<exclude name="GuardLogStatement" />
|
||||
<exclude name="JUnitAssertionsShouldIncludeMessage" />
|
||||
<exclude name="JUnitTestContainsTooManyAsserts" />
|
||||
<exclude name="JUnitTestsShouldIncludeAssert" />
|
||||
<exclude name="MethodReturnsInternalArray" />
|
||||
<exclude name="PreserveStackTrace" />
|
||||
<exclude name="SystemPrintln" />
|
||||
<exclude name="UseVarargs" />
|
||||
<!-- ===== bugs / error-prone ===== -->
|
||||
<rule ref="category/java/errorprone.xml/EmptyCatchBlock"/>
|
||||
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings"/>
|
||||
<rule ref="category/java/errorprone.xml/CloseResource"/>
|
||||
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals"/>
|
||||
|
||||
<!-- ===== dead code ===== -->
|
||||
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"/>
|
||||
<rule ref="category/java/codestyle.xml/UnnecessaryImport"/>
|
||||
<rule ref="category/java/bestpractices.xml/AvoidReassigningParameters"/>
|
||||
|
||||
<!-- ===== complexity ===== -->
|
||||
<rule ref="category/java/design.xml/CyclomaticComplexity">
|
||||
<properties>
|
||||
<property name="methodReportLevel" value="15"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="category/java/design.xml/CognitiveComplexity">
|
||||
<properties>
|
||||
<property name="reportLevel" value="15"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/codestyle.xml">
|
||||
<exclude name="AtLeastOneConstructor" />
|
||||
<exclude name="AvoidFinalLocalVariable" />
|
||||
<exclude name="CallSuperInConstructor" />
|
||||
<exclude name="ClassNamingConventions" />
|
||||
<exclude name="CommentDefaultAccessModifier" />
|
||||
<exclude name="DefaultPackage" />
|
||||
<exclude name="FieldDeclarationsShouldBeAtStartOfClass" />
|
||||
<exclude name="LinguisticNaming" />
|
||||
<exclude name="LocalVariableCouldBeFinal" />
|
||||
<exclude name="LongVariable" />
|
||||
<exclude name="MethodNamingConventions" />
|
||||
<exclude name="OnlyOneReturn" />
|
||||
<exclude name="ShortClassName" />
|
||||
<exclude name="ShortMethodName" />
|
||||
<exclude name="ShortVariable" />
|
||||
<exclude name="TooManyStaticImports" />
|
||||
<exclude name="UnnecessaryAnnotationValueElement" />
|
||||
<exclude name="UseExplicitTypes" />
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/design.xml">
|
||||
<exclude name="AvoidRethrowingException" />
|
||||
<exclude name="AvoidThrowingNullPointerException" />
|
||||
<exclude name="AvoidThrowingRawExceptionTypes" />
|
||||
<exclude name="CouplingBetweenObjects" />
|
||||
<exclude name="CyclomaticComplexity" />
|
||||
<exclude name="DataClass" />
|
||||
<exclude name="ExcessiveImports" />
|
||||
<exclude name="ExcessivePublicCount" />
|
||||
<exclude name="GodClass" />
|
||||
<exclude name="LawOfDemeter" />
|
||||
<exclude name="LoosePackageCoupling" />
|
||||
<exclude name="NcssCount" />
|
||||
<exclude name="NPathComplexity" />
|
||||
<exclude name="SignatureDeclareThrowsException" />
|
||||
<exclude name="SingularField" />
|
||||
<exclude name="TooManyFields" />
|
||||
<exclude name="TooManyMethods" />
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/errorprone.xml">
|
||||
<exclude name="AssignmentInOperand" />
|
||||
<exclude name="AvoidAccessibilityAlteration" />
|
||||
<exclude name="AvoidDuplicateLiterals" />
|
||||
<exclude name="AvoidFieldNameMatchingMethodName" />
|
||||
<exclude name="AvoidLiteralsInIfCondition" />
|
||||
<exclude name="CloseResource" />
|
||||
<exclude name="ConstructorCallsOverridableMethod" />
|
||||
<exclude name="DataflowAnomalyAnalysis" />
|
||||
<exclude name="DoNotTerminateVM" />
|
||||
<exclude name="EmptyCatchBlock" />
|
||||
<exclude name="MissingSerialVersionUID" />
|
||||
<exclude name="NonStaticInitializer" />
|
||||
<exclude name="NullAssignment" />
|
||||
<exclude name="ReturnEmptyArrayRatherThanNull" />
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/multithreading.xml">
|
||||
<exclude name="AvoidSynchronizedAtMethodLevel" />
|
||||
<exclude name="DoNotUseThreads" />
|
||||
<exclude name="UseConcurrentHashMap" />
|
||||
</rule>
|
||||
|
||||
<rule ref="category/java/performance.xml">
|
||||
<exclude name="AvoidInstantiatingObjectsInLoops" />
|
||||
<exclude name="AvoidFileStream" />
|
||||
<exclude name="ConsecutiveLiteralAppends" />
|
||||
<exclude name="InsufficientStringBufferDeclaration" />
|
||||
<exclude name="StringInstantiation" />
|
||||
<exclude name="TooFewBranchesForASwitchStatement" />
|
||||
<!-- ===== god-object / size hints ===== -->
|
||||
<rule ref="category/java/design.xml/TooManyFields"/>
|
||||
<rule ref="category/java/design.xml/TooManyMethods">
|
||||
<properties>
|
||||
<property name="maxmethods" value="15"/>
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue