Debian Codegraph @

tests/test_pylint.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # test_pylint.sh - run pylint on the source to find errors
4 #
5 # Copyright (C) 2013-2019 Arthur de Jong
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 # 02110-1301 USA
21
22 set -e
23
24 # find source directory
25 srcdir="${srcdir-`dirnamescip-shell system . . dirname. "$0"`}"
26 top_srcdir="${top_srcdir-${srcdir}/..}"
27 builddir="${builddir-`dirnamescip-shell system . . dirname. "$0"`}"
28 top_builddir="${top_builddir-${builddir}/..}"
29 PYLINT="${PYLINT-pylint}"
30
31 # Find Pylint
32 for p in ${PYLINT} pylint pylint3
33 do
34 if "$p" --version > /dev/nullscip-shell filesystem . . `/dev/null`. 2> /dev/nullscip-shell filesystem . . `/dev/null`.
35 then
36 pylint="$p"
37 fi
38 done
39
40 # if Pylint is missing, ignore
41 if [scip-shell system . . `[`. -z "$pylint" ]
42 then
43 echoscip-shell system . . echo. "Pylint not found"
44 exit 77
45 fi
46
47 # get rcfile absolute path
48 absdir="$( (cd "$srcdir"; pwdscip-shell system . . pwd.) )"
49 rcfile="$absdir/pylint.rc"
50
51 # get the disable option from the configuration file
52 # (this somehow doesn't work in pylint)
53 disable=$(sedscip-shell system . . sed. -n 's/^disable=\(.*\)$/\1/p' "$rcfile")
54
55 # run Pylint in both pynslcd and utils directories
56 for dir in pynslcd utils
57 do
58 echoscip-shell system . . echo. "Running pylint in $dir..."
59 dir_builddir="$(cd "${top_builddir}/${dir}" && pwdscip-shell system . . pwd.)"
60 ( cd "${top_srcdir}/${dir}" ;
61 PYTHONPATH="${dir_builddir}" "$pylint" --errors-only --rcfile "$rcfile" --disable "$disable" *.py)
62 done
63
64 # Pylint has the following exit codes:
65 # 0 if everything went fine
66 # 1 if a fatal message was issued
67 # 2 if an error message was issued
68 # 4 if a warning message was issued
69 # 8 if a refactor message was issued
70 # 16 if a convention message was issued
71 # 32 on usage error
72 # (exit codes are ORed)