-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
given
{
"config": {
"lock": false
}
}
composer config lock false
and then creating a zero-byte composer.lock file
< /dev/null >| composer.lock
"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:
$ composer --no-ansi validate --no-check-lock
[Seld\JsonLint\ParsingException]
"./composer.lock" does not contain valid JSON
Parse error on line 1:
^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
validate [--no-check-all] [--no-check-lock] [--no-check-publish] [--no-check-version] [-A|--with-dependencies] [--strict] [--] [<file>]
$ echo $?
1
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
$ composer --version
Composer version 2.2.8 2022-03-15 12:55:20
An object with no properties prevents the abortion:
printf '{}' >| composer.lock
And interestingly further validation checks on the lock file (?):
$ composer config lock true # for brevity
$ composer --no-ansi validate --strict
./composer.json is valid
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.