PHP_CodeSniffer rules that enforce WordPress coding conventions
open sourceMITfree
WordPress Coding Standards (WordPressCS) is a collection of PHP_CodeSniffer rules (sniffs) that check code written for WordPress against its official coding conventions. It ships the WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra standards to pick from with phpcs's --standard option or a custom ruleset, many configurable sniffs, and sniffs from PHPCSExtra and PHP_CodeSniffer itself. Since version 3.0 it's installed only with Composer.
Problems it solves
- check my WordPress plugin's PHP against the WordPress coding standards
- lint a WordPress theme in CI with phpcs
- enforce WordPress code style in my editor
Features
- WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra standards
- configurable sniff properties
- includes sniffs from PHPCSExtra and PHP_CodeSniffer
- runs in CI and in editors through phpcs
Limitations
Alternatives
The same job
These do what WordPress Coding Standards for PHP_CodeSniffer does.
- PHPCompatibilityWP PHPCompatibility ruleset for WordPress projects that skips WordPress's own polyfills
- PHP_CodeSniffer Standards Composer Installer Plugin Composer plugin that registers installed PHP_CodeSniffer coding standards automatically
- Stylelint A CSS linter that catches errors and enforces conventions in your stylesheets
- PHP_CodeSniffer Detect and fix coding standard violations in PHP
- PHPCompatibility PHP_CodeSniffer sniffs that check PHP code for cross-version compatibility
- Easy Coding Standard (ECS) Runs PHP_CodeSniffer and PHP-CS-Fixer rules together, fast
Compare WordPress Coding Standards for PHP_CodeSniffer with the top 3
