lorax/tests/pylint/pylint-one.sh
Brian C. Lane de0e662f51 Convert pylorax to python3
Fix up 2to3 complaints. I've decided to do with wrapping list
comprehension inside list() to get the generators to run in several
places instead of list(map( or list(filter( which seem less readable to
me.
2015-05-15 17:11:20 -07:00

33 lines
1017 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="$(python3-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