Add PHPCS linting for PHP blocks in feature files - #340
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change adds PHP extraction and synchronization for ChangesFeature PHP checks
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Developer
participant run_phpcs_tests
participant extract_feature_php
participant PHPCS
participant FeatureFiles
Developer->>run_phpcs_tests: run checks
run_phpcs_tests->>extract_feature_php: extract PHP blocks
extract_feature_php->>FeatureFiles: read .feature files
extract_feature_php-->>run_phpcs_tests: create temporary PHP files
run_phpcs_tests->>PHPCS: check temporary PHP files
PHPCS-->>run_phpcs_tests: return check status
run_phpcs_tests-->>Developer: exit with accumulated status
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PHPStan (2.2.7)PHPStan was skipped because the config uses disallowed Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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_01KVnFXuhCGs4NT2A7FmDo4e
|
@coderabbitai review |
✅ Action performedReview finished.
|
Not sure yet if really worth it, will need some testing.
Summary by CodeRabbit
New Features
Bug Fixes
Style
Tests