Re: [PATCH 2/2] Add a script for running pylint on anaconda

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack.  Though, could we move the pylint stuff to the tests/ subdirectory?
Maybe tests/pylint/ just to keep it out of the top level?

On Wed, 14 Apr 2010, Hans de Goede wrote:

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).
---
pylint-false-positives |   39 ++++++++++++++++++++++++++
runpylint.sh           |   72 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 111 insertions(+), 0 deletions(-)
create mode 100644 pylint-false-positives
create mode 100755 runpylint.sh

diff --git a/pylint-false-positives b/pylint-false-positives
new file mode 100644
index 0000000..5069858
--- /dev/null
+++ b/pylint-false-positives
@@ -0,0 +1,39 @@
+^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$
+# Below this lines are false positives which are really pylint bugs$
+^E0602:[ 0-9]*:identifyMultipaths: Undefined variable 'log'$
+^E0602:[ 0-9]*:identifyMultipaths: Undefined variable 'udev_device_get_serial'$
+^E0602:[ 0-9]*:identifyMultipaths: Undefined variable 'udev_device_is_disk'$
+^E0602:[ 0-9]*:YumBackend\..*: Undefined variable 'NoSuchGroup'$
+Note this last line must never end with a newline
\ No newline at end of file
diff --git a/runpylint.sh b/runpylint.sh
new file mode 100755
index 0000000..d88dc44
--- /dev/null
+++ b/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=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


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkvGIecACgkQ5hsjjIy1Vkk/SQCdHF4itwA4ekd969ivrs1n25qo
9EgAn14CAuWmwUb3VFmOAdZmteXpy3D8
=w6px
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux