Skip to content

Commit 2c1b135

Browse files
authored
4.0 | Wiki: add the cumulative exit codes
- Added the cumulative exit codes as documented in the interim proposal (PHPCSStandards/PHP_CodeSniffer#184 (comment)). This ensures a complete exit code documentation where users and devs can easily read exactly what the cumulative exit codes are. - Also added another description to the `0` exit code to describe when issues are fixed with no issues remaining, because "clean code base" could just be interpreted as no issues at all.
1 parent 071aebe commit 2c1b135

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

wiki/Advanced-Usage.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,17 +515,25 @@ If a coding standard or configuration file includes settings to print progress o
515515

516516
As of PHP_CodeSniffer 4.0.0, exit codes are cumulative and composed as follows:
517517

518-
| Exit code | Meaning |
519-
| --------- | ------------------------------------------------------------------------------------------------------- |
520-
| `0` | clean code base / successful non-scan request (_help/documentation/etc_) |
521-
| `1` | issues found/remaining, auto-fixable |
522-
| `2` | issues found/remaining, non-auto-fixable |
523-
| `4` | failure to fix some files/fixer conflict (phpcbf only) |
524-
| `16` | processing error - blocking the actual run of PHP_CodeSniffer, like a parse error in an XML ruleset |
525-
| `64` | requirements for running not met (i.e. minimum PHP version doesn't comply, missing required extensions) |
518+
| Exit code | Meaning |
519+
| --------- | -------------------------------------------------------------------------------------------------------------- |
520+
| `0` | clean code base / auto-fixed with no issues remaining / successful non-scan request (_help/documentation/etc_) |
521+
| `1` | issues found/remaining, auto-fixable |
522+
| `2` | issues found/remaining, non-auto-fixable |
523+
| `4` | failure to fix some files/fixer conflict (phpcbf only) |
524+
| `16` | processing error - blocking the actual run of PHP_CodeSniffer, like a parse error in an XML ruleset |
525+
| `64` | requirements for running not met (i.e. minimum PHP version doesn't comply, missing required extensions) |
526526

527527
Example: when running `phpcs`, if both auto-fixable as well as non-auto-fixable issues are found, the exit code will be `3` (`1` + `2`).
528528

529+
Cumulative exit codes:
530+
531+
| Exit code | Meaning |
532+
| --------- | ------------------------------------------------------------------------------------------------------- |
533+
| `3` | issues found, mix of auto-fixable and non-auto-fixable (`1` + `2`) (phpcs only) |
534+
| `5` | issues found, auto-fixable, but some failed to fix (`1` + `4`) (phpcbf only) |
535+
| `7` | issues found, mix of auto-fixable and non-auto-fixable, but some failed to fix (`1` + `2` + `4`) (phpcbf only) |
536+
529537
The exit codes can be influenced by the following configuration flags: [`ignore_errors_on_exit`](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#ignoring-errors-when-generating-the-exit-code), [`ignore_warnings_on_exit`](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#ignoring-warnings-when-generating-the-exit-code) and [`ignore_non_auto_fixable_on_exit`](https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#ignoring-non-auto-fixable-issues-when-generating-the-exit-code).
530538

531539

0 commit comments

Comments
 (0)