asottile / pyupgrade

A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
MIT License
3.5k stars 177 forks source link

Ability to restrict changes to a specific type? #963

Closed lightswitch05 closed 1 month ago

lightswitch05 commented 1 month ago

Hello and thank you for everything you do here! I'm a new user and attempting to use this tool on a very old and large code base. As you can imagine, the amount of changes are staggering. I've spent some time looking at the docs - and maybe I just missed it - but is there a way to restrict the changes to a specific type?

Motive: Submitting a huge PR with all these changes is never going to get reviewed... I see two options available:

  1. split up the changes by directory/module
    • This will reduce the size of the PRs, but it doesn't reduce the complexity of the PRs. The reviewer still needs to be aware of each type of change made by this tool, and so there is still a lot of prep work or prerequisites for a proper review
  2. split up the change by change type
    • This will still produce huge PRs, but the cognitive load on the reviewer is much reduced. They are only required to know about a specific change type and can review only that change type across all the files.

Anywho, do you have any ideas or suggestions on how changes could be restricted to a certain type? Obviously I could just manually go thorough all the changes curating the changes type into appropriate PRs, but I feel like that might open up more possibilities for human error.

Thank you again for this great tool!

asottile commented 1 month ago

I have no idea what you want given just your vague title

lightswitch05 commented 1 month ago

I accidentally hit enter before filling out to description and you were too fast for me to finish writeing it 😆 😢 - actual description in progress

lightswitch05 commented 1 month ago

@asottile maybe you could have another glance now that I have a proper description?

asottile commented 1 month ago

I've already declined exactly this proposal many times

lightswitch05 commented 1 month ago

Sorry for the duplicate!