<?xml version="1.0"?>
<ruleset name="ThriveDesk WordPress Plugin">
    <description>WordPress Coding Standards for the ThriveDesk plugin.</description>

    <file>.</file>

    <!-- Source only — skip vendor, node deps, committed built assets, and tests. -->
    <exclude-pattern>*/vendor/*</exclude-pattern>
    <exclude-pattern>*/node_modules/*</exclude-pattern>
    <exclude-pattern>*/assets/*</exclude-pattern>
    <exclude-pattern>*/tests/*</exclude-pattern>

    <!-- Legacy source is excluded while we adopt WPCS incrementally. Listed one
         path at a time rather than a blanket */src/* so the remaining debt is
         visible: bring a path clean, delete its line, and it stays enforced.
         Anything under src/ not listed here is already clean. -->
    <exclude-pattern>*/src/Admin.php</exclude-pattern>
    <exclude-pattern>*/src/Api.php</exclude-pattern>
    <exclude-pattern>*/src/RestRoute.php</exclude-pattern>
    <exclude-pattern>*/src/Assistants/*</exclude-pattern>
    <exclude-pattern>*/src/Conversations/*</exclude-pattern>
    <!-- Needs its camelCase accessors renamed to snake_case, which changes two
         call sites in src/Plugins and its test. Code change, not formatting. -->
    <exclude-pattern>*/src/Data/*</exclude-pattern>
    <exclude-pattern>*/src/Inboxes/*</exclude-pattern>
    <exclude-pattern>*/src/KnowledgeBase/*</exclude-pattern>
    <exclude-pattern>*/src/Plugins/*</exclude-pattern>
    <exclude-pattern>*/src/Services/*</exclude-pattern>
    <exclude-pattern>*/includes/*</exclude-pattern>

    <arg name="extensions" value="php"/>
    <arg name="colors"/>
    <arg value="sp"/>

    <rule ref="WordPress"/>

    <!-- PSR-4 (composer) autoloading uses CamelCase class filenames, which the
         WP hyphenated-lowercase file-name sniff cannot accommodate plugin-wide. -->
    <rule ref="WordPress.Files.FileName">
        <severity>0</severity>
    </rule>

    <!-- Entry file keeps the plugin-slug filename, the public ThriveDesk() factory, and bootstraps the class in the same file. -->
    <rule ref="WordPress.NamingConventions.ValidFunctionName">
        <exclude-pattern>thrivedesk.php</exclude-pattern>
    </rule>
    <rule ref="Universal.Files.SeparateFunctionsFromOO">
        <exclude-pattern>thrivedesk.php</exclude-pattern>
    </rule>

    <!-- Min PHP version the plugin supports (from the plugin header). -->
    <config name="testVersion" value="7.4-"/>
    <rule ref="PHPCompatibilityWP"/>

    <!-- Text domain + prefix sniffs scoped to this plugin. -->
    <rule ref="WordPress.WP.I18n">
        <properties>
            <property name="text_domain" type="array">
                <element value="thrivedesk"/>
            </property>
        </properties>
    </rule>
</ruleset>
