You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
quality.yml: a missing phpcs composer script passes VACUOUSLY (composer exit 1 read as 'warnings only') #121
In .github/workflows/quality.yml, the phpcs leg maps composer's exit code 1 to success. Composer itself exits 1 when the requested script does not exist, so a repo with no phpcs composer script gets a green "PHP Quality (phpcs)" tick forever.
The code
.github/workflows/quality.yml, the phpcs) branch of the Run ${{ matrix.tool }} step:
# Exit code 0 = clean, 1 = warnings only, 2 = errors found.# We treat warnings as non-blocking (exit 1 → success).
RC=0
composer phpcs || RC=$?if [ "$RC"-eq 1 ];thenecho"::warning::PHPCS found warnings but no errors — passing."exit 0
fiexit$RC
The comment describes phpcs's exit codes, but RC captures composer's. Composer returns 1 both for "the script ran and returned 1" and for "there is no such script".
##[error]Command "phpcs" is not defined.
##[warning]PHPCS found warnings but no errors — passing.
app-versions has no phpcs.xml and no phpcs composer script; it uses php-cs-fixer. Its phpmd and phpstan legs correctly went red with Command "…" is not defined. — only phpcs swallowed it, because only phpcs has the exit-1 special case.
Impact
Any fleet repo that has never adopted phpcs shows a passing phpcs job. Because a gate's absence and a gate's success look identical in the checks list, this is indistinguishable from coverage. enable-phpcs defaults to true, so it applies by default.
Suggested fix
Assert the script exists before interpreting its exit code:
if! composer run-script --list 2>/dev/null | grep -qE '^\s*phpcs\s';thenecho"::error::enable-phpcs is true but this repo has no 'phpcs' composer script."exit 1
fi
RC=0
composer phpcs || RC=$?
...
The same existence check is worth applying to every tool leg — it turns today's confusing Command "phpmd" is not defined. failure into an actionable message, and closes the phpcs hole.
Context
Found while repairing composer check:strict in openbuild, nldesign and app-versions. Related: ConductionNL/app-versions#118.
Post-merge verification. Run 30766687154 on ConductionNL/petstore (branch feature/dotgithub-121-proof, composer.json with the phpcs script deliberately renamed away) was re-run at the same SHA before and after the merge. Nothing in petstore changed; only ConductionNL/.github@main did.
attempt 1 (pre-merge main): quality / PHP Quality (phpcs) → success, with ##[warning]PHPCS found warnings but no errors — passing. immediately after composer's Did you mean one of these? suggestion list.
##[error]The 'phpcs' gate is enabled but composer.json declares no 'phpcs' script. Add it under "scripts", or turn the gate off with the enable-phpcs input.
##[error]Process completed with exit code 1.
Blast radius: one repo, one leg. All 19 org consumers of quality.yml were swept for the six gate scripts in their default-branch composer.json. Eighteen declare all six and are unaffected. Only ConductionNL/app-versions changes: its PHP Quality (phpcs) tick goes green → red. Its phpmd / phpstan / phpmetrics legs were already red for the same missing-script reason; phpcs was the only one being swallowed. One-line fix on that side: enable-phpcs: false in .github/workflows/code-quality.yml (ConductionNL/versioniq#118).
The proof branch ConductionNL/petstore@feature/dotgithub-121-proof is left in place as an inspectable evidence trail. It is not attached to a PR and must not be merged — it renames petstore's phpcs composer script.
Activity
test(ci): CELL B — phpcs composer script REMOVED
test(ci): CELL C — same missing phpcs script, but against UNFIXED @main
fix(quality): a missing composer gate script must fail, not pass vacu…
rubenvdlinde commentedon Aug 2, 2026
Fixed in #123 (merged to
main).Post-merge verification. Run 30766687154 on
ConductionNL/petstore(branchfeature/dotgithub-121-proof,composer.jsonwith thephpcsscript deliberately renamed away) was re-run at the same SHA before and after the merge. Nothing in petstore changed; onlyConductionNL/.github@maindid.main):quality / PHP Quality (phpcs)→ success, with##[warning]PHPCS found warnings but no errors — passing.immediately after composer'sDid you mean one of these?suggestion list.main):quality / PHP Quality (phpcs)→ failure:Blast radius: one repo, one leg. All 19 org consumers of
quality.ymlwere swept for the six gate scripts in their default-branchcomposer.json. Eighteen declare all six and are unaffected. OnlyConductionNL/app-versionschanges: itsPHP Quality (phpcs)tick goes green → red. Itsphpmd/phpstan/phpmetricslegs were already red for the same missing-script reason;phpcswas the only one being swallowed. One-line fix on that side:enable-phpcs: falsein.github/workflows/code-quality.yml(ConductionNL/versioniq#118).The proof branch
ConductionNL/petstore@feature/dotgithub-121-proofis left in place as an inspectable evidence trail. It is not attached to a PR and must not be merged — it renames petstore'sphpcscomposer script.fix(quality): phpmd DevelopmentCodeFragment could never fire on names…
fix(quality): drop the file-presence guard masking a missing phpmd (#…
fix(quality): phpmd DevelopmentCodeFragment could never fire on names…