dreadatour/Flake8Lint

Error on detection of E502

pasquall opened this issue · 1 comments

Sometimes detection of this error causes a bug and nothing is detected:

Traceback (most recent call last):
File "/home/pasquall/.config/sublime-text-3/Packages/Python Flake8 Lint/Flake8Lint.py", line 1167, in
lambda: Flake8Lint.async_lint(view, view_settings, quiet=quiet), 0
File "/home/pasquall/.config/sublime-text-3/Packages/Python Flake8 Lint/Flake8Lint.py", line 1238, in async_lint
LintReport(view, errors_list, view_settings, quiet=quiet)
File "/home/pasquall/.config/sublime-text-3/Packages/Python Flake8 Lint/Flake8Lint.py", line 457, in init
self.prepare_errors(errors_list)
File "/home/pasquall/.config/sublime-text-3/Packages/Python Flake8 Lint/Flake8Lint.py", line 882, in prepare_errors
full_line_text, line_point, error_text, error_col
File "/home/pasquall/.config/sublime-text-3/Packages/Python Flake8 Lint/Flake8Lint.py", line 631, in error_region
if line_text[error_col] == '':
IndexError: string index out of range

A very ugly workaround would be:

--- Flake8Lint.py.orig 2015-10-20 15:26:22.542923099 -0200
+++ Flake8Lint.py 2015-10-20 15:21:20.349758454 -0200
@@ -624,12 +624,13 @@
elif error_code == 'E501':
# E501 line too long (XXX > YYY characters)
start = line_point + error_col
end = line_point + line_length
elif error_code == 'E502':
# E502 the backslash is redundant between brackets

  •        error_col = error_col - 2
         if line_text[error_col] == '\':
             start = line_point + error_col
             end = start + 1
     elif error_code == 'W601':
         # W601 .has_key() is deprecated, use 'in'
         if line_text[error_col:].startswith('.has_key('):
    

First of all, sorry for a big delay with answer.

Can't reproduce this bug. Is it possible to have an example of python file?