Initial commit
This commit is contained in:
commit
fa9f56a5ed
7 changed files with 102 additions and 0 deletions
14
pre-commit.d/autoflake.sh
Executable file
14
pre-commit.d/autoflake.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
FILES=$(git diff --cached --name-only --diff-filter=ACM "*.py" | sed 's| |\\ |g')
|
||||
|
||||
if [ ! -z "$FILES" ]; then
|
||||
# Format all selected files
|
||||
echo "$FILES" | xargs -I {} /bin/bash -c "/home/sonny/.local/bin/autoflake --in-place --remove-unused-variables {}"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add back the modified files to staging
|
||||
echo "$FILES" | xargs git add
|
||||
fi
|
||||
14
pre-commit.d/isort.sh
Executable file
14
pre-commit.d/isort.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
FILES=$(git diff --cached --name-only --diff-filter=ACM "*.py" | sed 's| |\\ |g')
|
||||
|
||||
if [ ! -z "$FILES" ]; then
|
||||
# Format all selected files
|
||||
echo "$FILES" | xargs ./env/bin/isort
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add back the modified/prettified files to staging
|
||||
echo "$FILES" | xargs git add
|
||||
fi
|
||||
14
pre-commit.d/prettier.sh
Executable file
14
pre-commit.d/prettier.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
FILES=$(git diff --cached --name-only --diff-filter=ACM "*.js" | sed 's| |\\ |g')
|
||||
|
||||
if [ ! -z "$FILES" ]; then
|
||||
# Prettify all selected files
|
||||
echo "$FILES" | xargs ./node_modules/.bin/prettier --write
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add back the modified/prettified files to staging
|
||||
echo "$FILES" | xargs git add
|
||||
fi
|
||||
14
pre-commit.d/yapf.sh
Executable file
14
pre-commit.d/yapf.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
FILES=$(git diff --cached --name-only --diff-filter=ACM "*.py" | sed 's| |\\ |g')
|
||||
|
||||
if [ ! -z "$FILES" ]; then
|
||||
# Format all selected files
|
||||
echo "$FILES" | xargs ./env/bin/yapf --in-place --verbose --style=./yapf.conf
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add back the modified files to staging
|
||||
echo "$FILES" | xargs git add
|
||||
fi
|
||||
Reference in a new issue