-
Notifications
You must be signed in to change notification settings - Fork 1.5k
--no-patch option returns error code 1 on composer script #1270
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
Comments
According to #666 you need to add If I'm not mistaken the error code tells, that something was fixed. |
Sorry I closed it without testing it.
|
Furthermore no file is fixed. |
When using the This isn't that useful because it means you can't actually check the return value of PHPCS. But also, patching using I changed the return value in 3.0 to return the number of errors found, which is a little better but, on reflection, still not good. 3.0 has a concept of "total number of fixed errors" so I think I can probably get the return value working a bit better in there. I've already changed the return values of PHPCS in 3.0, so I don't think there is a problem changing PHPCBF a bit more as well. But I don't want to mess with return values in the 2.x version, especially given I don't think they will be accurate. So for now, you'll need to ignore the return value. I'll try and fix up the 3.0 version and commit that as a fix for this issue, but you'll need to upgrade to 3.0 before you can accurately check the return value of PHPCBF. |
I've changed the PHPCBF exit codes to this:
Those mirror what the current 2.x version tries to do when using Do those exit codes look sane to you? |
I didn't found the way to describe --no-patch option in xml config, so i put it in composer.json. The bad thing is `composer phpcbf` always returns exit code 1: `Script phpcbf --no-patch handling the phpcbf event returned with error code 1` It is because When using the `--no-patch` option, PHPCS doesn't know if any errors were actually fixed because there is no patch file to look at, so it has always return `1` [src](squizlabs/PHP_CodeSniffer#1270 (comment)), so you should just ignore that error. In the PHPCS 3 --no-patch will be removed.
Seems like when you using xml config there is `--no-patch` option by default. Because that the `composer phpcbf` will always returns exit code 1: `Script phpcbf --no-patch handling the phpcbf event returned with error code 1` It is because when using the `--no-patch` option, PHPCS doesn't know if any errors were actually fixed because there is no patch file to look at, so it has always return `1` [src](squizlabs/PHP_CodeSniffer#1270 (comment)), so you should just ignore that error. In the PHPCS 3 --no-patch will be removed.
Seems like when you using xml config there is `--no-patch` option by default. Because that the `composer phpcbf` will always returns exit code 1: `Script phpcbf --no-patch handling the phpcbf event returned with error code 1` It is because when using the `--no-patch` option, PHPCS doesn't know if any errors were actually fixed because there is no patch file to look at, so it has always return `1` [src](squizlabs/PHP_CodeSniffer#1270 (comment)), so you should just ignore that error. In the PHPCS 3 --no-patch will be removed.
Seems like when you using xml config there is `--no-patch` option by default. Because that the `composer phpcbf` will always returns exit code 1: `Script phpcbf --no-patch handling the phpcbf event returned with error code 1` It is because when using the `--no-patch` option, PHPCS doesn't know if any errors were actually fixed because there is no patch file to look at, so it has always return `1` [src](squizlabs/PHP_CodeSniffer#1270 (comment)), so you should just ignore that error. In the PHPCS 3 --no-patch will be removed.
Seems like when you using xml config there is `--no-patch` option by default. Because that the `composer phpcbf` will always returns exit code 1: `Script phpcbf --no-patch handling the phpcbf event returned with error code 1` It is because when using the `--no-patch` option, PHPCS doesn't know if any errors were actually fixed because there is no patch file to look at, so it has always return `1` [src](squizlabs/PHP_CodeSniffer#1270 (comment)), so you should just ignore that error. In the PHPCS 3 --no-patch will be removed.
Inside my composer I have added the following command/script
When I execute
composer phpcbf
I getAs a result the second script is never executed. If I remove the --no-patch option the second script is executed.
Version: 2.7.1
The text was updated successfully, but these errors were encountered: