~jbauer/cloud-init/salt

« back to all changes in this revision

Viewing changes to tools/run-pylint

  • Committer: Scott Moser
  • Date: 2012-01-17 20:59:21 UTC
  • mfrom: (505.1.4 trunk.cleanups)
  • Revision ID: smoser@ubuntu.com-20120117205921-pyf7ybik03gq3t3g
miscellaneous cleanups, and add tools/run-pylint

adding run-pylint makes it easy to run pylint with given configuration
against the code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
def_files='cloud*.py cloudinit/*.py cloudinit/CloudConfig/*.py'
 
4
 
 
5
if [ $# -eq 0 ]; then
 
6
   files=( )
 
7
   for f in $def_files; do
 
8
      [ -f "$f" ] || { echo "failed, $f not a file" 1>&2; exit 1; }
 
9
      files[${#files[@]}]=${f}
 
10
   done
 
11
else
 
12
   files=( "$@" );
 
13
fi 
 
14
 
 
15
cmd=(
 
16
    pylint
 
17
    --reports=n
 
18
    --include-ids=y
 
19
    --max-line-length=79
 
20
 
 
21
    --disable=R
 
22
    --disable=I
 
23
 
 
24
    --disable=W0142 # Used * or ** magic
 
25
    --disable=W0511 # TODO/FIXME note
 
26
    --disable=W0702 # No exception type(s) specified
 
27
    --disable=W0703 # Catch "Exception"
 
28
 
 
29
    --disable=C0103 # Invalid name
 
30
    --disable=C0111 # Missing docstring
 
31
 
 
32
    "${files[@]}"
 
33
)
 
34
 
 
35
echo -e "\nRunning pylint:"
 
36
echo "${cmd[@]}"
 
37
"${cmd[@]}"
 
38
 
 
39
cmd=(
 
40
    pep8
 
41
 
 
42
    --ignore=E501 # Line too long (these are caught by pylint above)
 
43
 
 
44
    "${files[@]}"
 
45
)
 
46
 
 
47
echo -e "\nRunning pep8:"
 
48
echo "${cmd[@]}"
 
49
"${cmd[@]}"