-
Notifications
You must be signed in to change notification settings - Fork 707
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
Ability to run code formatters #45
Comments
filter-repo avoids checking out any of the files onto disk, which is part of its speedup. In that sense filter-repo's tree-filter is a bit easier to use here since your linting program probably expects the file on disk in normal format rather than trying to read it from git's history. However, contrib/filter-repo-demos/lint-history was specifically written to show how to lint files in history. You could just call it as Also, the lint-history example actually includes three different implementations of how to do it: one in a comment showing how you could do it without writing a full-fledged python script that imports filter-repo, one which does it as a blob callback assuming that it doesn't matter to the lint program what the name of the file is (it just writes every file to |
Thanks @newren, I'll try that out! It was close to working with:
but I needed to only reformat the python files and couldn't figure out how to limit it. Should be able to put something together with the lint-history commit-callback version! |
Perfect, got it working. Thanks again! |
Thanks for this! If anybody finds this useful, I extended @JacobHayes 's code to also reformat Jupyter notebook cells: https://github.com/shenker/nbcleanse/blob/master/nbcleanse.py |
Thanks @newren and people in this thread for the inspiration, here is another adaptation of the lint example. Files are processed in batches. Path to the style should be changed to the real one. Here is gist: 🔗 . |
Thanks everyone for posting examples here; I put a comment pointing at this issue in the lint-history code so that others will be more likely to find all your examples. |
Adapted your script into #464 that allows to add new or replace files produced from shell commands. |
Hi, thanks for this tool. Everything is pointing me here, but I can't seem to find a way to run things like black with this tool. With
git filter-branch
orfilter-lamely
, I can use the--tree-filter
to run something like:Given every command is directing me to use stock
git-filter-repo
, what's the right way to do this? It'd be nice to only run the command on files matching a pattern (ex:*.py
), but still keep unmatched files.The text was updated successfully, but these errors were encountered: