Created
April 20, 2026 19:20
-
-
Save harshildarji/915393567db1625bb9b375f68be1be1f to your computer and use it in GitHub Desktop.
Zsh function to autoflake + isort + black Python files, respecting .gitignore boundaries across nested git repos.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Format Python files respecting .gitignore boundaries | |
| # Requires: autoflake, isort, black | |
| clean() { | |
| if git rev-parse --git-dir >/dev/null 2>&1; then | |
| git ls-files -z --cached --others --exclude-standard '*.py' | xargs -0 autoflake --in-place --remove-unused-variables | |
| else | |
| autoflake -r --in-place --remove-unused-variables . | |
| fi | |
| isort --profile black --skip-gitignore . | |
| black . | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment