[PATCH 01/34] Put the pylint test back into service.

Chris Lumens clumens at redhat.com
Mon Aug 12 20:32:37 UTC 2013


---
 configure.ac                            |   1 +
 old_tests/Makefile.am                   |   2 +-
 old_tests/pylint/Makefile.am            |  22 -------
 old_tests/pylint/pylint-false-positives |  34 ----------
 old_tests/pylint/runpylint.sh           | 108 --------------------------------
 tests/pylint/Makefile.am                |  22 +++++++
 tests/pylint/pylint-false-positives     |   6 ++
 tests/pylint/runpylint.sh               |  84 +++++++++++++++++++++++++
 8 files changed, 114 insertions(+), 165 deletions(-)
 delete mode 100644 old_tests/pylint/Makefile.am
 delete mode 100644 old_tests/pylint/pylint-false-positives
 delete mode 100755 old_tests/pylint/runpylint.sh
 create mode 100644 tests/pylint/Makefile.am
 create mode 100644 tests/pylint/pylint-false-positives
 create mode 100755 tests/pylint/runpylint.sh

diff --git a/configure.ac b/configure.ac
index c41c64b..32104a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,6 +245,7 @@ AC_CONFIG_FILES([Makefile
                  pyanaconda/ui/tui/tools/Makefile
                  pyanaconda/ui/tui/Makefile
                  data/post-scripts/Makefile
+                 tests/pylint/Makefile
                  utils/Makefile
                  utils/dd/Makefile
                  utils/log_picker/Makefile
diff --git a/old_tests/Makefile.am b/old_tests/Makefile.am
index cb4c701..c1b3ffe 100644
--- a/old_tests/Makefile.am
+++ b/old_tests/Makefile.am
@@ -17,6 +17,6 @@
 #
 # Author: David Cantrell <dcantrell at redhat.com>
 
-SUBDIRS = mock kickstart_test regex pyanaconda_test pylint logpicker_test
+SUBDIRS = mock kickstart_test regex pyanaconda_test logpicker_test
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/old_tests/pylint/Makefile.am b/old_tests/pylint/Makefile.am
deleted file mode 100644
index f934cf5..0000000
--- a/old_tests/pylint/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-# tests/kickstart/Makefile.am for anaconda
-#
-# Copyright (C) 2010  Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published
-# by the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Chris Lumens <clumens at redhat.com>
-
-EXTRA_DIST = *pylint*
-
-MAINTAINERCLEANFILES = Makefile.in
diff --git a/old_tests/pylint/pylint-false-positives b/old_tests/pylint/pylint-false-positives
deleted file mode 100644
index 97f566c..0000000
--- a/old_tests/pylint/pylint-false-positives
+++ /dev/null
@@ -1,34 +0,0 @@
-^F0002:[ 0-9]*: <type 'exceptions.RuntimeError'>: could not open display$
-^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'$
-^E0611:[ 0-9]*: No name '_isys' in module 'pyanaconda'$
-^E0611:[ 0-9]*:.*: No name '_isys' in module 'pyanaconda'$
-^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]*:.*: Instance of '.*' has no 'anaconda' member$
-^E1101:[ 0-9]*:.*: Instance of 'AnacondaKSHandler' has no 'commands' 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]*:randomIname: Module 'hashlib' has no 'md5' 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$
-^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/old_tests/pylint/runpylint.sh b/old_tests/pylint/runpylint.sh
deleted file mode 100755
index afd95fc..0000000
--- a/old_tests/pylint/runpylint.sh
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/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
-
-# W0107 - Unnecessary pass statement
-# W0108 - Lambda may not be necessary
-# W0212 - Access to a protected member %s of a client class
-# W0311 - Bad indentation. Found %s %s, expected %s
-# W0312 - Found indentation with %ss instead of %ss
-# W0402 - Uses of a deprecated module %r
-# W0611 - Unused import %s
-# W0612 - Unused variable %r
-# W0710 - Exception doesn't inherit from standard "Exception" class
-NON_STRICT_OPTIONS="--disable=W0107,W0108,W0212,W0311,W0312,W0402,W0611,W0612,W0710"
-
-# E1103 - %s %r has no %r member (but some types could not be inferred)
-DISABLED_ERR_OPTIONS="--disable=E1103"
-
-# W0102 - Dangerous default value %s as argument
-# W0141 - Used builtin function %r
-# W0142 - Used * or ** magic
-# W0201 - Attribute %r defined outside __init__
-# W0221 - Arguments number differs from %s method
-# W0223 - Method %r is abstract in class %r but is not overridden
-# W0231 - __init__ method from base class %r is not called
-# W0232 - Class has no __init__ method
-# W0233 - __init__ method from a non direct base class %r is called
-# W0401 - Wildcard import %s
-# W0403 - Relative import %r, should be %r
-# W0404 - Reimport %r (imported line %s)
-# W0511 - Used when a warning note as FIXME or XXX is detected.
-# W0602 - Using global for %r but no assignment is done
-# W0603 - Using the global statement
-# W0604 - Using the global statement at the module level
-# W0613 - Unused argument %r
-# W0614 - Unused import %s from wildcard import
-# W0621 - Redefining name %r from outer scope (line %s)
-# W0622 - Redefining built-in %r
-# W0702 - No exception type(s) specified
-# W0703 - Catch "Exception"
-# W1001 - Use of "property" on an old style class
-DISABLED_WARN_OPTIONS="--disable=W0102,W0141,W0142,W0201,W0221,W0223,W0231,W0232 \
-                       --disable=W0233,W0401,W0403,W0404,W0511,W0602,W0603,W0604 \
-                       --disable=W0613,W0614,W0621,W0622,W0702,W0703,W1001"
-
-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 $(find pyanaconda -type f -name '*py'); do
-  pylint --init-hook='import sys; \
-      sys.path.insert(1, "pyanaconda/isys/.libs"); \
-      sys.path.insert(2, "pyanaconda/isys"); \
-      sys.path.insert(3, "pyanaconda"); \
-      sys.path.insert(4, "pyanaconda/.libs")' \
-    -i y -r n --disable=C,R --rcfile=/dev/null \
-    $DISABLED_WARN_OPTIONS \
-    $DISABLED_ERR_OPTIONS \
-    $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
diff --git a/tests/pylint/Makefile.am b/tests/pylint/Makefile.am
new file mode 100644
index 0000000..f934cf5
--- /dev/null
+++ b/tests/pylint/Makefile.am
@@ -0,0 +1,22 @@
+# tests/kickstart/Makefile.am for anaconda
+#
+# Copyright (C) 2010  Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Chris Lumens <clumens at redhat.com>
+
+EXTRA_DIST = *pylint*
+
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/tests/pylint/pylint-false-positives b/tests/pylint/pylint-false-positives
new file mode 100644
index 0000000..c10419e
--- /dev/null
+++ b/tests/pylint/pylint-false-positives
@@ -0,0 +1,6 @@
+^E0611:[ 0-9]*,[0-9]*: No name '_isys' in module 'pyanaconda'$
+^E0611:[ 0-9]*,[0-9]*:.*: No name '_isys' in module 'pyanaconda'$
+^E1101:[ 0-9]*,[0-9]*:.*: Instance of '.*' has no 'anaconda' member$
+^E1101:[ 0-9]*,[0-9]*:Anaconda\.backend: Instance of 'DefaultInstall' has no 'getBackend' member$
+^dm.c: [ 0-9]*,[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 0000000..83af123
--- /dev/null
+++ b/tests/pylint/runpylint.sh
@@ -0,0 +1,84 @@
+#!/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 are 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
+
+# W0212 - Access to a protected member %s of a client class
+NON_STRICT_OPTIONS="--disable=W0212"
+
+# E1103 - %s %r has no %r member (but some types could not be inferred)
+DISABLED_ERR_OPTIONS="--disable=E1103"
+
+# W0141 - Used builtin function %r
+# W0142 - Used * or ** magic
+# W0223 - Method %r is abstract in class %r but is not overridden
+# W0403 - Relative import %r, should be %r
+# W0511 - Used when a warning note as FIXME or XXX is detected.
+# W0603 - Using the global statement
+# W0613 - Unused argument %r
+# W0614 - Unused import %s from wildcard import
+DISABLED_WARN_OPTIONS="--disable=W0141,W0142,W0223,W0403,W0511,W0603,W0613,W0614"
+
+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 $(find pyanaconda -type f -name '*py'); do
+  pylint --init-hook='import sys; \
+      sys.path.insert(1, "pyanaconda/isys/.libs"); \
+      sys.path.insert(2, "pyanaconda/isys"); \
+      sys.path.insert(3, "pyanaconda"); \
+      sys.path.insert(4, "pyanaconda/.libs")' \
+    -i y -r n --disable=C,R --rcfile=/dev/null \
+    --ignored-classes=Popen,QueueFactory,TransactionSet \
+    $DISABLED_WARN_OPTIONS \
+    $DISABLED_ERR_OPTIONS \
+    $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
-- 
1.8.1.2



More information about the anaconda-patches mailing list