Fixed an issue in the coding style checker service. Empty files should not be ignored because they could show issues.

Sat, 27 Sep 2014 12:34:27 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Sep 2014 12:34:27 +0200
changeset 3821
8731f4bf0704
parent 3816
7216192a9de5
child 3822
1faf52d8f2bd

Fixed an issue in the coding style checker service. Empty files should not be ignored because they could show issues.
(grafted from c00bdab507ef01893022727b0845897a21e05ca5)

Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py file | annotate | diff | comparison | revisions
Utilities/BackgroundService.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Tue Sep 23 19:00:11 2014 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Sat Sep 27 12:34:27 2014 +0200
@@ -104,9 +104,6 @@
         hangClosing, docType, errors, eol, encoding, backup = args
     
     stats = {}
-    # Don't check an empty file
-    if source == []:
-        return stats, []
 
     if fixIssues:
         from CodeStyleFixer import CodeStyleFixer
@@ -162,20 +159,27 @@
     for fname, lineno, position, text in errors:
         if lineno > len(source):
             lineno = len(source)
-        if "__IGNORE_WARNING__" not in \
-                extractLineFlags(source[lineno - 1].strip()):
-            if fixer:
-                res, msg, id_ = fixer.fixIssue(lineno, position, text)
-                if res == -1:
-                    itm = [lineno, position, text]
-                    deferredFixes[id_] = itm
+        if source:
+            if "__IGNORE_WARNING__" not in \
+                    extractLineFlags(source[lineno - 1].strip()):
+                if fixer:
+                    res, msg, id_ = fixer.fixIssue(lineno, position, text)
+                    if res == -1:
+                        itm = [lineno, position, text]
+                        deferredFixes[id_] = itm
+                    else:
+                        itm = [lineno, position, text, False,
+                               res == 1, True, msg]
                 else:
-                    itm = [lineno, position, text, False, res == 1, True, msg]
+                    itm = [lineno, position, text, False,
+                           False, False, '']
+                results.append(itm)
             else:
-                itm = [lineno, position, text, False, False, False, '']
-            results.append(itm)
+                results.append([lineno, position, text, True,
+                                False, False, ''])
         else:
-            results.append([lineno, position, text, True, False, False, ''])
+            results.append([lineno, position, text, False,
+                            False, False, ''])
     
     if fixer:
         deferredResults = fixer.finalize()
--- a/Utilities/BackgroundService.py	Tue Sep 23 19:00:11 2014 +0200
+++ b/Utilities/BackgroundService.py	Sat Sep 27 12:34:27 2014 +0200
@@ -84,6 +84,7 @@
             getConfig('ericDir'),
             "Utilities", "BackgroundClient.py")
         proc = QProcess()
+        proc.setProcessChannelMode(QProcess.ForwardedChannels)
         args = [backgroundClient, self.hostAddress, str(port)]
         proc.start(interpreter, args)
         if not proc.waitForStarted(10000):

eric ide

mercurial