Plugins/CheckerPlugins/Pep8/pep8.py

branch
Py2 comp.
changeset 3056
9986ec0e559a
parent 2911
ce77f0b1ee67
parent 2910
cdc56e9d9f12
--- a/Plugins/CheckerPlugins/Pep8/pep8.py	Sun Sep 08 19:04:07 2013 +0200
+++ b/Plugins/CheckerPlugins/Pep8/pep8.py	Tue Oct 15 22:03:54 2013 +0200
@@ -389,7 +389,7 @@
     length = len(line)
     if length > max_line_length and not noqa(line):
         if hasattr(line, 'decode'):   # Python 2
-        # The line could contain multi-byte characters
+            # The line could contain multi-byte characters
             try:
                 length = len(line.decode('utf-8'))
             except (UnicodeDecodeError, UnicodeEncodeError):
@@ -1378,6 +1378,9 @@
         self.report = report or options.report
         self.report_error = self.report.error
         self.report_error_args = self.report.error_args
+        
+        # added for eric5 integration
+        self.options = options
 
     def report_invalid_syntax(self):
         exc_type, exc = sys.exc_info()[:2]
@@ -1388,8 +1391,8 @@
         else:
             offset = (1, 0)
         self.report_error_args(offset[0], offset[1] or 0,
-                          'E901', exc_type.__name__, exc.args[0],
-                          self.report_invalid_syntax)
+                          'E901', self.report_invalid_syntax,
+                          exc_type.__name__, exc.args[0])
     report_invalid_syntax.__doc__ = "    Check if the syntax is valid."
 
     def readline(self):
@@ -1510,11 +1513,12 @@
         except (SyntaxError, TypeError):
             return self.report_invalid_syntax()
         for name, cls, _ in self._ast_checks:
-            checker = cls(tree, self.filename)
+            # extended API for eric5 integration
+            checker = cls(tree, self.filename, self.options)
             for args in checker.run():
-                lineno = args.pop(0)
+                lineno = args[0]
                 if not noqa(self.lines[lineno - 1]):
-                    self.report_error_args(lineno, *args)
+                    self.report_error_args(lineno, *args[1:])
 
     def generate_tokens(self):
         if self._io_error:

eric ide

mercurial