You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
* Remove obsolete scripts
* Update legacy bin scripts for anyone still using them
* Update json with fixes to work as composer package
* Add default configuration
* Remove shared config from rulesets
* Update usage instructions
* Don't suppress make output by default
* Correctly call make
* Implment script options
* Fix wpecs script
* Add scripted usage instructions to readme
* wpecbf signature now matches wpecs signature
Copy file name to clipboardExpand all lines: README.md
+71-11Lines changed: 71 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
WP Engine Coding Standards for WordPress
4
4
5
-
If [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) offer a baseline for developers to use when contributing to or extending WordPress, think of WP Engine Coding Standards as an additional layer of best practices that:
5
+
If [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) offer a baseline for developers to use when contributing to or extending WordPress, think of WP Engine Coding Standards as an additional layer of best practices that:
6
6
7
7
- help developers achieve greater consistency within their themes and plugins
8
8
- assist developers in meeting the requirements of a WP Engine Solution Partner
@@ -13,7 +13,7 @@ The information included here walks you through the process of installing and us
13
13
14
14
## Requirements
15
15
16
-
WP Engine Coding Standards (WPECS) uses [Composer](https://getcomposer.org/) to install these main dependencies:
16
+
WP Engine Coding Standards (WPECS) uses [Composer](https://getcomposer.org/) to install these main dependencies:
3. Run `composer install` or `composer update` to ensure your project is configured.
64
+
65
+
4. You can now use `WP-Engine` or `WP-Engine-Strict` in any IDE that uses the local phpcs. If you already have a phpcs.xml in your project, simply add the following to it:
66
+
67
+
```xml
68
+
<ruleref="WP-Engine-Strict"/>
69
+
```
70
+
71
+
### Alternative Install (wpecs command)
72
+
26
73
Clone or download this repository. From terminal, navigate to the download location and install WPECS globally with the following command:
27
74
28
75
make install
@@ -31,11 +78,17 @@ You will then be able to run WPECS from any directory.
31
78
32
79
Running `make install` will install WPECS dependencies and register coding standards with PHPCS.
33
80
81
+
* Note you might need to manually move the binaries to your path, or properly set path, if make fails.
82
+
34
83
## Usage
35
84
36
-
USAGE: wpecs [--strict] [phpcs-options] <path>
37
-
<wpecs> Run the specified path against the WP Engine Coding Standards
38
-
<wpecbf> Attempt to fix sniffs against the WP Engine Strict Coding Standards
85
+
### Command line
86
+
87
+
Run the `phpcs` command line tool on a given file or directory, for example:
88
+
89
+
```bash
90
+
phpcs --standard=WP-Engine wp-load.php
91
+
```
39
92
40
93
**WP-Engine Coding Standard**
41
94
@@ -49,15 +102,22 @@ _The recommend standard for WP Engine authored plugins._
49
102
50
103
`wpecs --standard="WP-Engine-Strict" .`
51
104
52
-
Since WPECS is a collection of custom rulesets, you can still use regular [PHP_CodeSniffer commands](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage).
105
+
### Using PHPCS and WP Engine Coding Standards from within your IDE
53
106
54
-
## Results
107
+
While the following is based on the parent WordPress Coding Standards, simply swap out the ruleset you need for `WP-Engine` or `WP-Engine-Strict` as appropriate.
55
108
56
-
When you run WP Engine Coding Standards against your PHP file(s) or against a project directory, it will generate two reports:
109
+
***PhpStorm** : Please see "[PHP Code Sniffer with WordPress Coding Standards Integration](https://confluence.jetbrains.com/display/PhpStorm/WordPress+Development+using+PhpStorm#WordPressDevelopmentusingPhpStorm-PHPCodeSnifferwithWordPressCodingStandardsIntegrationinPhpStorm)" in the PhpStorm documentation.
110
+
***Sublime Text** : Please see "[Setting up WPCS to work in Sublime Text](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Setting-up-WPCS-to-work-in-Sublime-Text)" in the wiki.
111
+
***Atom**: Please see "[Setting up WPCS to work in Atom](https://github.com/WordPress/WordPress-Coding-Standards/wiki/Setting-up-WPCS-to-work-in-Atom)" in the wiki.
112
+
***Visual Studio**: Please see "[Setting up PHP CodeSniffer in Visual Studio Code](https://tommcfarlin.com/php-codesniffer-in-visual-studio-code/)", a tutorial by Tom McFarlin.
113
+
***Eclipse with XAMPP**: Please see "[Setting up WPCS when using Eclipse with XAMPP](https://github.com/WordPress/WordPress-Coding-Standards/wiki/How-to-use-WPCS-with-Eclipse-and-XAMPP)" in the wiki.
57
114
58
-
* Summary report of PHP Code Sniffer violations (`report-summary.txt`)
59
-
* Verbose report of PHP Code Sniffer violations (`report-full.txt`)
115
+
### Alternative usage (wpecs)
60
116
61
-
The summary provides an overview of how many total sniff violations were detected, while the detailed review highlights specific lines of code (by file) where errors or warnings were detected and what the issues are.
117
+
USAGE: wpecs [--strict][phpcs-options] <path>
118
+
<wpecs> Run the specified path against the WP Engine Coding Standards
119
+
<wpecbf> Attempt to fix sniffs against the WP Engine Strict Coding Standards
120
+
121
+
## Results
62
122
63
123
For help understanding errors or warnings and suggestions for troubleshooting specific issues, please refer to the full [WP Engine Coding Standards Documentation](https://github.com/wpengine/wpengine-coding-standards/wiki).
0 commit comments