Skip to content

Commit 7b98073

Browse files
authored
Merge pull request #29 from tukusejssirs/add_info_scope
Add info message scope
2 parents 1be097b + b122fca commit 7b98073

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeL
77
It will be used with all files.
88

99
## Installation
10-
SublimeLinter must be installed in order to use this plugin.
10+
SublimeLinter must be installed in order to use this plugin.
1111

1212
Please use [Package Control](https://packagecontrol.io) to install the linter plugin.
1313

@@ -29,7 +29,7 @@ For example:
2929
```json
3030
"linters": {
3131
"annotations": {
32-
"warnings": "[FOO], BAR",
32+
"warnings": ["FOO", "BAR"],
3333
"errors": ["WHAT?", "OMG!"]
3434
}
3535
}

linter.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,26 @@ class Annotations(Linter):
3737

3838
cmd = None
3939
line_col_base = (0, 0)
40-
regex = re.compile(r'^(?P<line>\d+):(?P<col>\d+):'
41-
r' (warning \((?P<warning>.+?)\)|error \((?P<error>.+?)\)):'
42-
r' (?P<message>.*)')
40+
regex = (
41+
r'^(?P<line>\d+):(?P<col>\d+):'
42+
r' (?P<error_type>.+?) \((?P<code>.+)\):'
43+
r' (?P<message>.*)'
44+
)
4345

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

4749
# Words to look for
4850
defaults = {
4951
'selector': '', # select all views
50-
'errors': ['FIXME'],
51-
'warnings': ['NOTE', 'README', 'TODO', '@todo', 'XXX', 'WIP'],
52+
'errors': ['FIXME', 'ERROR'],
53+
'warnings': ['TODO', '@todo', 'XXX', 'WIP', 'WARNING'],
54+
'infos': ['NOTE', 'README', 'INFO'],
5255
}
5356

5457
def run(self, cmd, code):
5558
options = {}
56-
for option in ('errors', 'warnings'):
59+
for option in ('errors', 'warnings', 'infos'):
5760
words = self.settings.get(option)
5861
options[option] = '|'.join(_escape_words(words))
5962

@@ -79,7 +82,11 @@ def run(self, cmd, code):
7982
error_type = ERROR
8083
else:
8184
word = match.group('warning')
82-
error_type = WARNING
85+
if word:
86+
error_type = WARNING
87+
else:
88+
word = match.group('info')
89+
error_type = 'info'
8390

8491
output.append('{row}:{col}: {error_type} ({word}): {message}'
8592
.format(**locals()))

0 commit comments

Comments
 (0)