Repository navigation
Commit 6a3fbc8
committed
Address review feedback on feature file PHP checks
Fixes for the PHP block extraction and synchronization:
* Place an added `<?php` tag on the docstring delimiter line, so that it
is no longer overwritten by the first line of code and blocks without an
opening tag are actually linted as PHP.
* Only treat a docstring as PHP when it follows a step creating a PHP file
or starts with `<?php`. Expectations such as `Then the wp-config.php
file should contain:` are not necessarily valid PHP and must not be
reformatted.
* Determine the indentation to restore from the first line holding code,
as a leading empty line would otherwise be used as indentation.
* Remove only the padding added during extraction instead of all leading
and trailing empty lines, preserving intentional ones.
* Keep empty lines leading up to an opening tag, so that reported line
numbers keep matching.
* Only remove files from the target directory that a previous extraction
created, and refuse target directories that hold the feature files
themselves.
* Only treat the first argument as an action when it is one, so that
passing two directories does not swap source and target.
* Report failures on STDERR and through the exit code.
* Skip a block instead of writing it back when the extracted file no
longer lines up with the feature file.
Fixes for the scripts running the checks:
* Propagate failures of the extraction, PHPCS, PHPCBF and synchronization
steps, and skip synchronization when extraction failed.
* Preserve the PHPCS exit status by writing the report to a file instead
of piping it through `sed`.
* Keep nested directories when normalizing reported feature file paths.
Adds unit tests covering extraction and synchronization.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KVnFXuhCGs4NT2A7FmDo4e1 parent b32a615 commit 6a3fbc8
4 files changed
Lines changed: 833 additions & 64 deletions
File tree
- bin
- tests/tests
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 18 | + | |
| 19 | + | |
21 | 20 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 19 | + | |
21 | 20 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
25 | 40 | | |
26 | 41 | | |
27 | 42 | | |
| |||
0 commit comments