From 4914f07a2cc8b73de3fb06d7bf9ebcbcbf0a0ccd Mon Sep 17 00:00:00 2001
From: Bart Jaskulski <bjaskulski@protonmail.com>
Date: Thu, 7 Mar 2024 15:42:40 +0100
Subject: [PATCH] chore: add config files

Signed-off-by: Bart Jaskulski <bjaskulski@protonmail.com>
---
 .gitattributes | 11 +++++++++++
 .gitignore     |  3 ++-
 phpcs.xml.dist | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 .gitattributes
 create mode 100644 phpcs.xml.dist

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..1c336fb
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,11 @@
+# Path-based git attributes
+# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
+
+# Ignore all test and documentation with "export-ignore".
+/.editorconfig               export-ignore
+/.gitattributes              export-ignore
+/.gitignore                  export-ignore
+/phpcs.xml.dist              export-ignore
+/phpunit.xml.dist            export-ignore
+/tests                       export-ignore
+/vendor                      export-ignore
diff --git a/.gitignore b/.gitignore
index d80a0dd..900cbda 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 .DS_Store
 vendor
 composer.lock
-.phpunit.result.cache
\ No newline at end of file
+.phpunit.result.cache
+.phpcs-cache
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
new file mode 100644
index 0000000..05dfc78
--- /dev/null
+++ b/phpcs.xml.dist
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<ruleset name="WordPress Coding Standards for WP Desk Plugin">
+
+	<!--
+	#############################################################################
+	COMMAND LINE ARGUMENTS
+	https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
+	#############################################################################
+	-->
+
+	<!-- Scan all files. -->
+	<file>./src</file>
+
+	<!-- Only check PHP files. -->
+	<arg name="extensions" value="php"/>
+
+	<!-- Show progress, show the error codes for each message (source). -->
+	<arg value="sp"/>
+
+	<!-- Check up to 8 files simultaneously. -->
+	<arg name="parallel" value="8"/>
+
+	<!-- Cache outcomes for better performance. Remember to add the file to .gitignore. -->
+	<arg name="cache" value="./.phpcs-cache"/>
+
+	<!--
+	#############################################################################
+	USE THE WPDeskCS RULESET
+	#############################################################################
+	-->
+
+	<!-- Define plugin text domain for i18n. -->
+	<config name="text_domain" value="wp-init"/>
+
+	<!-- This value should be aligned with WordPress support version declared in plugin header -->
+	<config name="minimum_supported_wp_version" value="6.2"/>
+
+	<!-- Set value aligned with supported PHP Version for PHPCompatibilityWP check. -->
+	<config name="testVersion" value="7.2-"/>
+
+	<rule ref="WPDeskPlugin"/>
+
+	<!--
+	##############################################################################
+	CUSTOM RULES
+	##############################################################################
+	-->
+	<rule ref="Squiz.ControlStructures.InlineIfDeclaration">
+		<exclude name="Squiz.ControlStructures.InlineIfDeclaration.NoBrackets"/>
+	</rule>
+</ruleset>
-- 
GitLab