Skip to content

Commit

Permalink
Merge pull request #43 from SublimeLinter/fix-42
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste authored Jul 17, 2022
2 parents 1a77b8a + 6e5cf10 commit 2311ab9
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ def find_errors(self, output):

message = match.group('message') or '<no message>'
word = match.group('word')
match_groups = match.groupdict()
error_type = next(
error_type_
for error_type_ in ('errors', 'warnings', 'infos')
if error_type_ in match_groups
)
matched_groups = match.groupdict()
error_type = singularize(next(
group
for group in ('errors', 'warnings', 'infos')
if group in matched_groups
))

row, col = self.view.rowcol(offset + match.start())
text_to_mark = match.group() if self.settings.get('mark_message') else word
Expand All @@ -111,3 +111,11 @@ def find_errors(self, output):
code=word,
message=message
)


def singularize(word):
return {
"errors": "error",
"warnings": "warning",
"infos": "info",
}[word]

0 comments on commit 2311ab9

Please sign in to comment.