Skip to content

Add rule-complexity-score dev script - #8757

Closed
TomasVotruba wants to merge 2 commits into
mainfrom
worktree-rule-complexity-score
Closed

TomasVotruba wants to merge 2 commits into
mainfrom
worktree-rule-complexity-score

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Adds scripts/rule-complexity-score.php, a dev tool that ranks Rector rules by how much code they need to run.

For each rule it reports:

  • Deps - number of constructor-injected service dependencies (direct)
  • Own LOC - lines of the rule file itself
  • Deps LOC - lines of every class reachable transitively through those dependencies

Score: own LOC + deps * dep-weight + deps LOC, sorted highest first. The table also lists the test fixture count per rule - the more fixtures, the more edge cases the rule has had to cover, so the higher the risk it is still unreliable.

Scans rules/ plus the sibling packages (doctrine, phpunit, symfony, downgrade-php).

php scripts/rule-complexity-score.php --top=50 --dep-weight=50

Reuses the existing RectorClassFinder. Passes ECS and PHPStan level 8.

@TomasVotruba
TomasVotruba marked this pull request as draft October 21, 2026 21:55
@TomasVotruba
TomasVotruba deleted the worktree-rule-complexity-score branch October 22, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants