10up / phpcs-composer
10up's PHP CodeSniffer Ruleset
Installs: 729 839
Dependents: 35
Suggesters: 0
Security: 0
Stars: 49
Watchers: 84
Forks: 8
Open Issues: 7
Type:phpcodesniffer-standard
Requires
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: *
- phpcompatibility/php-compatibility: dev-develop as 9.99.99
- dev-master
- dev-trunk
- 3.0.0
- 3.0.0-RC4
- 3.0.0-RC3
- 3.0.0-RC2
- 3.0.0-RC1
- 2.0.1
- dev-fix/install-documentation
- dev-release/3.0.0
- dev-wpcs-3-0
- dev-feature/add-tests-to-3.0.0-branch
- dev-feature/php-8-2
- dev-feature/include-missing-wordpress-db-rules
- dev-do/38-enable-nonce-sniff
- dev-update/adding-sniffs
- dev-feature/php-8-1
- dev-feature/ignore-dist
- dev-feature/php-7-4
- dev-fix/readme-package
This package is auto-updated.
Last update: 2024-11-15 00:07:49 UTC
README
Composer library to provide drop in installation and configuration of WPCS and PHPCompatibilityWP, setting reasonable defaults for WordPress development with nearly zero configuration.
Installation
Install the library via Composer:
$ composer require --dev 10up/phpcs-composer:"^3.0"
That's it!
Usage
Lint your PHP files with the following command:
$ ./vendor/bin/phpcs .
If relying on Composer, edited the composer.json
file by adding the following:
"scripts": { "lint": [ "phpcs ." ], }
Then lint via:
$ composer run lint
Continuous Integration
PHPCS Configuration plays nicely with Continuous Integration solutions. Out of the box, the library loads the 10up-Default
ruleset, and checks for syntax errors for PHP 8.2 or higher.
To override the default PHP version check, set the --runtime-set testVersion 7.0-
configuration option. Example for PHP version 7.2 and above:
$ ./vendor/bin/phpcs --runtime-set testVersion 7.2-
See more information about specifying PHP version.
Note that you can only overrule PHP version check from the command-line.
IDE Integration
Some IDE integrations of PHPCS fail to register the 10up-Default
ruleset. In order to rectify this, place .phpcs.xml.dist
at your project root:
<?xml version="1.0"?> <ruleset name="Project Rules"> <rule ref="10up-Default" /> </ruleset>
Support Level
Active: 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.