Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive mode? #46

Closed
alok opened this issue Jul 15, 2018 · 4 comments
Closed

Recursive mode? #46

alok opened this issue Jul 15, 2018 · 4 comments

Comments

@alok
Copy link

alok commented Jul 15, 2018

Currently I run pyupgrade with something like find ... | xargs pyupgrade. A recursive flag to drill down directories would be nice (and in line with a lot of other formatters like black, yapf, and isort).

@asottile
Copy link
Owner

instead I'd suggest leveraging pre-commit -- implementing --recursive opens a whole can of worms with --include / --exclude / parsing shebangs / whitelists / blacklists that I'm really not interested in re-implementing. Fortunately, pre-commit is great at running linters / fixers and already supports this.

@asottile
Copy link
Owner

and if you need a "run once" mode, I'd suggest pre-commit try-repo https://github.com/asottile/pyupgrade --all-files

@alok
Copy link
Author

alok commented Jul 15, 2018

Oh that's neat! I didn't know about the --all-files option. That's perfect.

@impredicative
Copy link

impredicative commented Dec 29, 2019

To offer some contrast, I think using https://pre-commit.com/ opens a whole can of worms, and it's shameless to need to require it. The following is simple and works in Bash:

shopt -s globstar
pyupgrade ./**/*.py

Repository owner locked as resolved and limited conversation to collaborators Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants