2016-07-19 11:12:28 +02:00
|
|
|
Plugin PHP Code Sniffer
|
2017-01-04 13:22:20 +01:00
|
|
|
=======================
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
Runs PHP Code Sniffer against your build.
|
|
|
|
|
2016-07-19 11:12:28 +02:00
|
|
|
Configuration
|
2017-01-04 13:22:20 +01:00
|
|
|
-------------
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
### Options
|
2016-07-19 11:12:28 +02:00
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
* **allowed_warnings** [int, optional] - The warning limit for a successful build.
|
|
|
|
* **allowed_errors** [int, optional] - The error limit for a successful build.
|
|
|
|
* **suffixes** [array, optional] - An array of file extensions to check.
|
|
|
|
* **standard** [string, optional] - The standard against which your files should be checked (defaults to PSR2.)
|
|
|
|
* **tab_width** [int, optional] - Your chosen tab width.
|
|
|
|
* **encoding** [string, optional] - The file encoding you wish to check for.
|
|
|
|
* **path** [string, optional] - Path in which to run PHP Code Sniffer.
|
|
|
|
* **ignore** [array, optional] - A list of files / paths to ignore, defaults to the build_settings ignore list.
|
2017-03-24 21:00:14 +01:00
|
|
|
* **severity** [int, optional] - Allows to set the minimum severity level
|
|
|
|
* **error_severity** [int, optional] - Allows to set the minimum errors severity level
|
|
|
|
* **warning_severity** [int, optional] - Allows to set the minimum warnings severity level
|
2016-07-17 16:20:35 +02:00
|
|
|
|
2016-07-19 11:12:28 +02:00
|
|
|
### Examples
|
|
|
|
|
2016-07-17 16:20:35 +02:00
|
|
|
Simple example where PHPCS will run on app directory, but ignore the views folder, and use PSR-1 and PSR-2 rules for validation:
|
|
|
|
```yml
|
|
|
|
test:
|
|
|
|
php_code_sniffer:
|
|
|
|
path: "app"
|
|
|
|
ignore:
|
|
|
|
- "app/views"
|
|
|
|
standard: "PSR1,PSR2"
|
|
|
|
```
|
|
|
|
|
|
|
|
For use with an existing project:
|
|
|
|
```yml
|
|
|
|
test:
|
|
|
|
php_code_sniffer:
|
|
|
|
standard: "/phpcs.xml" # The leading slash is needed to trigger an external ruleset.
|
2016-07-21 19:20:59 +02:00
|
|
|
# Without it, PHP Censor looks for a rule named "phpcs.xml"
|
2016-07-17 16:20:35 +02:00
|
|
|
allowed_errors: -1 # Even a single error will cause the build to fail. -1 = unlimited
|
|
|
|
allowed_warnings: -1
|
|
|
|
```
|