<?xml version="1.0"?>
<ruleset name="Licentia PHPMD Ruleset"
         xmlns="https://pmd.github.io/pmd-6.0.0/ruleset"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="https://pmd.github.io/pmd-6.0.0/ruleset https://pmd.github.io/pmd-6.0.0/ruleset_6_0_0.xsd"
         xsi:noNamespaceSchemaLocation="https://pmd.github.io/pmd-6.0.0/ruleset_6_0_0.xsd">

    <description>
        PHPMD rules for modern Laravel 11 / Filament 4 projects.
        Focus: clarity, maintainability, and architectural hygiene without over-penalizing expressive syntax.
    </description>

    <!-- === CODE SIZE & COMPLEXITY === -->
    <rule ref="rulesets/codesize.xml">
        <exclude name="CyclomaticComplexity"/>
        <exclude name="ExcessiveMethodLength"/>
        <exclude name="ExcessiveParameterList"/>
        <exclude name="ExcessiveClassLength"/>
    </rule>

    <rule ref="rulesets/codesize.xml/CyclomaticComplexity">
        <properties>
            <property name="reportLevel" value="15"/> <!-- default 10 -->
        </properties>
    </rule>

    <rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
        <properties>
            <property name="minimum" value="100"/> <!-- allow longer Laravel methods -->
        </properties>
    </rule>

    <!-- === NAMING CONVENTIONS === -->
    <rule ref="rulesets/naming.xml">
        <exclude name="ShortVariable"/>
        <exclude name="LongVariable"/>
        <exclude name="ShortMethodName"/>
    </rule>

    <rule ref="rulesets/naming.xml/ShortVariable">
        <properties>
            <property name="minimum" value="2"/>
        </properties>
    </rule>

    <!-- === DESIGN === -->
    <rule ref="rulesets/design.xml">
        <exclude name="CouplingBetweenObjects"/>
        <exclude name="TooManyPublicMethods"/>
    </rule>

    <rule ref="rulesets/design.xml/CouplingBetweenObjects">
        <properties>
            <property name="maximum" value="20"/> <!-- Laravel classes often inject multiple services -->
        </properties>
    </rule>

    <!-- === UNUSED / UNNECESSARY === -->
    <rule ref="rulesets/unusedcode.xml"/>

    <!-- === CLEAN CODE === -->
    <rule ref="rulesets/cleancode.xml">
        <exclude name="BooleanArgumentFlag"/> <!-- allow boolean flags in helpers -->
    </rule>

    <!-- === CONTROVERSIAL === -->
    <rule ref="rulesets/controversial.xml">
        <exclude name="CamelCaseClassName"/>
        <exclude name="CamelCaseMethodName"/>
        <exclude name="CamelCaseParameterName"/>
        <exclude name="CamelCaseVariableName"/>
    </rule>

    <!-- === LARAVEL EXCLUSIONS === -->
    <exclude-pattern>*/database/*</exclude-pattern>
    <exclude-pattern>*/tests/*</exclude-pattern>
    <exclude-pattern>*/resources/*</exclude-pattern>
    <exclude-pattern>*/bootstrap/*</exclude-pattern>
    <exclude-pattern>*/storage/*</exclude-pattern>
    <exclude-pattern>*/vendor/*</exclude-pattern>

</ruleset>
