feat(dev): Add php-forge/coding-standard to development dependencies for code quality checks.#5
Conversation
…s for code quality checks.
📝 WalkthroughWalkthroughConsolidates tooling by switching to external coding-standard configs, simplifying in-repo ECS/Rector setups, updating composer dev dependencies and scripts (adds sync-metadata), adds Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Composer as Composer (script)
participant Remote as Remote Template (HTTP)
participant FS as Local Filesystem
Dev->>Composer: run `composer run sync-metadata`
Composer->>Remote: curl fetch template archive/files
Remote-->>Composer: return config files (.editorconfig, .gitattributes, .gitignore, phpstan.neon)
Composer->>FS: write/overwrite files to repo
FS-->>Dev: files updated (sync complete)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@composer.json`:
- Around line 42-47: The composer.json "sync-metadata" script currently fetches
only four files but the docs/development.md claim six; update the
"sync-metadata" script (the "sync-metadata" array in composer.json) to include
the missing curl commands to fetch infection.json5 and phpunit.xml.dist (or
alternatively update docs/development.md to reflect the four-file behavior) so
the script and documentation are consistent—locate the "sync-metadata" entry and
add curl -fsSL -o infection.json5 <url> and curl -fsSL -o phpunit.xml.dist <url>
(or edit the docs to remove the two files).
In `@docs/development.md`:
- Around line 18-25: The file table in docs lists five files but the composer
script named "sync-metadata" only fetches four; update the table in
development.md to match the actual files synced by the "sync-metadata" script
(remove `infection.json5` and `phpunit.xml.dist` and keep `.editorconfig`,
`.gitattributes`, `.gitignore`, and `phpstan.neon`) so documentation aligns with
the composer.json script behavior and ensure the table header/format remains
intact.
In `@docs/testing.md`:
- Around line 12-58: Add a "tests" entry to the composer.json "scripts" section
so the documented composer run tests -- --filter ... invocation works;
specifically add a "tests" script key that runs PHPUnit (e.g. using
"vendor/bin/phpunit" or an equivalent project-specific test runner) and supports
forwarding args, update composer.json's scripts to include "tests" so references
in docs/testing.md are accurate.
In `@ecs.php`:
- Around line 5-12: The file fails at the require of
vendor/php-forge/coding-standard/config/ecs.php because that package/config is
missing; replace or remove the external dependency by either installing/renaming
the correct package so the path exists, or refactor to use ECS native
configuration: instantiate or obtain an ECSConfigBuilder (the $ecsConfigBuilder
variable) via ECSConfig::configure() (or equivalent) and call withPaths(...) on
it, or point the require to an existing local config file; ensure the unique
symbols ($ecsConfigBuilder, withPaths) are preserved and return the configured
builder.
🧹 Nitpick comments (2)
composer.json (1)
42-47: Consider using a template from the same organization.The script fetches configuration files from
yii2-extensions/template, but this package belongs toui-awesome. Using a template from a different organization may lead to configuration drift or unexpected changes when the external template is updated.rector.php (1)
5-8: Avoid hard-coded vendor path for imported Rector config.Using
__DIR__ . '/vendor/...'breaks ifvendor-diris customized or the package layout changes. Consider resolving the install path via Composer’s runtime API and failing fast with a clear error.♻️ Suggested adjustment
use Rector\Config\RectorConfig; +use Composer\InstalledVersions; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->import(__DIR__ . '/vendor/php-forge/coding-standard/config/rector.php'); + $codingStandardPath = InstalledVersions::getInstallPath('php-forge/coding-standard'); + if ($codingStandardPath === null) { + throw new RuntimeException('php-forge/coding-standard is not installed. Run composer install --dev.'); + } + $rectorConfig->import($codingStandardPath . '/config/rector.php');
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Pull Request
Summary by CodeRabbit
New Features
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.