<?xml version="1.0"?>
<ruleset name="Block Starter Kit WordPress Coding Standards">
	<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
	<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->
	<!-- See https://github.com/10up/10up-code-review -->
	<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#properties-strongly-recommended-to-be-set -->

	<description>Coding standards for Block Starter Kit using WP Enforcer.</description>

	<!-- Explicitly point to where WPCS lives in the project -->
	<config name="installed_paths" value="vendor/wp-coding-standards/wpcs" />

	<!-- Excludes: Generic -->
	<exclude-pattern>*/bower-components/*</exclude-pattern>
	<exclude-pattern>*/node_modules/*</exclude-pattern>
	<exclude-pattern>*/tests/*</exclude-pattern>
	<exclude-pattern>*/vendor/*</exclude-pattern>
	<exclude-pattern>*.json</exclude-pattern>
	<exclude-pattern>*.js</exclude-pattern>
	<exclude-pattern>*.min.js</exclude-pattern>

	<!-- Excludes: Kapow! specific -->
	<exclude-pattern>assets/*</exclude-pattern>
	<exclude-pattern>*.png</exclude-pattern>
	<exclude-pattern>*.jpg</exclude-pattern>
	<exclude-pattern>*.gif</exclude-pattern>

	<!--
		Don't get angry about checking files that don't contain code
		@link https://github.com/stevegrunwell/wp-enforcer/issues/12
	-->
	<rule ref="Internal.NoCodeFound">
		<severity>0</severity>
	</rule>

	<!-- Ignore mixed line-endings warnings -->
	<rule ref="Internal.LineEndings.Mixed">
		<severity>0</severity>
	</rule>

	<!-- Internal exceptions (often occur on minified files) -->
	<rule ref="Internal.Tokenizer.Exception">
		<severity>0</severity>
	</rule>

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

	<!-- Include the WordPress Extra (Core + Extras) ruleset, with exclusions. -->
	<rule ref="WordPress-Extra">
		<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
		<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
		<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
	</rule>

	<!-- Include the WordPress Documentation ruleset  -->
	<rule ref="WordPress-Docs" />

	<!-- VIP: Check that input is validated and sanitize -->
	<rule ref="WordPress.Security.ValidatedSanitizedInput">
		<properties>
			<property name="check_validation_in_scope_only" value="true" />
		</properties>
	</rule>

	<!-- VIP: Ensure that output is escaped -->
	<rule ref="WordPress.Security.EscapeOutput"/>

	<!-- VIP: Ensure that nonce verification is in place where relevant -->
	<rule ref="WordPress.Security.NonceVerification"/>

	<!-- Allow theme filename exceptions -->
	<rule ref="WordPress.Files.FileName">
		<properties>
			<property name="is_theme" value="true" />
		</properties>
	</rule>

	<!-- Ensure that any i18n functions have a valid project-specific or Kapow textdomain -->
	<rule ref="WordPress.WP.I18n">
		<properties>
			<property name="text_domain" type="array" value="sw-snippet" />
		</properties>
	</rule>

	<!-- Ensure that we're not using any functions deprecated three major versions ago -->
	<rule ref="WordPress.WP.DeprecatedFunctions">
		<properties>
			<property name="minimum_supported_version" value="4.7" />
		</properties>
	</rule>
</ruleset>
