Skip to content

Commit a88c6b2

Browse files
swissspidyclaude
andcommitted
Address review feedback on the quiet mode docs and the Gherkin runner
Two findings from the review of the merge commit: WP_CLI_TEST_QUIET was described as switching "the reporters" to their most compact form, which overpromised. It reaches the analysis of the PHP files; the checks over the PHP blocks extracted from feature files keep their own reports, because both rewrite their findings back onto the feature file a block came from and a compact report is not what those rewrites are written against. The README now says so. A signal handler resumes where it left off rather than ending the script, so after an interrupt the Gherkin runner went on to read its report back out of the file the handler had just removed. The cleanup on EXIT stays; HUP, INT and TERM now clean up and stop, with the 128+n status a shell reports for a death by signal. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GjJi6F76YZBt7cRrvXS6s6
1 parent 6c08829 commit a88c6b2

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎.readme-partials/USING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ this package's `package.json`, which exists only to hold that pin.
261261
Two environment variables make the test tools less chatty. Both are unset by default, which leaves the output exactly as it has always been.
262262

263263
* `NO_COLOR` (the [no-color.org](https://no-color.org/) convention) turns off the ANSI color codes in the output of every runner. Set this when capturing output to a file or a pipe, where the escape sequences are noise.
264-
* `WP_CLI_TEST_QUIET` switches the reporters to their most compact form: PHP_CodeSniffer reports one `file:line:col` line per violation with no progress ticker, PHPStan reports one `file:line:message` line per error with no progress bar and no result table. Behat's own output is already minimal, so it is unaffected.
264+
* `WP_CLI_TEST_QUIET` switches the reporters to their most compact form: PHP_CodeSniffer reports one `file:line:col` line per violation with no progress ticker, PHPStan reports one `file:line:message` line per error with no progress bar and no result table. This covers the analysis of the PHP files themselves; the checks over the PHP blocks embedded in feature files keep their own reports, which are rewritten to point back at the feature file a block came from. Behat's own output is already minimal, so it is unaffected.
265265
266266
`NO_COLOR` also covers the Gherkin linter, which colors its report unconditionally and has no plain output format of its own.
267267

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ this package's `package.json`, which exists only to hold that pin.
220220
Two environment variables make the test tools less chatty. Both are unset by default, which leaves the output exactly as it has always been.
221221

222222
* `NO_COLOR` (the [no-color.org](https://no-color.org/) convention) turns off the ANSI color codes in the output of every runner. Set this when capturing output to a file or a pipe, where the escape sequences are noise.
223-
* `WP_CLI_TEST_QUIET` switches the reporters to their most compact form: PHP_CodeSniffer reports one `file:line:col` line per violation with no progress ticker, PHPStan reports one `file:line:message` line per error with no progress bar and no result table. Behat's own output is already minimal, so it is unaffected.
223+
* `WP_CLI_TEST_QUIET` switches the reporters to their most compact form: PHP_CodeSniffer reports one `file:line:col` line per violation with no progress ticker, PHPStan reports one `file:line:message` line per error with no progress bar and no result table. This covers the analysis of the PHP files themselves; the checks over the PHP blocks embedded in feature files keep their own reports, which are rewritten to point back at the feature file a block came from. Behat's own output is already minimal, so it is unaffected.
224224
225225
`NO_COLOR` also covers the Gherkin linter, which colors its report unconditionally and has no plain output format of its own.
226226

‎bin/run-gherkin-lint-tests‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ then
7272
# It writes the report to STDERR, so strip the escape sequences from that
7373
# stream while leaving STDOUT and the exit code alone.
7474
STDERR_FILE=$( mktemp )
75-
trap 'rm -f "${STDERR_FILE}"' EXIT HUP INT TERM
75+
trap 'rm -f "${STDERR_FILE}"' EXIT
76+
77+
# A signal handler resumes where it left off, so stopping here is what keeps
78+
# the report below from being read back out of the file the handler has just
79+
# removed. 128+n is the status a shell reports for a death by signal n.
80+
trap 'rm -f "${STDERR_FILE}"; exit 129' HUP
81+
trap 'rm -f "${STDERR_FILE}"; exit 130' INT
82+
trap 'rm -f "${STDERR_FILE}"; exit 143' TERM
7683

7784
run_linter "$@" 2> "${STDERR_FILE}"
7885
STATUS=$?

0 commit comments

Comments
 (0)