Skip to content

Instantly share code, notes, and snippets.

@adigitoleo
Created February 22, 2022 00:11
Show Gist options
  • Save adigitoleo/57c59edcd5180d431efdeceb5471eb73 to your computer and use it in GitHub Desktop.
Save adigitoleo/57c59edcd5180d431efdeceb5471eb73 to your computer and use it in GitHub Desktop.
Python black pre-commit hook
#!/bin/sh
# Copy or link this script into .git/hooks/
# It runs automatically in the project root directory (parent of .git/).
# Code formatting
if black --check src/pydrex; then
exit 0
else
black src/pydrex
git add -u
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment