Skip to content

Commit

Permalink
Don't match newline characters (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
FichteFoll authored Jan 31, 2022
1 parent 82fad04 commit e4686c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ class Annotations(Linter):
cmd = None

# We use this to do the matching
mark_regex_template = r'(?P<word>(?P<info>{infos})|(?P<warning>{warnings})|(?P<error>{errors})):?\s*(?P<message>.*)'
mark_regex_template = (
r'(?P<word>(?P<info>{infos})|(?P<warning>{warnings})|(?P<error>{errors})):?\s*'
r'(?P<message>.*)'
)

# Words to look for
defaults = {
Expand Down Expand Up @@ -81,11 +84,11 @@ def find_errors(self, output):
lines = region_text.splitlines(keepends=True)
offsets = accumulate(chain([region.a], map(len, lines)))
for line, offset in zip(lines, offsets):
match = mark_regex.search(line)
match = mark_regex.search(line.rstrip())
if not match:
continue

message = match.group('message').strip() or '<no message>'
message = match.group('message') or '<no message>'
word = match.group('word')
error_type = next(et for et in ('error', 'warning', 'info') if match.group(et))

Expand Down

0 comments on commit e4686c8

Please sign in to comment.