summaryrefslogtreecommitdiff
path: root/tools/run-pep8
blob: 20e594bcd16e16932bf2d77d70de69009c940be8 (plain)
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
#!/bin/bash

ci_files='cloudinit/*.py cloudinit/config/*.py'
test_files=$(find tests -name "*.py")
def_files="$ci_files $test_files"

if [ $# -eq 0 ]; then
   files=( )
   for f in $def_files; do
      [ -f "$f" ] || { echo "failed, $f not a file" 1>&2; exit 1; }
      files[${#files[@]}]=${f}
   done
else
   files=( "$@" );
fi

if [ -f 'hacking.py' ]
then
    base=`pwd`
else
    base=`pwd`/tools/
fi

IGNORE="E501" # Line too long (these are caught by pylint)

# King Arthur: Be quiet! ... Be Quiet! I Order You to Be Quiet.
IGNORE="$IGNORE,E121" # Continuation line indentation is not a multiple of four
IGNORE="$IGNORE,E123" # Closing bracket does not match indentation of opening bracket's line
IGNORE="$IGNORE,E124" # Closing bracket missing visual indentation
IGNORE="$IGNORE,E125" # Continuation line does not distinguish itself from next logical line
IGNORE="$IGNORE,E126" # Continuation line over-indented for hanging indent
IGNORE="$IGNORE,E127" # Continuation line over-indented for visual indent
IGNORE="$IGNORE,E128" # Continuation line under-indented for visual indent
IGNORE="$IGNORE,E502" # The backslash is redundant between brackets

cmd=(
    ${base}/hacking.py

    --ignore="$IGNORE"

    "${files[@]}"
)

echo -e "\nRunning 'cloudinit' pep8:"
echo "${cmd[@]}"
"${cmd[@]}"