Skip to content

Commit 0e3da79

Browse files
authored
fix(quality): remove PHP test scripts that manufacture a green in a repo with no PHP tests (#19)
This is a Python ExApp with no phpunit.xml and no PHP test suite. The test:unit/test:all scripts echoed SKIPPED and exited 0, and the check chains counted that as a passing test leg. Removed; the check chains now state plainly that they are static analysis only.
1 parent 43b3037 commit 0e3da79

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

composer.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,12 @@
2525
"phpmetrics:violations": "./vendor/bin/phpmetrics --violations-xml=phpmetrics/violations.xml phpcs-custom-sniffs",
2626
"psalm": "./vendor/bin/psalm --threads=1 --no-cache",
2727
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=1G",
28-
"test:unit": "if [ -f phpunit.xml ] || [ -f phpunit.xml.dist ]; then ./vendor/bin/phpunit --colors=always; else echo 'SKIPPED: no phpunit.xml in this repo - there is no PHP test suite to run'; fi",
29-
"test:all": "if [ -f phpunit.xml ] || [ -f phpunit.xml.dist ]; then ./vendor/bin/phpunit --colors=always; else echo 'SKIPPED: no phpunit.xml in this repo - there is no PHP test suite to run'; fi",
30-
"check": "E=0; for CMD in lint phpcs psalm test:unit; do echo; echo \"=== $CMD ===\"; composer $CMD || E=1; done; echo; if [ $E -eq 0 ]; then echo \"ALL CHECKS PASSED\"; else echo \"SOME CHECKS FAILED (see above)\"; fi; exit $E",
31-
"check:full": "E=0; for CMD in lint phpcs psalm phpstan test:all; do echo; echo \"=== $CMD ===\"; composer $CMD || E=1; done; echo; if [ $E -eq 0 ]; then echo \"ALL CHECKS PASSED\"; else echo \"SOME CHECKS FAILED (see above)\"; fi; exit $E",
32-
"check:strict": "E=0; for CMD in lint phpcs phpmd psalm phpstan test:all; do echo; echo \"=== $CMD ===\"; composer $CMD || E=1; done; echo; if [ $E -eq 0 ]; then echo \"ALL CHECKS PASSED\"; else echo \"SOME CHECKS FAILED (see above)\"; fi; exit $E",
28+
"check": "E=0; for CMD in lint phpcs psalm; do echo; echo \"=== $CMD ===\"; composer $CMD || E=1; done; echo; if [ $E -eq 0 ]; then echo \"ALL CHECKS PASSED - STATIC ANALYSIS ONLY, THIS REPO HAS NO TESTS.\"; else echo \"SOME CHECKS FAILED (see above)\"; fi; exit $E",
29+
"check:full": "E=0; for CMD in lint phpcs psalm phpstan; do echo; echo \"=== $CMD ===\"; composer $CMD || E=1; done; echo; if [ $E -eq 0 ]; then echo \"ALL CHECKS PASSED - STATIC ANALYSIS ONLY, THIS REPO HAS NO TESTS.\"; else echo \"SOME CHECKS FAILED (see above)\"; fi; exit $E",
30+
"check:strict": "E=0; for CMD in lint phpcs phpmd psalm phpstan; do echo; echo \"=== $CMD ===\"; composer $CMD || E=1; done; echo; if [ $E -eq 0 ]; then echo \"ALL CHECKS PASSED - STATIC ANALYSIS ONLY.\"; echo \"This is a Python ExApp: the application lives in ex_app/lib/, and the only\"; echo \"PHP in the repo is phpcs-custom-sniffs/. There is NO automated test suite of\"; echo \"any kind - no phpunit.xml, no tests/, no pytest config, no test_*.py - and\"; echo \"the Makefile 'test' target is an interactive 'docker run -it' that asserts\"; echo \"nothing and cannot run in CI. This green therefore says NOTHING about\"; echo \"behaviour. Do not re-add a test:all script until a real suite exists.\"; else echo \"SOME CHECKS FAILED (see above)\"; fi; exit $E",
3331
"fix": [
3432
"@cs:fix"
3533
],
36-
"test:coverage": "./vendor/bin/phpunit --coverage-html=coverage/html --coverage-clover=coverage/clover.xml --colors=always",
37-
"coverage:check": "php -r \"\\$xml = simplexml_load_file('coverage/clover.xml'); \\$metrics = \\$xml->project->metrics; \\$statements = (int)\\$metrics['statements']; \\$covered = (int)\\$metrics['coveredstatements']; \\$percentage = \\$statements > 0 ? round((\\$covered / \\$statements) * 100, 2) : 0; echo 'Coverage: ' . \\$percentage . '%' . PHP_EOL; exit(\\$percentage < 75 ? 1 : 0);\"",
3834
"quality:phpcs-score": "./vendor/bin/phpcs --standard=phpcs.xml --report=json phpcs-custom-sniffs | php -r \"\\$json = json_decode(file_get_contents('php://stdin'), true); \\$errors = \\$json['totals']['errors'] ?? 0; \\$warnings = \\$json['totals']['warnings'] ?? 0; \\$score = 1000 - \\$errors - (\\$warnings / 2); echo 'PHPCS Score: ' . \\$score . ' (Errors: ' . \\$errors . ', Warnings: ' . \\$warnings . ')' . PHP_EOL;\"",
3935
"quality:phpmd-score": "./vendor/bin/phpmd phpcs-custom-sniffs json phpmd.xml | php -r \"\\$input = file_get_contents('php://stdin'); \\$json = json_decode(\\$input, true); \\$violations = count(\\$json['files'] ?? []); \\$score = 1000 - (\\$violations * 10); echo 'PHPMD Score: ' . \\$score . ' (Violations: ' . \\$violations . ')' . PHP_EOL;\" || echo 'PHPMD not available'",
4036
"quality:psalm-score": "./vendor/bin/psalm --output-format=json --no-cache | php -r \"\\$input = file_get_contents('php://stdin'); \\$json = json_decode(\\$input, true); \\$errors = count(\\$json ?? []); \\$score = 1000 - (\\$errors * 5); echo 'Psalm Score: ' . \\$score . ' (Errors: ' . \\$errors . ')' . PHP_EOL;\" || echo 'Psalm not available'",

0 commit comments

Comments
 (0)