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
"composer validate" aborts with code 1 with "--no-check-lock" and JSON Text parse error on lock-file contents #10715
Comments
Sorry but that's not doable.. when loading a Composer instance the lock file is loaded if present, and if it is broken it fails hard at that point, no matter which command you are running. If you don't want a lock then don't create a null byte file.. |
Okay, this is a bit what I thought as well (from output it didn't look like it's from the validate command specifically). And yes, I did create the null byte composer.lock intentionally in explorative testing. What wondered me in the end thought is that an empty object as lock file prevented any errors to be shown regarding the lock file (e.g. the warning that it is out of date and one should run composer update) with the verify command. another edgy case - but a more real scenario - was that when the lock file is disabled in composer.json and an outdated composer.lock is still laying around (e.g. composer.json changed the lock config option between different checkouts or while rebasing), the verify command still suggests to run composer update (which will never write the lock file and therefore don't change a thing). anyway, this is sort of edge-case material. IIRC the last case can be turned into exit status 0 (SUCCESS) with the One idea I have would be to make For the case with |
That sounds maybe worth having a look.
This definitely sounds worth doing and easy enough
I'll try to take a look at this as well, sounds weird. |
&
I'll give this a try. However - and maybe you know from top of your head - for other composer commands than Because if not, an implicit |
Drafted a PR #10723 . It is about implicit --no-check-lock (when the setting config.log is false) that can be overridden w/ --check-lock (which always overrides --no-check-lock regardless of position as symfony console a) does not support vice-versa options for boolean b) the symfony console 5.3 workaround First commit is a small refactoring let me know if it is preferable or any other feedback, then I can offer to un-draft it and reduce the commits @Seldaek . |
if no lock-file is configured, turn lock file validation errors into warnings (implicit --no-check-lock) unless those are explicitly promoted via the new --check-lock option. - `{"config": {"lock": false}}` is an implicit `--no-check-lock` for composer validate. - `--check-lock` overrides an (implicit or explicit) `--no-check-lock`, always. issue: composer#10715
fix against 2.2 in pr 10723 now, thankfully @stof already brought me up speed in regard to diverse things incl. phpstan. |
Nope, it is not ignored, |
See #10726 for a fix of the lock: false behavior. IMO this is a more expected/intuitive behavior. |
I investigated that, and I believe it's because of Locker::isLocked returning false if the |
Nice & Thanks. |
given
and then creating a zero-byte
composer.lock
file"composer validate --no-check-lock" aborts with exit code 1 choking on the composer.lock file not being valid JSON Text.
Despite the
--no-check-lock
:Expected Behavior
The
composer.lock
file is not checked as per--no-check-lock
which should include dropping any errors in JSON Text processing if the file exists.Additional Info
Report against
An object with no properties prevents the abortion:
And interestingly further validation checks on the lock file (?):
Most of the validate messages related to the lock file with
lock: false
and--no-check-lock
appear noisy to me, but this is rather cosmetic.The text was updated successfully, but these errors were encountered: