Fixed an issue checking syntax errors and flakes issues with Python 2 files.

Thu, 19 Dec 2013 14:32:25 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 19 Dec 2013 14:32:25 +0100
changeset 3150
42a8d3b5bd57
parent 3149
e98100461710
child 3152
0845347fe512

Fixed an issue checking syntax errors and flakes issues with Python 2 files.

UtilitiesPython2/Py2SyntaxChecker.py file | annotate | diff | comparison | revisions
--- a/UtilitiesPython2/Py2SyntaxChecker.py	Wed Dec 18 08:46:27 2013 +0100
+++ b/UtilitiesPython2/Py2SyntaxChecker.py	Thu Dec 19 14:32:25 2013 +0100
@@ -11,6 +11,7 @@
 import sys
 import re
 import traceback
+import warnings
 
 from Tools import readEncodedFile, normalizeCode, extractLineFlags
 
@@ -108,9 +109,9 @@
     strings = []
     lines = codestring.splitlines()
     try:
-        warnings = Checker(codestring, fileName)
-        warnings.messages.sort(key=lambda a: a.lineno)
-        for warning in warnings.messages:
+        warnings_ = Checker(codestring, fileName)
+        warnings_.messages.sort(key=lambda a: a.lineno)
+        for warning in warnings_.messages:
             if ignoreStarImportWarnings and \
                isinstance(warning, ImportStarUsed):
                 continue
@@ -139,6 +140,7 @@
         print ""
         print "No file name given."
     else:
+        warnings.simplefilter("error")
         filename = sys.argv[-1]
         try:
             codestring = readEncodedFile(filename)[0]

eric ide

mercurial