<?xml version="1.0"?>
<ruleset name="Checkout.com WooCommerce Plugin">
    <description>Custom ruleset for Checkout.com WooCommerce Plugin</description>

    <!-- What to scan -->
    <file>.</file>

    <!-- Exclude paths -->
    <exclude-pattern>/vendor/*</exclude-pattern>
    <exclude-pattern>/node_modules/*</exclude-pattern>
    <exclude-pattern>/e2e-tests/*</exclude-pattern>
    <exclude-pattern>/tests/*</exclude-pattern>
    <exclude-pattern>*.min.js</exclude-pattern>
    <exclude-pattern>*.min.css</exclude-pattern>

    <!-- How to scan -->
    <arg value="sp"/> <!-- Show sniff and progress -->
    <arg name="basepath" value="."/>
    <arg name="colors"/>
    <arg name="extensions" value="php"/>
    <arg name="parallel" value="8"/>

    <!-- Rules: WordPress Coding Standards -->
    <rule ref="WordPress">
        <!-- Exclude some rules that are too strict for this project -->
        <exclude name="WordPress.Files.FileName"/>
        <exclude name="WordPress.NamingConventions.ValidVariableName"/>
        <exclude name="WordPress.NamingConventions.ValidFunctionName"/>
        <exclude name="WordPress.PHP.YodaConditions"/>
        <exclude name="Generic.Commenting.DocComment"/>
        <exclude name="Squiz.Commenting"/>
    </rule>

    <!-- Security-focused rules (HIGH PRIORITY) -->
    <rule ref="WordPress.Security.EscapeOutput">
        <type>error</type>
    </rule>
    <rule ref="WordPress.Security.NonceVerification">
        <type>error</type>
    </rule>
    <rule ref="WordPress.Security.ValidatedSanitizedInput">
        <type>error</type>
    </rule>
    <rule ref="WordPress.DB.PreparedSQL">
        <type>error</type>
    </rule>
    <rule ref="WordPress.DB.PreparedSQLPlaceholders">
        <type>error</type>
    </rule>

    <!-- PHP Compatibility -->
    <config name="testVersion" value="7.4-"/>
    
    <!-- Minimum supported WordPress version -->
    <config name="minimum_wp_version" value="5.6"/>
</ruleset>
