Skip to content

Conversation

@koriym
Copy link
Member

@koriym koriym commented Nov 9, 2025

Summary

Fixed rector-migrate.php configuration to allow users to specify their own project paths via command line instead of hardcoded vendor paths.

Problem

The previous configuration had withPaths([__DIR__ . '/src', __DIR__ . '/tests']) which pointed to:

  • vendor/ray/psr-cache-module/src
  • vendor/ray/psr-cache-module/tests

This was incorrect because users want to migrate their own code, not the vendor package code.

Solution

Removed the withPaths() configuration entirely. Users now specify paths on the command line:

vendor/bin/rector process src --config=vendor/ray/psr-cache-module/rector-migrate.php --dry-run
vendor/bin/rector process src tests --config=vendor/ray/psr-cache-module/rector-migrate.php

Changes

  • Removed withPaths() from rector-migrate.php
  • Updated usage documentation in file header remains correct

This follows the pattern from Ray.AuraSqlModule's rector-migrate.php.

Summary by Sourcery

Remove hardcoded paths from rector-migrate.php so users can specify their own source and test directories via command-line arguments instead of defaulting to vendor package code

Bug Fixes:

  • Prevent unintended migration of vendor code by eliminating withPaths configuration

Enhancements:

  • Delegate path configuration entirely to CLI parameters rather than static config

Summary by CodeRabbit

  • Chores
    • Updated code migration tool configuration to use default path processing instead of explicitly specified targets.

Remove hardcoded withPaths() configuration that pointed to vendor directory.
Users now specify their project paths via command line:
  vendor/bin/rector process src --config=vendor/ray/psr-cache-module/rector-migrate.php
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 9, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR refactors the rector-migrate.php configuration by removing the hardcoded withPaths call so that users can supply their own migration paths via the CLI, and ensures the file’s header usage instructions remain accurate.

Flow diagram for user-specified migration paths in rector-migrate.php

flowchart TD
    A["User runs rector command with custom paths"] --> B["rector-migrate.php configuration loaded"]
    B --> C["No hardcoded paths in configuration"]
    C --> D["Rector processes user-specified paths"]
Loading

File-Level Changes

Change Details Files
Eliminate hardcoded paths in rector-migrate.php
  • Removed the withPaths() invocation and its array of default src/tests paths
  • Rely on command-line arguments for specifying target directories
rector-migrate.php
Preserve and clarify usage documentation
  • Kept the header’s sample commands for running rector with user-provided paths
  • Ensured docs reflect removal of internal path configuration
rector-migrate.php

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Walkthrough

Removed the withPaths configuration from Rector's configuration file, eliminating explicit targets for the /src and /tests directories. The rest of the Rector configuration, including AnnotationToAttributeRector rules and mappings, remains unchanged. Rector will now use default path resolution.

Changes

Cohort / File(s) Summary
Rector configuration
rector-migrate.php
Removed withPaths() call that explicitly targeted __DIR__ . '/src' and __DIR__ . '/tests' directories, allowing default path resolution to apply

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verify that default Rector path resolution is appropriate for the project structure
  • Confirm no unintended side effects on which files Rector processes

Poem

🐰 A config line removed with care,
No more paths explicitly there,
Rector hops to defaults so free,
Simpler config, don't you see?
Less is more in the land of the deed! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing withPaths() configuration to allow user-specified paths when running rector-migrate.php.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-rector-paths

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e910db9 and 7378fb3.

📒 Files selected for processing (1)
  • rector-migrate.php (0 hunks)
💤 Files with no reviewable changes (1)
  • rector-migrate.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Sourcery review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@koriym
Copy link
Member Author

koriym commented Nov 9, 2025

@coderabbitai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e910db9) to head (7378fb3).
⚠️ Report is 2 commits behind head on 1.x.

Additional details and impacted files
@@             Coverage Diff             @@
##                 1.x       #32   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        38        38           
===========================================
  Files             24        24           
  Lines             90        90           
===========================================
  Hits              90        90           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@koriym koriym merged commit 96c36b1 into 1.x Nov 9, 2025
37 checks passed
@koriym koriym deleted the fix-rector-paths branch November 9, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants