From 82feec1bb512803f6356a994f4d70e95d07d4c66 Mon Sep 17 00:00:00 2001 From: Marcin Kolanko <marcin@inspirelabs.pl> Date: Mon, 27 Sep 2021 13:13:44 +0200 Subject: [PATCH] chore: add phpcs --- composer.json | 5 ++--- phpcs.xml.dist | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 phpcs.xml.dist diff --git a/composer.json b/composer.json index 6a79cb8..42726f4 100644 --- a/composer.json +++ b/composer.json @@ -24,10 +24,9 @@ }, "require-dev": { "phpunit/phpunit": "<7", - "wp-coding-standards/wpcs": "^0.14.1", - "squizlabs/php_codesniffer": "^3.0.2", "mockery/mockery": "*", - "10up/wp_mock": "*" + "10up/wp_mock": "*", + "wpdesk/wp-code-sniffer": "^1.2.3" }, "autoload": { "psr-4": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..1b9bf7a --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,48 @@ +<?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> + <file>./templates</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-forms"/> + + <!-- This value should be aligned with WordPress support version declared in plugin header --> + <config name="minimum_supported_wp_version" value="5.0"/> + + <!-- Set value aligned with supported PHP Version for PHPCompatibilityWP check. --> + <config name="testVersion" value="7.0-"/> + + <rule ref="WPDeskPlugin"/> + + <rule ref="Squiz.Commenting.ClassComment.Missing"> + <exclude name="Squiz.Commenting.ClassComment.Missing"/> + </rule> + +</ruleset> -- GitLab