Skip to content

Add --rules-summary option to display applied rules summary with count#7874

Merged
TomasVotruba merged 1 commit intorectorphp:mainfrom
carlos-granados:add-rules-summary
Apr 7, 2026
Merged

Add --rules-summary option to display applied rules summary with count#7874
TomasVotruba merged 1 commit intorectorphp:mainfrom
carlos-granados:add-rules-summary

Conversation

@carlos-granados
Copy link
Copy Markdown
Contributor

Adds a new --rules-summary CLI option that displays a summary of all rules applied during a Rector run, showing each rule name and the number of times it was applied (or would have been applied in dry-run mode). The list is sorted, showing the rules which were applied more often at the top. If the command line option is not set, then no summary will be printed by default.

This can be useful in a number of ways. For example:

  • To see which rules have been applied more often, so that maybe this can be communicated to the team.
  • To see which rules are never applied, to see if maybe they can be removed from the rector set.
  • When you are applying some rules that will create a big number of changes, see which rules are applied more often so that maybe you can tackle the rules that you apply in a specific order.
  • When a large number of rules are applied, maybe spot a rule that you wouldn't expect to be applied and check if this might be an issue with Rector.
  • etc...

@github-actions github-actions bot added the Stale label Apr 5, 2026
@TomasVotruba
Copy link
Copy Markdown
Member

I wasn't sure about this feature when I first saw it... thus delay in reply. But I see ways it can be useful to get a better idea about "most applied rules" stats. I do the same with PHPStan making my own extension.

Let's give this a go as an experimental feature and test it in the wild 👍 Thank you @carlos-granados

@TomasVotruba TomasVotruba merged commit de69d05 into rectorphp:main Apr 7, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants