-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
193 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [1.0.0] - Unreleased | ||
### Added | ||
- Added `PHPCompatibilityWP` rule. | ||
- Added `VariableAnalysis` rule. | ||
- Added `WordPress` rule. | ||
- Added `WordPressVIPMinimum` rule. | ||
- Added `WordPress-VIP-Go` rule. | ||
- Excluded `WordPress.Files.FileName.InvalidClassFileName` sniff. | ||
- Excluded `WordPress.Files.FileName.NotHyphenatedLowercase` sniff. | ||
- Added relative exclude pattern `^bower_components/*` for the `bower_components` folder. | ||
- Added relative exclude pattern `^node_modules/*` for the `node_modules` folder. | ||
- Added relative exclude pattern `^vendor/*` for the `vendor` folder. | ||
- Added relative exclude pattern `^vendor-bin/*` for the `vendor-bin` folder. | ||
- Added relative exclude pattern `^wordpress/*` for the `wordpress` folder. | ||
- Added relative exclude pattern `^wp-content/*` for the `wp-content` folder. | ||
|
||
[Unreleased]: https://github.com/pronamic/wp-coding-standards/compare/1.0.0...HEAD | ||
[1.0.0]: https://github.com/pronamic/wp-coding-standards/releases/tag/1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,128 @@ | ||
# Pronamic WordPress WordPress Coding Standards | ||
|
||
Pronamic WordPress WordPress Coding Standards for PHP_CodeSniffer. | ||
|
||
## PHP_CodeSniffer | ||
|
||
https://github.com/squizlabs/PHP_CodeSniffer | ||
|
||
### Arguments | ||
|
||
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage | ||
|
||
#### `colors` | ||
|
||
By default use colors in output. | ||
|
||
```xml | ||
<arg name="colors"/> | ||
``` | ||
|
||
#### `extensions` | ||
|
||
By default only check files with `php` extension: | ||
|
||
```xml | ||
<arg name="extensions" value="php" /> | ||
``` | ||
|
||
#### `parallel` | ||
|
||
By default use `8` parallel processes. | ||
|
||
```xml | ||
<arg name="parallel" value="8" /> | ||
``` | ||
|
||
https://github.com/squizlabs/PHP_CodeSniffer/issues/1732 | ||
|
||
#### `sp` | ||
|
||
By default show sniff codes in all reports. | ||
By default show progress of the run. | ||
|
||
```xml | ||
<arg value="sp" /> | ||
``` | ||
|
||
## Rules | ||
|
||
### PHPCompatibilityWP | ||
|
||
https://github.com/PHPCompatibility/PHPCompatibilityWP | ||
|
||
By default this package test PHP 5.6 and higher via the following setting: | ||
|
||
```xml | ||
<config name="testVersion" value="5.6-"/> | ||
``` | ||
|
||
### PHPCompatibility | ||
|
||
https://github.com/PHPCompatibility/PHPCompatibility | ||
|
||
Required through `PHPCompatibilityWP`. | ||
|
||
### WordPress | ||
|
||
https://github.com/WordPress/WordPress-Coding-Standards | ||
|
||
By default the minimum WordPress version to check is set to `4.7` via the following setting: | ||
|
||
```xml | ||
<config name="minimum_supported_wp_version" value="4.7" /> | ||
``` | ||
|
||
https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#minimum-wp-version-to-check-for-usage-of-deprecated-functions-classes-and-function-parameters | ||
|
||
### WordPressVIPMinimum | ||
|
||
https://github.com/Automattic/VIP-Coding-Standards | ||
|
||
### WordPress-VIP-Go | ||
|
||
https://github.com/Automattic/VIP-Coding-Standards | ||
|
||
### VariableAnalysis | ||
|
||
https://github.com/sirbrillig/phpcs-variable-analysis | ||
|
||
## Exclusions | ||
|
||
### `WordPress.Files.FileName.InvalidClassFileName` | ||
|
||
According to the WordPress PHP Coding Standards: | ||
|
||
> Class file names should be based on the class name with `class-` prepended and the underscores in the class name replaced with hyphens, for example `WP_Error` becomes: | ||
> | ||
> ``` | ||
> class-wp-error.php | ||
> ``` | ||
_Source:_ https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#naming-conventions | ||
This sniff will check on this naming convention: | ||
``` | ||
Class file names should be based on the class name with "class-" prepended. Expected class-test.php, but found Test.php. | ||
``` | ||
We often use the [PSR-4](https://www.php-fig.org/psr/psr-4/) autoloading mechanism and therefore deviate from it. | ||
### `WordPress.Files.FileName.NotHyphenatedLowercase` | ||
According to the WordPress PHP Coding Standards: | ||
> Files should be named descriptively using lowercase letters. Hyphens should separate words. | ||
> | ||
> ``` | ||
> my-plugin-name.php | ||
> ``` | ||
_Source:_ https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#naming-conventions | ||
``` | ||
Filenames should be all lowercase with hyphens as word separators. Expected test.php, but found Test.php. | ||
``` | ||
We often use the [PSR-4](https://www.php-fig.org/psr/psr-4/) autoloading mechanism and therefore deviate from it. |