-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpre-commit
executable file
·44 lines (34 loc) · 1.03 KB
/
pre-commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Github actions has all: 'py37,py38,py39,py310'
# For faster runtime, you can choose subset here
TOX_ENVS='py37'
# Optionally run Ruby based markdown lint locally
# After installing Ruby run:
# gem install mdl -v 0.11.0
# then you can change this to 'true'.
RUN_MDL=false
function die(){
echo -e "\033[0;31mFAILURE\033[0m"
exit 1
}
echo "tox:"
tox -e $TOX_ENVS --parallel || die
echo -e "--------------------------------\n"
echo "isort:"
isort --settings-file pyproject.toml ./src ./tests || die
echo -e "--------------------------------\n"
echo "black:"
black --config=pyproject.toml ./src ./tests || die
echo -e "--------------------------------\n"
echo "pflake8:"
pflake8 --config=pyproject.toml || die
echo -e "--------------------------------\n"
echo "codespell:"
codespell ./src ./tests || die
echo -e "--------------------------------\n"
if [ "$RUN_MDL" = true ] ; then
echo "mdl:"
mdl --style './docs/.mdl-style.rb' . || die
echo -e "--------------------------------\n"
fi
echo -e "\033[0;32m\nSUCCESS\033[0m"