Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bigwing/phpcs-composer
BigWing's PHP Code Sniffer ruleset for WordPress-based projects.
https://github.com/bigwing/phpcs-composer
composer ide lint phpcs phpcs-standard ruleset wordpress wordpress-development
Last synced: 4 days ago
JSON representation
BigWing's PHP Code Sniffer ruleset for WordPress-based projects.
- Host: GitHub
- URL: https://github.com/bigwing/phpcs-composer
- Owner: bigwing
- License: mit
- Created: 2020-08-05T19:24:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-07T18:35:22.000Z (about 4 years ago)
- Last Synced: 2024-10-17T08:38:02.960Z (20 days ago)
- Topics: composer, ide, lint, phpcs, phpcs-standard, ruleset, wordpress, wordpress-development
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# BigWing PHPCS Configuration
> Composer library to provide drop in installation and configuration of [WPCS](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) and [PHPCompatibilityWP](https://github.com/PHPCompatibility/PHPCompatibilityWP), setting reasonable defaults for WordPress development with nearly zero configuration.
[![Support Level](https://img.shields.io/badge/support-internal-blue.svg)](#support-level) [![MIT License](https://img.shields.io/github/license/bigwing/phpcs-composer.svg)](https://github.com/bigwing/phpcs-composer/blob/master/LICENSE)
## Installation
Install the library via Composer:
```bash
$ composer require --dev bigwing/phpcs-composer:dev-master
```That's it!
## Usage
Lint your PHP files with the following command:
```bash
$ ./vendor/bin/phpcs .
```If relying on Composer, edited the `composer.json` file by adding the following:
```json
"scripts": {
"lint": [
"phpcs . --standard=BigWing-WP"
],
}
```Then lint via:
```bash
$ composer run lint
```### Continuous Integration
PHPCS Configuration plays nicely with Continuous Integration solutions. Out of the box, the library loads the `BigWing-WP` ruleset, and checks for syntax errors for PHP 7.2 or higher.
To override the default PHP version check, set the `--runtime-set testVersion 7.2-` configuration option. Example for PHP version 7.4 and above:
```bash
$ ./vendor/bin/phpcs --runtime-set testVersion 7.4-
```See more [information about specifying PHP version](https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions).
Note that you can only overrule PHP version check from the command-line.
### IDE Integration
Some IDE integrations of PHPCS fail to register the `BigWing-WP` ruleset. In order to rectify this, place `.phpcs.xml.dist` at your project root:
```xml
```
## Support Level
**Internal:** BigWing is working on this for internal projects, 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.
## Thanks and Credits
- 10up for their [PHPCS ruleset](https://github.com/10up/phpcs-composer) that this is based on.
- The [WordPress Coding Standards contributors](https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors) for laying the groundwork for
standardized code sniffing in WordPress.