diff --git a/hydra-gates/scripts/lib/test_check_coding_standard_adoption.sh b/hydra-gates/scripts/lib/test_check_coding_standard_adoption.sh index 31e889f7..7c236bdf 100755 --- a/hydra-gates/scripts/lib/test_check_coding_standard_adoption.sh +++ b/hydra-gates/scripts/lib/test_check_coding_standard_adoption.sh @@ -132,7 +132,10 @@ probe() { local name="$1" expect="$2"; shift 2 local d="$WORK/$name" rm -rf "$d"; scaffold "$d" - ( cd "$d" && eval "$@" ) + # Every probe below passes its defect as ONE shell string (quoted sed/rm + # commands), so the string form is what this has always meant. eval "$@" + # only looked array-shaped — SC2294. + ( cd "$d" && eval "$*" ) local o; o="$(run "$d")" if printf '%s' "$o" | grep -q "FAIL ${expect}:"; then ok "detects ${name} (${expect})" diff --git a/hydra-gates/scripts/lib/test_gate_license_triangle_scope.sh b/hydra-gates/scripts/lib/test_gate_license_triangle_scope.sh index 94bd07ba..edbb71c1 100755 --- a/hydra-gates/scripts/lib/test_gate_license_triangle_scope.sh +++ b/hydra-gates/scripts/lib/test_gate_license_triangle_scope.sh @@ -97,7 +97,26 @@ _mkrepo() { git config user.email "ci@example.invalid" git config user.name "gate28 test" printf '\nfixture1.0.0\n' > appinfo/info.xml - printf '{\n "name": "conduction/fixture",\n "license": "EUPL-1.2"\n}\n' > composer.json + # gate-65 (coding-standard-adoption) is deliberately NOT diff-scoped: + # it judges the repo's standing configuration, so it fires on this + # fixture too. Two assertions below require the whole run to end + # GREEN, and a fixture that has not adopted the shared standard cannot + # produce that — the arm would be measuring gate-65 instead of gate-28. + # So the fixture adopts it, mirroring the compliant scaffold in + # test_check_coding_standard_adoption.sh. + printf '{\n "name": "conduction/fixture",\n "license": "EUPL-1.2",\n "require-dev": {\n "conduction/coding-standard": "^1.0"\n },\n "scripts": {\n "cs:check": "php-cs-fixer fix --dry-run --diff",\n "cs:fix": "php-cs-fixer fix"\n }\n}\n' > composer.json + # Quoted heredoc, not printf: the body is PHP and contains `$config`, + # which printf-with-single-quotes makes ShellCheck read as a shell + # expansion that will not expand (SC2016). <<'PHP' says "verbatim" to + # the shell and to the reader at once. + cat > .php-cs-fixer.dist.php <<'PHP' +getFinder()->in(__DIR__ . '/lib'); +return $config; +PHP + printf 'root = true\n\n[*]\nindent_style = tab\n' > .editorconfig printf 'name: ci\non: push\njobs:\n a:\n runs-on: ubuntu-latest\n steps:\n - run: echo base\n' > .github/workflows/ci.yml if [ "${_withlib}" = "yes" ]; then mkdir -p lib @@ -379,8 +398,14 @@ fi # (composer-audit) applicable, and it fails on a fixture with no vendor # tree — `_FAILED` becomes 1 and the coverage sentence is unreachable # again. The diff must contain the lib PHP file and nothing else. +# For the same reason the rewrite below drops ONLY the licence field and +# keeps the coding-standard wiring: rewriting composer.json down to a +# bare name also un-adopts the shared standard, gate-65 fails, `_FAILED` +# is 1 again and the coverage sentence this control reads is never +# reached — the control would report the coverage requirement inert when +# it is simply never consulted. _mkrepo scope-nolicense-fullcov yes -printf '{\n "name": "conduction/fixture"\n}\n' > "${_REPO}/composer.json" +printf '{\n "name": "conduction/fixture",\n "require-dev": {\n "conduction/coding-standard": "^1.0"\n },\n "scripts": {\n "cs:check": "php-cs-fixer fix --dry-run --diff",\n "cs:fix": "php-cs-fixer fix"\n }\n}\n' > "${_REPO}/composer.json" git -C "${_REPO}" add -A >/dev/null 2>&1 git -C "${_REPO}" commit -qm "drop the composer license field" >/dev/null 2>&1 _BASE="$(git -C "${_REPO}" rev-parse HEAD)" diff --git a/hydra-gates/scripts/test-fixtures/gate-acceptance/COVERED-ELSEWHERE.md b/hydra-gates/scripts/test-fixtures/gate-acceptance/COVERED-ELSEWHERE.md index eec51705..c0bc3f2e 100644 --- a/hydra-gates/scripts/test-fixtures/gate-acceptance/COVERED-ELSEWHERE.md +++ b/hydra-gates/scripts/test-fixtures/gate-acceptance/COVERED-ELSEWHERE.md @@ -32,3 +32,4 @@ identically to `UNCOVERED.md`. | gate-32 | semantic-controls | `test_gates_23_33_never_green_over_nothing.sh` | `test-fixtures/gates-23-33/{planted,clean}` | | gate-33 | axe-core | `test_gates_23_33_never_green_over_nothing.sh` | `test-fixtures/gates-23-33/{planted,clean}` | | gate-61 | listener-work-placement | `test_gate_scope_matrix.sh` | `test-fixtures/scope-matrix/app` — push / full / diff matrix, `.github#347` | +| gate-65 | coding-standard-adoption | `test_check_coding_standard_adoption.sh` | scaffolded in-suite — 15 planted single-defect probes (one rule each) plus a negative control that fails if a broadened rule starts matching the compliant scaffold, and a wiring assertion that the checker printed its terminal `checked N rule(s)` summary |