<?xml version="1.0"?>
<ruleset name="ActiveCampaign for WooCommerce">
    <description>Custom coding standards for the ActiveCampaign for WooCommerce Plugin</description>

    <!-- Exclude the Composer Vendor directory. -->
    <exclude-pattern>/vendor/*</exclude-pattern>

    <!-- Exclude the Composer Vendor directory. -->
    <exclude-pattern>/wp-content/*</exclude-pattern>

    <!-- Exclude the Composer Vendor directory. -->
    <exclude-pattern>/ac_vendor/*</exclude-pattern>

    <!-- Exclude the Node Modules directory. -->
    <exclude-pattern>/node_modules/*</exclude-pattern>

    <!-- Exclude minified Javascript files. -->
    <exclude-pattern>*.min.js</exclude-pattern>

    <!-- Exclude our .github folder -->
    <exclude-pattern>./.github/*</exclude-pattern>

    <!-- Exclude our tests folder -->
    <exclude-pattern>./tests/*</exclude-pattern>

    <!-- Exclude our js-tests folder -->
    <exclude-pattern>./js-tests/*</exclude-pattern>

    <!-- Exclude our js and scss folder -->
    <exclude-pattern>./admin/src/*</exclude-pattern>

    <!-- Exclude our karma and webpack config -->
    <exclude-pattern>./admin/css/*</exclude-pattern>

    <!-- Exclude our karma and webpack config -->
    <exclude-pattern>./admin/js/*</exclude-pattern>

    <!-- Exclude our karma and webpack config -->
    <exclude-pattern>./*.js</exclude-pattern>

    <!-- Exclude our coverage report -->
    <exclude-pattern>./coverage/*</exclude-pattern>


    <!-- Include the WordPress-Extra standard. -->
    <rule ref="WordPress-Extra"/>

    <!-- Let's also check that everything is properly documented. -->
    <rule ref="WordPress-Docs"/>

    <!-- Add in some extra rules from other standards. -->
    <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
    <rule ref="Generic.Commenting.Todo"/>

    <!-- Check for PHP cross-version compatibility. -->
    <config name="testVersion" value="7.1-"/>
    <rule ref="PHPCompatibility"/>

    <rule ref="Squiz.Commenting.ClassComment">
        <exclude name="Squiz.Commenting.ClassComment.Missing" />
    </rule>

    <!-- Turn off some weird Squiz rules -->
    <rule ref="Squiz.Commenting.ClassComment">
        <exclude name="Squiz.Commenting.ClassComment.Missing" />
    </rule>

    <rule ref="Squiz.Commenting.FileComment">
        <exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen"/>
        <exclude name="Squiz.Commenting.FileComment.WrongStyle"/>
        <exclude name="Squiz.Commenting.FileComment.Missing"/>
        <exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
        <exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
        <exclude name="Squiz.Commenting.FunctionComment.Missing"/>
        <exclude name="Squiz.Commenting.ClassComment.SpacingAfter"/>
        <exclude name="Squiz.Commenting.FunctionCommentThrowTag.Missing"/>
        <exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/>
        <exclude name="Squiz.Commenting.FileComment.SpacingAfterComment"/>
    </rule>

    <rule ref="Generic.Commenting.DocComment">
        <exclude name="Generic.Commenting.DocComment.MissingShort" />
        <exclude name="Generic.Commenting.DocComment.ShortNotCapital"/>
    </rule>

    <rule ref="Squiz.PHP.CommentedOutCode">
        <exclude name="Squiz.PHP.CommentedOutCode.Found"/>
    </rule>

    <rule ref="Squiz.Commenting.InlineComment">
        <exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
    </rule>

    <rule ref="WordPress">
        <exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
    </rule>

    <rule ref="WordPress.WhiteSpace.PrecisionAlignment">
        <exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found"/>
    </rule>

    <rule ref="Generic.CodeAnalysis.EmptyStatement">
        <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
    </rule>

    <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
        <exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.Found"/>
    </rule>

    <rule ref="WordPress.Security.NonceVerification">
        <exclude name="WordPress.Security.NonceVerification.NoNonceVerification"/>
    </rule>

    <rule ref="WordPress.PHP.DevelopmentFunctions">
        <exclude name="WordPress.PHP.DevelopmentFunctions.error_log_error_log"/>
    </rule>

    <rule ref="Generic.Arrays.DisallowShortArraySyntax">
        <exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
    </rule>

    <!--
    To get the optimal benefits of using WPCS, we should add a couple of
    custom properties.
    Adjust the values of these properties to fit our needs.

    For information on additional custom properties available, check out
    the wiki:
    https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
    -->
    <config name="minimum_supported_wp_version" value="4.6"/>

    <rule ref="WordPress.WP.I18n">
        <properties>
            <property name="text_domain" type="array" value="activecampaign"/>
        </properties>
    </rule>

    <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
        <properties>
            <property name="prefixes" type="array" value="activecampaign_for_woocommerce"/>
        </properties>
    </rule>

    <rule ref="WordPress.WP.I18n">
        <exclude name="WordPress.WP.I18n.NonSingularStringLiteralDomain" />
    </rule>

    <rule ref="WordPress.Security.EscapeOutput">
        <properties>
            <property name="customAutoEscapedFunctions" value="activecampaign_for_woocommerce_print_variable" type="array" />
        </properties>
    </rule>



</ruleset>
