<?xml version="1.0"?>
<ruleset name="HonestHosting Site Migrator">
    <description>Coding standards for the HonestHosting Site Migrator plugin.</description>

    <arg name="parallel" value="8"/>
    <arg name="extensions" value="php"/>
    <arg value="ps"/>

    <file>./src</file>
    <file>./honest-hosting-site-migrator.php</file>
    <file>./uninstall.php</file>

    <exclude-pattern>./vendor/*</exclude-pattern>
    <exclude-pattern>./tests/*</exclude-pattern>
    <exclude-pattern>./build/*</exclude-pattern>
    <exclude-pattern>./.phpunit.cache/*</exclude-pattern>

    <rule ref="WordPress"/>
    <rule ref="WordPress-Extra"/>
    <rule ref="WordPress-Docs"/>
    <rule ref="WordPress-VIP-Go"/>
    <rule ref="PHPCompatibilityWP"/>

    <config name="testVersion" value="8.0-"/>
    <config name="minimum_wp_version" value="6.7"/>

    <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
        <properties>
            <property name="prefixes" type="array">
                <element value="HH_MIGRATOR"/>
                <element value="hh_migrator"/>
                <element value="honest_hosting_site_migrator"/>
                <element value="HonestHosting\SiteMigrator"/>
            </property>
        </properties>
    </rule>

    <rule ref="WordPress.WP.I18n">
        <properties>
            <property name="text_domain" type="array">
                <element value="honest-hosting-site-migrator"/>
            </property>
        </properties>
    </rule>

    <!-- Allow PSR-4 class file naming (CamelCase required by autoloader) -->
    <rule ref="WordPress.Files.FileName">
        <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
        <exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
    </rule>

    <!-- Allow short array syntax -->
    <rule ref="Generic.Arrays.DisallowShortArraySyntax.Found">
        <severity>0</severity>
    </rule>

    <rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
        <severity>0</severity>
    </rule>

    <!--
        Suppress WordPress VIP-specific rules.
        This plugin runs on customer shared hosting, not WordPress VIP infrastructure.
        VIP filesystem, caching, and HTTP restrictions do not apply.
    -->
    <rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get">
        <severity>0</severity>
    </rule>
    <rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents">
        <severity>0</severity>
    </rule>
    <rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_rename">
        <severity>0</severity>
    </rule>
    <rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_unlink">
        <severity>0</severity>
    </rule>
    <rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.directory_rmdir">
        <severity>0</severity>
    </rule>
    <rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules">
        <severity>0</severity>
    </rule>
    <rule ref="WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown">
        <severity>0</severity>
    </rule>

    <!-- Uninstall.php runs in global scope — variable prefixing is not meaningful there -->
    <rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound">
        <exclude-pattern>uninstall.php</exclude-pattern>
    </rule>

    <!-- DB schema changes are intentional (log table, uninstall cleanup) -->
    <rule ref="WordPress.DB.DirectDatabaseQuery.SchemaChange">
        <severity>0</severity>
    </rule>
</ruleset>
