diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-04-15 09:08:56 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2010-04-15 09:08:56 +0200 |
commit | 5a7dffc22917fdb9a5a8791660fc4279973da895 (patch) | |
tree | bb9183931cbe8a09f28effb9d54b1e74567aad1d | |
parent | f22e78feae0848378d0f8a4ab9cfd14d1f80fefc (diff) | |
download | anaconda-5a7dffc22917fdb9a5a8791660fc4279973da895.tar.gz anaconda-5a7dffc22917fdb9a5a8791660fc4279973da895.tar.xz anaconda-5a7dffc22917fdb9a5a8791660fc4279973da895.zip |
Add a script for running pylint on anaconda
This patch introduces a runpylint.sh script which invokes pylint in such
a way that it is usable with anaconda. Amongst other things it filters
out any false positives listed (regex) in the pylint-false-positives file.
If any problems where found the scripts prints them to stdout and
saves them in pylint-log. In this case it will also have a non 0
exit status (for future make archive integration).
-rw-r--r-- | tests/pylint/pylint-false-positives | 34 | ||||
-rwxr-xr-x | tests/pylint/runpylint.sh | 72 |
2 files changed, 106 insertions, 0 deletions
diff --git a/tests/pylint/pylint-false-positives b/tests/pylint/pylint-false-positives new file mode 100644 index 000000000..da6ae9a8d --- /dev/null +++ b/tests/pylint/pylint-false-positives @@ -0,0 +1,34 @@ +^F0401:[ 0-9]*: Unable to import 'gtk.gdk'$ +^F0401:[ 0-9]*: Unable to import 'repomd.mdErrors'$ +^F0401:[ 0-9]*: Unable to import 'volume_key'$ +^E0601:[ 0-9]*:VolumeGroupEditor\.editLogicalVolume\.<lambda>: Using variable 'maintable' before assignment$ +^W0122:[ 0-9]*:InstallInterface\.run: Use of the exec statement$ +^E0602:[ 0-9]*:InstallInterface\.run: Undefined variable 'nextWin'$ +^E0602:[ 0-9]*:sparcBootloaderInfo\.writeSilo: Undefined variable 'butil'$ +^E1101:[ 0-9]*:.*: Class 'vbox' has no 'pack_start' member$ +^E1101:[ 0-9]*:.*: Instance of 'WideCheckList' has no 'get_model' member$ +^E1101:[ 0-9]*:.*: Instance of 'WideCheckList' has no 'get_column' member$ +^E1101:[ 0-9]*:.*: Instance of 'WideCheckList' has no 'set_expander_column' member$ +^E1101:[ 0-9]*:.*: Instance of 'WideCheckList' has no 'append_row' member$ +^E1101:[ 0-9]*:.*: Instance of 'WideCheckList' has no 'store' member$ +^E1101:[ 0-9]*:.*: Instance of 'WideCheckList' has no 'set_size_request' member$ +^E1101:[ 0-9]*:AnacondaTZMap\.selectionChanged: Instance of 'Enum' has no 'ENTRY' member$ +^E1101:[ 0-9]*:DeviceAction\..*: Instance of 'DeviceAction' has no 'dir' member$ +^E1101:[ 0-9]*:VolumeGroupEditor\.editLogicalVolume: Class 'format' has no 'mountable' member$ +^E1101:[ 0-9]*:rpm.*: Instance of 'TransactionSet' has no 'dbMatch' member$ +^E1101:[ 0-9]*:EntryWindow.__init__: Class 'child' has no 'pack_start' member$ +^E1101:[ 0-9]*:.*: Instance of 'dict' has no 'Get' member$ +^E1101:[ 0-9]*:FilteredCallbacks\..*set: Instance of 'FilteredCallbacks' has no 'notebook' member$ +^E1101:[ 0-9]*:Anaconda\.backend: Instance of 'DefaultInstall' has no 'getBackend' member$ +^E1103:[ 0-9]*:.*: Instance of 'str' has no '.*' member \(but some types could not be inferred\)$ +^E1103:[ 0-9]*:execWithCapture: Instance of 'list' has no 'splitlines' member \(but some types could not be inferred\)$ +^E1103:[ 0-9]*:VncServer\.connectToView: Instance of 'list' has no 'startswith' member \(but some types could not be inferred\)$ +^E1103:[ 0-9]*:VncServer\.connectToView: Instance of 'list' has no 'endswith' member \(but some types could not be inferred\)$ +^E1103:[ 0-9]*:bindMountDevDirectory: Instance of 'DeviceFormat' has no 'mount' member \(but some types could not be inferred\)$ +^E1103:[ 0-9]*:DeviceTree.handleUdevDiskLabelFormat: Instance of 'DeviceFormat' has no 'partitions' member \(but some types could not be inferred\)$ +^W0404:[ 0-9]*:runRescue: Reimport 'runPostScripts' \(imported line [0-9]*\)$ +# Note this will become a real issue when we start supporting multiple netdevs +^W0631:[ 0-9]*:Network.write: Using possibly undefined loop variable 'dev'$ +# Also filter out the stupid pyblock not running as root message +^dm.c: [ 0-9]*: not running as root returning empty list$ +Note this last line must never end with a newline
\ No newline at end of file diff --git a/tests/pylint/runpylint.sh b/tests/pylint/runpylint.sh new file mode 100755 index 000000000..c7a2cc5a2 --- /dev/null +++ b/tests/pylint/runpylint.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# This script will check anaconda for any pylint warning and errors using a set +# of options minimizing false positives, in combination with filtering of any +# warning regularexpressions listed in pylint-false-positives. +# +# If any warnings our found they will be stored in pylint-log and printed +# to stdout and this script will exit with a status of 1, if no (non filtered) +# warnings are found it exits with a status of 0 + +FALSE_POSITIVES=tests/pylint/pylint-false-positives +NON_STRICT_OPTIONS="--disable-msg=W0612,W0212,W0312,W0611,W0402,W0108,W0107,W0311,W0710" + +usage () { + echo "usage: `basename $0` [--strict] [--help]" + exit $1 +} + +while [ $# -gt 0 ]; do + case $1 in + --strict) + NON_STRICT_OPTIONS= + ;; + --help) + usage 0 + ;; + *) + echo "Error unknown option: $1" + usage 1 + esac + shift +done + +if [ "`tail -c 1 $FALSE_POSITIVES`" == "`echo`" ]; then + echo "Error $FALSE_POSITIVES ends with an enter." + echo "Error the last line of $FALSE_POSITIVES should never have an enter!" + exit 1 +fi + +# run pylint one file / module at a time, otherwise it sometimes gets +# confused +> pylint-log +for i in booty storage installclasses/*.py iw/*.py textw/*.py isys/*.py *.py; do + pylint --init-hook='import sys; \ + sys.path.insert(1, ".libs"); \ + sys.path.insert(2, "isys/.libs"); \ + sys.path.insert(3, "isys"); \ + sys.path.insert(4, "iw"); \ + sys.path.insert(5, "textw"); \ + sys.path.insert(6, "/usr/share/system-config-date"); \ + sys.path.insert(7, "/usr/share/system-config-keyboard")' \ + -i y -r n --disable-msg-cat=C,R --rcfile=/dev/null \ + --disable-msg=W0511,W0403,W0703,W0622,W0614,W0401,W0142,W0613,W0621,W0141 \ + --disable-msg=W0102,W0201,W0221,W0702,W0602,W0603,W0604,W1001,W0223 \ + --disable-msg=W0231,W0232,W0233 \ + $NON_STRICT_OPTIONS $i | \ + egrep -v "`cat $FALSE_POSITIVES | tr '\n' '|'`" > pylint-tmp-log + if grep -q -v '************* Module ' pylint-tmp-log; then + cat pylint-tmp-log >> pylint-log + fi +done +rm pylint-tmp-log + +if [ -s pylint-log ]; then + echo "pylint reports the following issues:" + cat pylint-log + exit 1 +fi + +rm pylint-log + +exit 0 |