<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         name="Starisian WordPress Plugin"
         xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">

  <description>
    WordPress coding standards for Starisian Technologies plugins. Includes support for Docs, I18n, and performance best practices.
  </description>

  <!-- Scan only root PHP files and src directory -->
  <file>src/</file>
  <file>sparxstar-gluon.php</file>
  <file>uninstall.php</file>

  <!-- Exclude unnecessary paths -->
  <exclude-pattern>vendor/*</exclude-pattern>
  <exclude-pattern>node_modules/*</exclude-pattern>
  <exclude-pattern>*.min.js</exclude-pattern>
  <exclude-pattern>*.js</exclude-pattern>
  <exclude-pattern>tests/*</exclude-pattern>
  <exclude-pattern>wp-assets/*</exclude-pattern>
  <exclude-pattern>assets/*</exclude-pattern>
  <exclude-pattern>data/*</exclude-pattern>
  <exclude-pattern>docs/*</exclude-pattern>
  <exclude-pattern>examples/*</exclude-pattern>
  <exclude-pattern>schemas/*</exclude-pattern>

  <!-- Basepath -->
  <arg name="basepath" value="."/>

  <!-- Parallel processing -->
  <arg name="parallel" value="8"/>

  <!-- Coding standard rules -->
  <rule ref="WordPress-Extra"/>
  <rule ref="WordPress-Docs"/>
  <rule ref="Generic.Commenting.Todo"/>

  <!-- Minimum WordPress version for compatibility checks -->
  <config name="minimum_wp_version" value="6.4"/>

  <!-- Text domain config (override per project if needed) -->
  <rule ref="WordPress.WP.I18n">
    <properties>
      <property name="text_domain" type="array">
        <element value="plugin-textdomain"/>
        <element value="sparxstar-gluon"/>
      </property>
    </properties>
  </rule>

  <!-- Global prefix enforcement -->
  <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
    <properties>
      <property name="prefixes" type="array">
        <element value="starisian"/>
        <element value="sparxstar"/>
        <element value="spx"/>
      </property>
    </properties>
  </rule>

  <!-- Allow modern PSR-4 class naming conventions -->
  <rule ref="WordPress.Files.FileName">
    <properties>
      <property name="strict_class_file_names" value="false"/>
    </properties>
    <exclude-pattern>src/*</exclude-pattern>
  </rule>

  <!-- Exclude method name validation for PSR-4 namespaced classes -->
  <rule ref="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid">
    <exclude-pattern>src/*</exclude-pattern>
    <exclude-pattern>sparxstar-gluon.php</exclude-pattern>
    <exclude-pattern>uninstall.php</exclude-pattern>
  </rule>

  <!-- Exclude variable name validation for PSR-4 classes -->
  <rule ref="WordPress.NamingConventions.ValidVariableName">
    <exclude-pattern>src/*</exclude-pattern>
    <exclude-pattern>sparxstar-gluon.php</exclude-pattern>
  </rule>

  <!-- Allow inline comments without punctuation in src/ -->
  <rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
    <exclude-pattern>src/*</exclude-pattern>
  </rule>

  <!-- Exclude doc comment requirement for private methods -->
  <rule ref="Squiz.Commenting.FunctionComment.Missing">
    <exclude-pattern>src/*</exclude-pattern>
  </rule>

  <!-- Exclude certain sniffs in test files -->
  <rule ref="WordPress.WP.GlobalVariablesOverride">
    <exclude-pattern>tests/*Test.php</exclude-pattern>
  </rule>
  <rule ref="WordPress.Files.FileName">
    <exclude-pattern>tests/*Test.php</exclude-pattern>
  </rule>

  <!-- Optional: Uncomment if PHPCompatibilityWP is installed -->
  <!--
  <config name="testVersion" value="8.2-"/>
  <rule ref="PHPCompatibilityWP">
    <include-pattern>*.php</include-pattern>
  </rule>
  -->

</ruleset>
