<?xml version="1.0"?>
<ruleset name="Plugin Coding Standards">
	<description>Plugin coding standards based on WordPress VIP standards with excluded some rules.</description>

	<arg name="colors"/>
	<arg value="s"/>

	<!-- WordPress related rules -->
	<rule ref="./vendor/automattic/vipwpcs/WordPress-VIP-Go/ruleset.xml">
		<exclude name="WordPress.WP.TimezoneChange.DeprecatedSniff"/>
	</rule>
	<rule ref="WordPress.PHP.YodaConditions"/>

	<file>./plugin.php</file>
	<file>./source</file>
	<file>./tests</file>
	<exclude-pattern>./source/libraries</exclude-pattern>
	<exclude-pattern>./tests/bootstrap.php</exclude-pattern>
	<exclude-pattern>./tests/Data/amp-styles</exclude-pattern>

	<rule ref="PSR2"/>

	<rule ref="Generic.Arrays.DisallowShortArraySyntax"/>
	<rule ref="Generic.Classes.DuplicateClassName"/>
	<rule ref="Generic.Commenting">
		<exclude name="Generic.Commenting.DocComment"/>
	</rule>
	<rule ref="Generic.ControlStructures"/>
	<rule ref="Generic.Debug"/>
	<rule ref="Generic.Files">
		<exclude name="Generic.Files.EndFileNoNewline"/>
		<exclude name="Generic.Files.LowercasedFilename"/>
		<exclude name="Generic.Files.LineLength"/>
		<exclude name="Generic.Files.InlineHTML"/>
	</rule>
	<rule ref="Generic.Formatting">
		<exclude name="Generic.Formatting.NoSpaceAfterCast"/>
		<exclude name="Generic.Formatting.SpaceAfterNot"/>
		<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning"/>
	</rule>
	<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
	<rule ref="Generic.Metrics"/>
	<rule ref="Generic.Metrics.CyclomaticComplexity">
		<properties>
			<property name="complexity" value="12"/>
		</properties>
	</rule>
	<rule ref="Generic.NamingConventions"/>
	<rule ref="Generic.NamingConventions.CamelCapsFunctionName">
		<properties>
			<property name="strict" value="false"/>
		</properties>
	</rule>
	<rule ref="Generic.PHP">
		<exclude name="Generic.PHP.ClosingPHPTag"/>
		<exclude name="Generic.PHP.UpperCaseConstant"/>
		<exclude name="Generic.PHP.RequireStrictTypes.MissingDeclaration"/>
		<exclude name="Generic.ControlStructures.DisallowYodaConditions.Found"/>
	</rule>
	<rule ref="Generic.Strings"/>
	<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>

	<rule ref="Squiz.Classes"/>

	<rule ref="Squiz.Commenting.DocCommentAlignment"/>
	<rule ref="Squiz.Commenting.VariableComment"/>
	<rule ref="Squiz.ControlStructures">
		<exclude name="Squiz.ControlStructures.ElseIfDeclaration"/>
		<exclude name="Squiz.ControlStructures.SwitchDeclaration"/>
	</rule>

	<rule ref="PSR1.Files.SideEffects">
		<exclude-pattern>*/plugin.php</exclude-pattern>
	</rule>
	<rule ref="Generic.Metrics.CyclomaticComplexity.TooHigh">
		<exclude-pattern>source/Admin/Service/SetkaEditorAPI/Actions/UpdateStatusAction.php</exclude-pattern>
		<exclude-pattern>source/Admin/Pages/SetkaEditor/SignUp/SignUpPage.php</exclude-pattern>
		<exclude-pattern>source/API/V1/Actions/CompanyStatusUpdateAction.php</exclude-pattern>
	</rule>
	<rule ref="Generic.Metrics.NestingLevel.TooHigh">
		<exclude-pattern>source/Admin/Pages/SetkaEditor/SignUp/SignUpPage.php</exclude-pattern>
	</rule>
	<rule ref="WordPress.Security.EscapeOutput">
		<properties>
			<property name="customEscapingFunctions" type="array">
				<element value="wp_strip_all_tags"/>
			</property>
		</properties>
	</rule>
	<rule ref="Squiz.PHP.CommentedOutCode.Found">
		<exclude-pattern>tests/DataSets/SetkaAPI/FilesSet.php</exclude-pattern>
	</rule>
</ruleset>
