-
Notifications
You must be signed in to change notification settings - Fork 248
/
lint.sh
executable file
·50 lines (42 loc) · 1.12 KB
/
lint.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
#!/bin/bash
set -e
# Because some of the python we generate is just a little less than perfect,
# and because it'd be too much work to write it out nicer, we'll just disable
# some less important rules for the generated files
# NOTE: Superduperslow!
while [ $# -ne 0 ] ; do
case "$1" in
--flake8)
flake8=$2
shift 2;;
--python)
python=$2
shift 2 ;;
*)
echo "Unknown command argument" >&2
exit 1
;;
esac
done
flake8=${flake8:-$FLAKE8}
python=${python:-$PYTHON}
all_py=$(find taskcluster test -name "*.py")
norm_to_lint=""
gen_to_lint=""
for file in $all_py ; do
if grep -q 'AUTOMATICALLY GENERATED' $file; then
gen_to_lint="$gen_to_lint $file"
else
norm_to_lint="$norm_to_lint $file"
fi
done
echo Python: $python
echo Flake8: $flake8
$python --version &> /dev/null
$flake8 --version &> /dev/null
echo Linting generated python files
$flake8 --ignore=E201,E128 --max-line-length=100000 $ignore_async $gen_to_lint && true
gen_result=${PIPESTATUS[0]}
echo Linting non-generated files
$flake8 --max-line-length=140 $ignore_async $norm_to_lint
exit $(( $? + $gen_result))