Fixed an issue with the batch syntax check.

Thu, 23 Apr 2015 19:09:34 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 23 Apr 2015 19:09:34 +0200
changeset 4234
40741c858639
parent 4233
364f217f7c7d
child 4235
81278aff6af9

Fixed an issue with the batch syntax check.

Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Wed Apr 22 19:57:11 2015 +0200
+++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Thu Apr 23 19:09:34 2015 +0200
@@ -301,10 +301,20 @@
         
         warnings = problems.get('warnings', [])
         if warnings:
-            source = self.source.splitlines()
+            if self.__batch:
+                try:
+                    source = Utilities.readEncodedFile(fn)[0]
+                    source = Utilities.normalizeCode(source)
+                except (UnicodeError, IOError):
+                    source = ""
+            else:
+                source = self.source.splitlines()
         for _fn, lineno, col, code, msg in warnings:
             self.noResults = False
-            scr_line = source[lineno - 1].strip()
+            if source:
+                scr_line = source[lineno - 1].strip()
+            else:
+                scr_line = ""
             self.__createResultItem(_fn, lineno, col, msg, scr_line, True)
 
         self.progress += 1

eric ide

mercurial