@@ -20,55 +20,63 @@ print_usage() {
20
20
21
21
COMMAND=fix
22
22
23
- while [[ " $# " -gt 0 ]]; do
23
+ while [[ $# -gt 0 ]]; do
24
24
case $1 in
25
- -c|--check) COMMAND=check ;;
26
- -h|--help) print_usage; exit 0 ;;
27
- * ) echo " Invalid argument: ${1:- } " ; echo ; print_usage; exit 1 ;;
25
+ -c | --check) COMMAND=check ;;
26
+ -h | --help)
27
+ print_usage
28
+ exit 0
29
+ ;;
30
+ * )
31
+ echo " Invalid argument: ${1:- } "
32
+ echo
33
+ print_usage
34
+ exit 1
35
+ ;;
28
36
esac
29
37
shift
30
38
done
31
39
32
40
if [ ! -d " venv/" ]; then
33
- echo " Runner is not installed, installing it (ETA 60s)"
34
- ./build.sh -i runner
41
+ echo " Runner is not installed, installing it (ETA 60s)"
42
+ ./build.sh -i runner
35
43
fi
36
44
37
45
source venv/bin/activate
38
46
39
47
echo " Checking Python files..."
40
48
if [ " $COMMAND " == " fix" ]; then
41
- black .
49
+ black .
42
50
else
43
- black --check --diff .
51
+ black --check --diff .
44
52
fi
45
- pylint utils # pylint does not have a fix mode
53
+ pylint utils # pylint does not have a fix mode
46
54
47
55
# not py, as it's handled by black
48
56
INCLUDE_EXTENSIONS=(" *.md" " *.yml" " *.yaml" " *.sh" " *.cs" " *.Dockerfile" " *.java" " *.sql" " *.ts" " *.js" " *.php" )
49
57
EXCLUDE_DIRS=(" logs*" " */node_modules/*" " ./venv/*" " ./manifests/*" " ./utils/build/*" )
50
58
51
59
INCLUDE_ARGS=()
52
60
for ext in " ${INCLUDE_EXTENSIONS[@]} " ; do
53
- INCLUDE_ARGS+=(-name " $ext " -o)
61
+ INCLUDE_ARGS+=(-name " $ext " -o)
54
62
done
55
- unset ' INCLUDE_ARGS[${#INCLUDE_ARGS[@]}-1]' # remove last -o
63
+ unset ' INCLUDE_ARGS[${#INCLUDE_ARGS[@]}-1]' # remove last -o
56
64
57
65
EXCLUDE_ARGS=()
58
66
for dir in " ${EXCLUDE_DIRS[@]} " ; do
59
- EXCLUDE_ARGS+=(-not -path " $dir " )
67
+ EXCLUDE_ARGS+=(-not -path " $dir " )
60
68
done
61
69
62
70
echo " Checking tailing whitespaces..."
63
71
FILES=$( find . " ${EXCLUDE_ARGS[@]} " \( " ${INCLUDE_ARGS[@]} " \) -exec grep -l " $" {} \; )
64
72
if [ " $COMMAND " == " fix" ]; then
65
- echo " $FILES " | xargs -I {} sed -i ' ' -r ' s/ +$//g' {}
73
+ echo " $FILES " | xargs -I {} sed -i ' ' -r ' s/ +$//g' {}
66
74
else
67
- if [ -n " $FILES " ]; then
68
- echo " Some tailing white spaces has been found, please fix them 💥 💔 💥"
69
- echo " $FILES "
70
- exit 1
71
- fi
75
+ if [ -n " $FILES " ]; then
76
+ echo " Some tailing white spaces has been found, please fix them 💥 💔 💥"
77
+ echo " $FILES "
78
+ exit 1
79
+ fi
72
80
fi
73
81
74
- echo " All good, the system-tests CI will be happy! ✨ 🍰 ✨"
82
+ echo " All good, the system-tests CI will be happy! ✨ 🍰 ✨"
0 commit comments