diff --git a/linter.py b/linter.py index e2e73df..8e057df 100644 --- a/linter.py +++ b/linter.py @@ -46,7 +46,10 @@ class Annotations(Linter): cmd = None # We use this to do the matching - mark_regex_template = r'(?P(?P{infos})|(?P{warnings})|(?P{errors})):?\s*(?P.*)' + mark_regex_template = ( + r'(?P(?P{infos})|(?P{warnings})|(?P{errors})):?\s*' + r'(?P.*)' + ) # Words to look for defaults = { @@ -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 '' + message = match.group('message') or '' word = match.group('word') error_type = next(et for et in ('error', 'warning', 'info') if match.group(et))