summaryrefslogtreecommitdiff
path: root/tools/run-pylint
blob: 46748ffbd73d57c8bbd6c1f17a2f5bbab6d3e380 (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
48
49
50
51
#!/bin/bash

ci_files='cloud*.py cloudinit/*.py cloudinit/CloudConfig/*.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 

cmd=(
    pylint
    --reports=n
    --include-ids=y
    --max-line-length=79

    --disable=R
    --disable=I

    --disable=W0142 # Used * or ** magic
    --disable=W0511 # TODO/FIXME note
    --disable=W0702 # No exception type(s) specified
    --disable=W0703 # Catch "Exception"

    --disable=C0103 # Invalid name
    --disable=C0111 # Missing docstring

    "${files[@]}"
)

echo -e "\nRunning pylint:"
echo "${cmd[@]}"
"${cmd[@]}"

cmd=(
    pep8

    --ignore=E501 # Line too long (these are caught by pylint above)

    "${files[@]}"
)

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