Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

branch
5_5_x
changeset 3820
c00bdab507ef
parent 3742
ea909da895ab
child 4021
195a471c327b
diff -r 7dadfde0f017 -r c00bdab507ef Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Tue Sep 23 18:58:33 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()

eric ide

mercurial