Skip to content

Commit

Permalink
Merge pull request #10 from jawshooah/bugfix/ignore-outside-errors
Browse files Browse the repository at this point in the history
Ignore errors not in linted file
  • Loading branch information
groteworld committed Apr 9, 2015
2 parents 969c0ce + bca8cc2 commit 5cdf750
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,23 @@ class Ruby(RubyLinter):
syntax = ('ruby', 'ruby on rails', 'rspec')
cmd = 'ruby -wc'
regex = (
r'^.+?:(?P<line>\d+): (?:(?P<error>.*?error)|(?P<warning>warning))[,:] (?P<message>[^\r\n]+)\r?\n'
r'^(?P<file>.+?):(?P<line>\d+): (?:(?P<error>.*?error)|(?P<warning>warning))[,:] (?P<message>[^\r\n]+)\r?\n'
r'(?:^[^\r\n]+\r?\n^(?P<col>.*?)\^)?'
)
multiline = True
comment_re = r'\s*#'

def split_match(self, match):
"""
Return the components of the match.
We override this because unrelated library files can throw errors,
and we only want errors from the linted file.
"""

if match:
if match.group('file') != '-':
match = None

return super().split_match(match)

0 comments on commit 5cdf750

Please sign in to comment.