Skip to content

Commit 5cdf750

Browse files
committed
Merge pull request #10 from jawshooah/bugfix/ignore-outside-errors
Ignore errors not in linted file
2 parents 969c0ce + bca8cc2 commit 5cdf750

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

linter.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,23 @@ class Ruby(RubyLinter):
2020
syntax = ('ruby', 'ruby on rails', 'rspec')
2121
cmd = 'ruby -wc'
2222
regex = (
23-
r'^.+?:(?P<line>\d+): (?:(?P<error>.*?error)|(?P<warning>warning))[,:] (?P<message>[^\r\n]+)\r?\n'
23+
r'^(?P<file>.+?):(?P<line>\d+): (?:(?P<error>.*?error)|(?P<warning>warning))[,:] (?P<message>[^\r\n]+)\r?\n'
2424
r'(?:^[^\r\n]+\r?\n^(?P<col>.*?)\^)?'
2525
)
2626
multiline = True
2727
comment_re = r'\s*#'
28+
29+
def split_match(self, match):
30+
"""
31+
Return the components of the match.
32+
33+
We override this because unrelated library files can throw errors,
34+
and we only want errors from the linted file.
35+
36+
"""
37+
38+
if match:
39+
if match.group('file') != '-':
40+
match = None
41+
42+
return super().split_match(match)

0 commit comments

Comments
 (0)