Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise exit codes for PHPCS and PHPCBF commands #2898

Open
gsherwood opened this issue Mar 10, 2020 · 4 comments
Open

Revise exit codes for PHPCS and PHPCBF commands #2898

gsherwood opened this issue Mar 10, 2020 · 4 comments
Milestone

Comments

@gsherwood
Copy link
Member

Version 4 is a good time to review the exit codes that both scripts produce to ensure that success cases all use 0 and that all failure cases have codes that make sense. Documentation in the wiki to describe the new exist codes should be an output of this work.

@jrfnl
Copy link
Contributor

jrfnl commented May 7, 2020

Loosely related open issues:

@nelson6e65
Copy link

Param --runtime-set ignore_warnings_on_exit 1 works on phpcs, but it does not for phpcbf.

@dfelton
Copy link

dfelton commented Mar 14, 2022

Is there any documentation somewhere that lists all non 0 or 1 exit codes that exist, and the meaning of them?

Today was the first time I discovered an exit code of 3 is used for when and invalid standard is given. It'd be nice to be able to read a compiled list of what exit codes there are, and I cannot seem to find any information on the wiki on this topic.

@jrfnl
Copy link
Contributor

jrfnl commented Mar 14, 2022

@dfelton I think this is what you are looking for: #930 (comment)

remcotolsma added a commit to pronamic/wp-deployer that referenced this issue Apr 6, 2023
wmfgerrit pushed a commit to wikimedia/mediawiki-extensions-EntitySchema that referenced this issue Apr 14, 2023
phpcbf exits with a failure exit code if there were any violations, even
if they could all be fixed. This makes it useless in a lint-staged
pipeline (which expects scripts to exit successfully, and will otherwise
discard all changes and abort the commit), so wrap phpcbf in a small
shell script checking the exit code and ignoring a 1 exit code. (Exit
code 2 would mean that there were some errors that could not be fixed.)

We can hopefully revert this when PHP_CodeSniffer version 4 is released,
which is supposed to change the exit codes to make them more sensible
(squizlabs/PHP_CodeSniffer#2898).

Change-Id: Ida87fd259bd7cc1b6c0f789001a574865e435472
wmfgerrit pushed a commit to wikimedia/mediawiki-extensions that referenced this issue Apr 14, 2023
* Update EntitySchema from branch 'master'
  to 6abfcffed6c333a9cac3f9e9986b53a3a84ec45e
  - Fix phpcbf exit code for lint-staged
    
    phpcbf exits with a failure exit code if there were any violations, even
    if they could all be fixed. This makes it useless in a lint-staged
    pipeline (which expects scripts to exit successfully, and will otherwise
    discard all changes and abort the commit), so wrap phpcbf in a small
    shell script checking the exit code and ignoring a 1 exit code. (Exit
    code 2 would mean that there were some errors that could not be fixed.)
    
    We can hopefully revert this when PHP_CodeSniffer version 4 is released,
    which is supposed to change the exit codes to make them more sensible
    (squizlabs/PHP_CodeSniffer#2898).
    
    Change-Id: Ida87fd259bd7cc1b6c0f789001a574865e435472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants