Fixed issues in the style checker checking projects with empty files. 5_4_x

Sat, 27 Sep 2014 11:22:39 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Sep 2014 11:22:39 +0200
branch
5_4_x
changeset 3817
0f58961a074f
parent 3805
f6f6aa84d429
child 3818
2155e837ee74

Fixed issues in the style checker checking projects with empty files.

Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/CodeStyleChecker/pep8.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Sun Sep 21 12:47:20 2014 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Sat Sep 27 11:22:39 2014 +0200
@@ -475,7 +475,7 @@
                         fname, lineno, position, text = error
                         if lineno > len(source):
                             lineno = len(source)
-                        if "__IGNORE_WARNING__" not in \
+                        if lineno == 0 or "__IGNORE_WARNING__" not in \
                                 Utilities.extractLineFlags(
                                 source[lineno - 1].strip()):
                             self.noResults = False
--- a/Plugins/CheckerPlugins/CodeStyleChecker/pep8.py	Sun Sep 21 12:47:20 2014 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/pep8.py	Sat Sep 27 11:22:39 2014 +0200
@@ -1516,7 +1516,7 @@
             # extended API for eric5 integration
             checker = cls(tree, self.filename, self.options)
             for lineno, offset, code, check, *args in checker.run():
-                if not noqa(self.lines[lineno - 1]):
+                if lineno == 0 or not noqa(self.lines[lineno - 1]):
                     self.report_error_args(lineno, offset, code, check, *args)
 
     def generate_tokens(self):

eric ide

mercurial