Skip to content

Commit a197e33

Browse files
authored
Merge pull request #94 from SublimeLinter/iterate
Extract useful parts from #93
2 parents a03d617 + dd22ad6 commit a197e33

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

linter.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from SublimeLinter.lint import PythonLinter
22
import re
33

4-
CAPTURE_WS = re.compile('(\s+)')
4+
CAPTURE_WS = re.compile(r'(\s+)')
55

66

77
class Flake8(PythonLinter):
@@ -46,12 +46,12 @@ def split_match(self, match):
4646
and a column will always override near.
4747
4848
"""
49-
match, line, col, error, warning, message, near = super().split_match(match)
49+
match = super().split_match(match)
5050

51-
if near:
52-
col = None
51+
if match.near:
52+
return match._replace(col=None)
5353

54-
return match, line, col, error, warning, message, near
54+
return match
5555

5656
def reposition_match(self, line, col, m, virtual_view):
5757
"""Reposition white-space errors."""
@@ -75,9 +75,15 @@ def reposition_match(self, line, col, m, virtual_view):
7575
return line - 1, 0, 1
7676

7777
if code == 'E303':
78-
match = re.match('too many blank lines \((\d+)', m.message.strip())
78+
match = re.match(r'too many blank lines \((\d+)', m.message.strip())
7979
if match is not None:
8080
count = int(match.group(1))
8181
return (line - (count - 1), 0, count - 1)
8282

83+
if code == 'E999':
84+
txt = virtual_view.select_line(line).rstrip('\n')
85+
last_col = len(txt)
86+
if col + 1 == last_col:
87+
return line, last_col, last_col
88+
8389
return super().reposition_match(line, col, m, virtual_view)

0 commit comments

Comments
 (0)