3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 03:06:23 +00:00
Files
snipe-it/phpmd-ruleset.xml

48 lines
2.1 KiB
XML

<?xml version="1.0"?>
<ruleset name="Snipe-IT PHPMD Ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Targeted PHPMD rules for the classes of finding PHPStan doesn't cover.
Scoped narrowly on purpose: broad PHPMD rulesets create thousands of
style-level warnings on a large Laravel codebase. This one focuses on
the concrete gap (unused code) so signal stays useful and CI stays fast.
</description>
<!--
UnusedFormalParameter — catches method parameters that get declared but
never referenced in the body. This is the specific rule that flagged
adjustQuantityRedirect's dead $model argument.
-->
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
<!--
UnusedLocalVariable — variables assigned then never read. Almost always
a copy-paste artifact or a refactor that left a dead handle behind.
-->
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
<!--
UnusedPrivateMethod — private methods with no call sites in the same
class. Public methods are excluded because they're part of an API
contract that could be called from outside the class.
-->
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
<!--
UnusedPrivateField — private properties never read or written. Public
properties excluded for the same reason as above.
-->
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
<!--
Exclude paths that would generate too much noise for the value they
add. Migrations use $table parameters in closures that PHPMD doesn't
always track through; tests deliberately declare unused arguments to
satisfy PHPUnit provider signatures; vendor is not our code.
-->
<exclude-pattern>database/migrations/*</exclude-pattern>
<exclude-pattern>tests/*</exclude-pattern>
</ruleset>