buddypress / bp-coding-standards
PHP_CodeSniffer rules (sniffs) to enforce BuddyPress minimum coding conventions
Installs: 11 704
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 6
Forks: 0
Open Issues: 0
Type:phpcodesniffer-standard
Requires
- php: >=5.6
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.1
- phpcompatibility/phpcompatibility-wp: ^2.1.0
- squizlabs/php_codesniffer: ^3.5.5
- wp-coding-standards/wpcs: ^2.3.0
README
PHP_CodeSniffer
rules (sniffs) to enforce BuddyPress minimum coding conventions.
Minimal requirements
- PHP 5.6+
- WPCS 3.0+
Installation
To use this standard in a project, declare it as a dependency.
composer require buddypress/bp-coding-standards
This will install the latest compatible version of PHPCS and WPCS to your vendor directory in order to run sniffs locally.
You can also manually add this to your project's composer.json
file as part of the require
property:
"require": { "buddypress/bp-coding-standards": "^0.2.0" }
Using PHPCS
To use this standard with phpcs
directly from your command line, use the command:
vendor/bin/phpcs --standard=BuddyPress .
Alternatively, you can set this as a composer script, which will automatically reference the correct version of phpcs
and the dependent standards.
"scripts": { "phpcs" : "phpcs --standard=BuddyPress ." }
Then use the following command:
composer run phpcs
You can also pass arguments to the composer phpcs script, following a --
operator like this:
composer run phpcs -- --report=summary
Extending the ruleset
You can create a custom ruleset for your project that extends or customizes these rules by creating your own phpcs.xml
or phpcs.xml.dist
file in your project, which references these rules, like this:
<?xml version="1.0"?> <ruleset> <description>Example project ruleset</description> <!-- Include BuddyPress Rules --> <rule ref="BuddyPress" /> <!-- Project customizations go here --> </ruleset>
Change Log
Change log under CHANGELOG.md.