lorax/tests/pylint/pylint-one.sh
Brian C. Lane ccf34b1913 Add pylint testing
This adds pylint testing via make check, using the framework from
Anaconda. False positives can be added to
./tests/pylint/pylint-false-positives
2018-10-01 12:35:23 +02:00

33 lines
1009 B
Bash
Executable File

#!/bin/bash
#
# $1 -- python source to run pylint on
#
if [ $# -lt 1 ]; then
# no source, just exit
exit 1
fi
file_suffix="$(eval echo \$$#|sed s?/?_?g)"
pylint_output="$(pylint \
--msg-template='{path}:{line}: {msg_id} {symbol} {msg}' \
-r n --disable=C,R --rcfile=/dev/null \
--dummy-variables-rgx=_ \
--ignored-classes=Popen,TransactionSet \
--defining-attr-methods=__init__,_grabObjects,initialize,reset,start,setUp \
$DISABLED_WARN_OPTIONS \
$DISABLED_ERR_OPTIONS \
$NON_STRICT_OPTIONS "$@" 2>&1 | \
egrep -v -f "$FALSE_POSITIVES" \
)"
# I0011 is the informational "Locally disabling ...." message
if [ -n "$(echo "$pylint_output" | fgrep -v '************* Module ' |\
grep -v '^I0011:')" ]; then
# Replace the Module line with the actual filename
pylint_output="$(echo "$pylint_output" | sed "s|\* Module .*|* Module $(eval echo \$$#)|")"
echo "$pylint_output" > pylint-out_$file_suffix
touch "pylint-$file_suffix-failed"
fi