mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Create a pre-commit hook which is copied on installation
Allow propogating specific files to format for black Update build messages for black update hook Update hook further, add related doc
This commit is contained in:
parent
4f7dd05d99
commit
bce9669d74
4 changed files with 44 additions and 3 deletions
12
.githooks/pre-commit
Executable file
12
.githooks/pre-commit
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$SEARXNG_PRECOMMIT" = "true" ]; then
|
||||
# inspired from: https://prettier.io/docs/en/precommit.html#option-4-shell-script
|
||||
staged_files=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
|
||||
python_files=$(echo "$staged_files" | grep '\.py$')
|
||||
# Only attempt to run the formatter if Python files were changes
|
||||
if [ -n "$python_files" ]; then
|
||||
echo "$python_files" | xargs ./manage format.python
|
||||
echo "$python_files" | xargs git add
|
||||
fi
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue