<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
    <!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
    <!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
    <!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->

    <description>Starting Point Rule Set.</description>
    <version>2.1.0</version>

    <!-- Include when not specified -->
    <!-- <file>./wp-content/plugins/core</file>
    <file>./wp-content/themes/core</file> -->

    <!-- sniff both PHP and JS -->
    <arg name="extensions" value="php/PHP,js/JS,jsx/JS,ts/JS,tsx/JS" />
    <!-- Show sniff codes in all reports, and progress when running -->
    <arg value="sp" />

    <!-- Exclude paths -->
    <exclude-pattern>*/dev/*</exclude-pattern>
    <exclude-pattern>*/dist/*</exclude-pattern>
    <exclude-pattern>*/tests/*</exclude-pattern>
    <exclude-pattern>*/local-config\.php</exclude-pattern>
    <exclude-pattern>*/node_modules/*</exclude-pattern>
    <exclude-pattern>*/vendor/*</exclude-pattern>
    <exclude-pattern>*/wp/*</exclude-pattern>
    <exclude-pattern>*/lib/*</exclude-pattern>

    <config name="minimum_supported_wp_version" value="5.7.0" />

    <!-- @see https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset -->
    <config name="testVersion" value="7.0-"/>
	<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
	<rule ref="PHPCompatibilityWP"/>

    <rule ref="WordPress">
        <!-- Only target the theme and core plugin -->
        <include-pattern>*/core/*</include-pattern>
        <exclude-pattern>*/js/*</exclude-pattern>

        <exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
        <exclude name="Generic.Commenting" />
        <exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound" />
        <exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
        <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />

        <exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
        <exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
        <exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
        <exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
        <exclude name="PEAR.Functions.FunctionCallSignature.OpeningIndent" />

        <exclude name="Squiz.Commenting" />
        <exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine" />

        <exclude name="WordPress.Files.FileName.InvalidClassFileName" />
        <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
        <exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid" />
        <exclude name="WordPress.NamingConventions.ValidHookName.UseUnderscores" />
        <exclude name="WordPress.PHP.DisallowShortTernary.Found" />
        <exclude name="WordPress.Variables.GlobalVariables.OverrideProhibited" />
    </rule>

    <!-- Functions which don't require extra un-slashing and sanitization -->
    <rule ref="WordPress.Security.ValidatedSanitizedInput">
        <properties>
            <property name="customUnslashingSanitizingFunctions" type="array">

                <element value="wp_verify_nonce" />
                <element value="sn" />
            </property>
        </properties>
    </rule>
    <!-- All our own escaping functions -->
    <rule ref="WordPress.Security.EscapeOutput">
        <properties>
            <property name="customEscapingFunctions" type="array">
                <element value="es" />
            </property>
        </properties>
    </rule>

    <!-- Test against JS XXS https://vip.wordpress.com/documentation/vip-go/vip-code-review/javascript-security-best-practices/ -->
    <!-- <rule ref="WordPressVIPMinimum.JS">
        <type>error</type>
    </rule> -->

    <!-- Translations -->
    <rule ref="WordPress.WP.I18n">
        <!-- Only target the theme and core plugin -->
        <include-pattern>*/core/*</include-pattern>
        <properties>
            <property name="text_domain" type="array">
                <element value="lipe" />
            </property>
        </properties>
    </rule>
</ruleset>