diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d9cec8b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.lock +/vendor diff --git a/WPScholar/ruleset.xml b/WPScholar/ruleset.xml index 1608e54..ac38cf2 100644 --- a/WPScholar/ruleset.xml +++ b/WPScholar/ruleset.xml @@ -4,10 +4,11 @@ - + + - - + + @@ -87,4 +88,11 @@ + + + + Please review this TODO comment: %s + 3 + + diff --git a/composer.json b/composer.json index 56d298e..57699f9 100644 --- a/composer.json +++ b/composer.json @@ -9,11 +9,15 @@ "email": "micah@wpscholar.com" } ], - "require": { + "require-dev": { "squizlabs/php_codesniffer": "@stable", - "phpcompatibility/php-compatibility": "@stable", "wp-coding-standards/wpcs": "@stable", - "dealerdirect/phpcodesniffer-composer-installer": "@stable", - "phpcompatibility/phpcompatibility-wp": "@stable" + "phpcompatibility/phpcompatibility-wp": "@stable", + "dealerdirect/phpcodesniffer-composer-installer": "@stable" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/readme.md b/readme.md index 7570c11..d2993c6 100644 --- a/readme.md +++ b/readme.md @@ -2,12 +2,12 @@ An advanced configuration of the WordPress coding standards for plugin and theme development. -This ruleset is configured to support WordPress version 5.2+ and PHP version 5.6+. +This ruleset is configured to support WordPress version 5.8+ and PHP version 7.0+. ## Usage - Install [Composer](https://getcomposer.org/) -- Run `composer init` to setup Composer for your project. +- Run `composer init` to set up Composer for your project. - Run `composer require wpscholar/phpcs-standards-wpscholar` to install the coding standards. - Run `vendor/bin/phpcs . --standard=WPScholar` from your project root to check your code. - Optionally, add a script to your `composer.json` file so you can just run `composer run lint` to check your code. @@ -16,21 +16,24 @@ This ruleset is configured to support WordPress version 5.2+ and PHP version 5.6 "scripts": { "lint": [ "vendor/bin/phpcs . --standard=WPScholar" + ], + "clean": [ + "vendor/bin/phpcbf . --standard=Newfold" ] } ``` ## Additional Notes - Append the `-s` flag to see the internal names of the rules. -- Add `--runtime-set testVersion 5.2-` to check PHP version 5.2 or greater. +- Add `--runtime-set testVersion 8.0-` to check PHP version 8.0 or greater. - Add a custom `phpcs.xml` file to your project to customize the ruleset or your desired configuration. ```xml - - + + ``` @@ -38,3 +41,15 @@ This ruleset is configured to support WordPress version 5.2+ and PHP version 5.6 - https://github.com/squizlabs/PHP_CodeSniffer - https://github.com/PHPCompatibility/PHPCompatibilityWP - https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards + +## IDE Integration + +Some IDE integrations of PHPCS will fail to register your ruleset since it doesn't live in your project root. In order +to rectify this, place phpcs.xml at your project root: + +```xml + + + + +```