2018-02-10 12:07:08 +00:00
|
|
|
# phpcs
|
|
|
|
|
|
|
|
> Tokenize PHP, JavaScript and CSS files to detect violations of a defined set of coding standards.
|
2019-05-29 14:53:47 +01:00
|
|
|
> More information: <https://github.com/squizlabs/PHP_CodeSniffer>.
|
2018-02-10 12:07:08 +00:00
|
|
|
|
|
|
|
- Sniff the specified directory for issues (defaults to the PEAR standard):
|
|
|
|
|
|
|
|
`phpcs {{path/to/directory}}`
|
|
|
|
|
|
|
|
- Display a list of installed coding standards:
|
|
|
|
|
|
|
|
`phpcs -i`
|
|
|
|
|
|
|
|
- Specify a coding standard to validate against:
|
|
|
|
|
|
|
|
`phpcs {{path/to/directory}} --standard {{standard}}`
|
|
|
|
|
2020-10-05 14:35:06 +01:00
|
|
|
- Specify comma-separated file extensions to include when sniffing:
|
2018-02-10 12:07:08 +00:00
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`phpcs {{path/to/directory}} --extensions {{file_extension1,file_extension2,...}}`
|
2018-02-10 12:07:08 +00:00
|
|
|
|
|
|
|
- Specify the format of the output report (e.g. `full`, `xml`, `json`, `summary`):
|
|
|
|
|
|
|
|
`phpcs {{path/to/directory}} --report {{format}}`
|
|
|
|
|
2024-01-25 05:29:16 +00:00
|
|
|
- Set configuration variables to be used during the process:
|
2018-02-10 12:07:08 +00:00
|
|
|
|
|
|
|
`phpcs {{path/to/directory}} --config-set {{key}} {{value}}`
|
|
|
|
|
|
|
|
- A comma-separated list of files to load before processing:
|
|
|
|
|
2024-01-31 03:55:19 +00:00
|
|
|
`phpcs {{path/to/directory}} --bootstrap {{path/to/file1,path/to/file2,...}}`
|
2018-02-10 12:07:08 +00:00
|
|
|
|
|
|
|
- Don't recurse into subdirectories:
|
|
|
|
|
|
|
|
`phpcs {{path/to/directory}} -l`
|