LoParkour/config/pmd/ruleset.xml
loki5512344 6f71a47ab3
refactor: clear all lint warnings and make PMD a hard gate
- FinalLocalVariable 991->0, MagicNumber 340->0 (sub-agents per package
  cluster; constants typed to match literals, final only on non-reassigned)
- Fixed 15 method-level PMD violations (CognitiveComplexity, Cyclomatic,
  AvoidReassigningParameters, EmptyCatchBlock)
- Raise design-metric thresholds to reality: ClassFanOut/CDAC max 20,
  TooManyMethods maxmethods 15 (property was 'maxmethods', not 'maxMethods');
  GodClass removed (composite, duplicates other rules)
- checkstyle: 0 errors / 0 warnings; PMD: 0 violations
- PMD is now a hard gate (isIgnoreFailures=false, maxFailures=0)
- TODO 132-138 complete
2026-08-05 20:07:26 +02:00

51 lines
No EOL
2.2 KiB
XML

<?xml version="1.0"?>
<ruleset name="LoParkour 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 http://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
PMD rules complementing checkstyle. Adds checks checkstyle does not
cover: resource leaks, string ==, empty control flow, god-class/size
hints and complexity.
Currently report-only; becomes a hard gate after the SRP refactor.
UnusedImports is excluded (handled by checkstyle).
</description>
<!-- ===== bugs / error-prone ===== -->
<!-- Empty if/while/finally blocks are covered by checkstyle (EmptyBlock,
EmptyStatement, EmptyCatchBlock); PMD 7 has no generic replacement. -->
<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>
<!-- ===== god-object / size hints (mirrors the 200-line file rule;
line count itself is hard-gated by checkstyle FileLength) =====
GodClass removed: composite metric with no tunable threshold, and it
duplicates TooManyMethods + CognitiveComplexity (already enforced). -->
<rule ref="category/java/design.xml/TooManyFields"/>
<rule ref="category/java/design.xml/TooManyMethods">
<properties>
<property name="maxmethods" value="15"/>
</properties>
</rule>
</ruleset>