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.
Copy file name to clipboardExpand all lines: README.md
+37-7Lines changed: 37 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,24 +2,41 @@
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:
6
+
7
+
- help developers achieve greater consistency within their themes and plugins
8
+
- assist developers in meeting the requirements of a WP Engine Solution Partner
9
+
- ensure that all software listed in the WP Engine Solution Center is of the highest quality
10
+
- offer users maximum performance and security benefits when using those themes and plugins in a modern hosting environment (PHP 7+)
11
+
12
+
The information included here walks you through the process of installing and using WP Engine Coding Standards to lint your code.
13
+
5
14
## Requirements
6
15
16
+
WP Engine Coding Standards (WPECS) uses [Composer](https://getcomposer.org/) to install these main dependencies:
If you're using Homebrew on Mac, you can install Composer with: `brew install composer`. Otherwise, follow the official installation instructions for Composer.
23
+
7
24
## Installation
8
25
9
-
You can install WPECS globally with the following command:
26
+
Clone or download this repository. From terminal, navigate to the download location and install WPECS globally with the following command:
10
27
11
28
make install
12
29
13
-
You will then be able to run WPECS from the any directory:
30
+
You will then be able to run WPECS from any directory.
31
+
32
+
Running `make install` will install WPECS dependencies and register coding standards with PHPCS.
33
+
34
+
## Usage
14
35
15
36
USAGE: wpecs [--strict] [phpcs-options] <path>
16
37
<wpecs> Run the specified path against the WP Engine Coding Standards
17
38
<wpecbf> Attempt to fix sniffs against the WP Engine Strict Coding Standards
18
39
19
-
Try using 'wpecbf' to fix the sniff violations automatically.
20
-
21
-
## Usage
22
-
23
40
**WP-Engine Coding Standard**
24
41
25
42
_The required standard for secure WordPress development._
@@ -28,6 +45,19 @@ _The required standard for secure WordPress development._
28
45
29
46
**WP-Engine-Strict Coding Standard**
30
47
31
-
_The recommend standard for WP-Engine authored plugins._
48
+
_The recommend standard for WPEngine authored plugins._
32
49
33
50
`wpecs --standard="WP-Engine-Strict" .`
51
+
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).
53
+
54
+
## Results
55
+
56
+
When you run WP Engine Coding Standards against your PHP file(s) or against a project directory, it will generate two reports:
57
+
58
+
* Summary report of PHP Code Sniffer violations (`report-summary.txt`)
59
+
* Verbose report of PHP Code Sniffer violations (`report-full.txt`)
60
+
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.
62
+
63
+
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