forked from sunnysid3up/python-linter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·67 lines (56 loc) · 1.63 KB
/
entrypoint.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
set -e
# source = $1
# strict = $2
# mypy-options = $3
# pylint-options = $4
# black-options = $5
# isort-options = $6
# django = $7
echo "===== Running Python Linter - '$2' ====="
echo "Django project? '$7'"
echo "Running mypy"
mypy "$1" --show-error-codes --show-error-context --pretty ${3}
echo "Running black"
if [ "$7" ]; then
if [ "$2" = "high" ]; then
black "$1" ${5} --exclude "migrations" --check
echo "Running isort"
isort "$1"/**/*.py -m 3 --trailing-comma ${6} -c
echo "Running pylint"
pylint "$1" --load-plugins pylint_django ${4}
elif [ "$2" = "medium" ]; then
black "$1" ${5} --exclude "migrations" --check
echo "Running isort"
isort "$1"/**/*.py -m 3 --trailing-comma ${6} -c
echo "Running pylint"
pylint "$1" --load-plugins pylint_django --fail-under=8 ${4}
else
black "$1" ${5} --exclude "migrations" --check
echo "Running isort"
isort "$1"/**/*.py -m 3 --trailing-comma ${6} --diff
echo "Running pylint"
pylint "$1" --load-plugins pylint_django --exit-zero ${4}
fi
else
if [ "$2" = "high" ]; then
black "$1" ${5} --check
echo "Running isort"
isort "$1"/**/*.py -m 3 --trailing-comma ${6} -c
echo "Running pylint"
pylint "$1" ${4}
elif [ "$2" = "medium" ]; then
black "$1" ${5} --check
echo "Running isort"
isort "$1"/**/*.py -m 3 --trailing-comma ${6} -c
echo "Running pylint"
pylint "$1" --fail-under=8 ${4}
else
black "$1" ${5} --check
echo "Running isort"
isort "$1"/**/*.py -m 3 --trailing-comma ${6} --diff
echo "Running pylint"
pylint "$1" --exit-zero ${4}
fi
fi
echo "Done 🎉" ; echo ""