Files
java-word-pdf/pmd-ruleset.xml
T
Pjandro 0b2dda8caa
PR checks / web (pull_request) Successful in 1m9s
PR checks / java (pull_request) Successful in 1m17s
Main: tests, deploy, autotests / web (push) Successful in 34s
Main: tests, deploy, autotests / images-web (push) Successful in 38s
Main: tests, deploy, autotests / java (push) Successful in 2m36s
Main: tests, deploy, autotests / images-app (push) Successful in 42s
Main: tests, deploy, autotests / deploy (push) Successful in 2m7s
Main: tests, deploy, autotests / autotests (push) Successful in 45s
Main: tests, deploy, autotests / rollback (push) Has been skipped
PMD: слияние новых правил (bestpractices/design/errorprone/multithreading) + правка нарушений без подавлений
2026-11-13 01:24:25 +03:00

96 lines
5.0 KiB
XML

<?xml version="1.0"?>
<ruleset name="WordPDF code style" 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>Код-стиль java-word-pdf: codestyle без opinionated-правил, unused-правила,
NPE-safe сравнения, гигиена ошибок/ресурсов/многопоточности. Нарушения чинятся
кодом — подавление @SuppressWarnings("PMD…") и // NOPMD запрещены.</description>
<!-- ==================== codestyle ==================== -->
<rule ref="category/java/codestyle.xml">
<!-- opinionated/шумные, намеренно выключены -->
<exclude name="AtLeastOneConstructor"/>
<exclude name="CallSuperInConstructor"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="ConfusingTernary"/>
<exclude name="FieldDeclarationsShouldBeAtStartOfClass"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="OnlyOneReturn"/>
<exclude name="PrematureDeclaration"/>
<exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/>
<exclude name="UseExplicitTypes"/>
<exclude name="UseUnderscoresInNumericLiterals"/>
<!-- переопределены ниже -->
<exclude name="MethodNamingConventions"/>
<exclude name="TooManyStaticImports"/>
<exclude name="ControlStatementBraces"/>
<exclude name="UnnecessaryImport"/>
</rule>
<!-- регрессионные тесты репо именуются объект_условие (AGENTS.md) -->
<rule ref="category/java/codestyle.xml/MethodNamingConventions">
<properties>
<property name="junit5TestPattern" value="^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$"/>
</properties>
</rule>
<!-- MockMvc-тесты: >4 статических импортов — норма -->
<rule ref="category/java/codestyle.xml/TooManyStaticImports">
<properties>
<property name="maximumStaticImports" value="12"/>
</properties>
</rule>
<rule ref="category/java/codestyle.xml/UnnecessaryImport"/>
<!-- case без скобок — норма для этого стиля; true, если строже -->
<rule ref="category/java/codestyle.xml/ControlStatementBraces">
<properties>
<property name="checkCaseStmt" value="false"/>
</properties>
</rule>
<!-- ==================== bestpractices ==================== -->
<rule ref="category/java/bestpractices.xml/UnusedAssignment"/>
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter"/>
<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/ForLoopCanBeForeach">
<priority>2</priority>
</rule>
<rule ref="category/java/bestpractices.xml/AvoidPrintStackTrace"/>
<rule ref="category/java/bestpractices.xml/SystemPrintln"/>
<!-- NPE-safe порядок операндов: литерал/константа слева. Заменило кастомное
XPath-правило LiteralFirstInEquals: штатное правило строго шире (константа
справа — тоже нарушение, плюс ==/!= по строкам). -->
<rule ref="category/java/bestpractices.xml/LiteralsFirstInComparisons"/>
<!-- ==================== design ==================== -->
<rule ref="category/java/design.xml/ExceptionAsFlowControl"/>
<!-- ==================== errorprone ==================== -->
<!-- null вместо пустой коллекции запрещён (priority 1 по умолчанию — валит verify) -->
<rule ref="category/java/errorprone.xml/ReturnEmptyCollectionRatherThanNull"/>
<!-- литералы в условиях if — только именованными константами -->
<rule ref="category/java/errorprone.xml/AvoidLiteralsInIfCondition"/>
<rule ref="category/java/errorprone.xml/EmptyCatchBlock">
<priority>2</priority>
</rule>
<rule ref="category/java/errorprone.xml/EqualsNull"/>
<rule ref="category/java/errorprone.xml/CloseResource"/>
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
<rule ref="category/java/errorprone.xml/AvoidCatchingNPE"/>
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic"/>
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals"/>
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
<rule ref="category/java/errorprone.xml/ImplicitSwitchFallThrough"/>
<!-- ==================== multithreading ==================== -->
<rule ref="category/java/multithreading.xml/UnsynchronizedStaticFormatter"/>
</ruleset>