asottile / pyupgrade

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

Ability to restrict changes to a specific type? #963

Closed lightswitch05 closed 3 months ago

lightswitch05 commented 3 months 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 3 months ago

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

lightswitch05 commented 3 months 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 3 months ago

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

asottile commented 3 months ago

I've already declined exactly this proposal many times

lightswitch05 commented 3 months ago

Sorry for the duplicate!