Last active
August 8, 2023 12:47
-
-
Save yasinuygun/5d0dc399d3346113e2b77504c3d6b250 to your computer and use it in GitHub Desktop.
yapf pre-commit git hook
This file contains 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
#!/bin/sh | |
# Run yapf on modified Python files | |
files=$(git diff --cached --name-only --diff-filter=AM | grep -E '\.py$') | |
if [ -n "$files" ]; then | |
yapf --style "{based_on_style: pep8, column_limit: 120}" -i $files | |
git add $files | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment