diff --git a/README.md b/README.md index 5624fd1..0451e36 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeL It will be used with all files. ## Installation -SublimeLinter must be installed in order to use this plugin. +SublimeLinter must be installed in order to use this plugin. Please use [Package Control](https://packagecontrol.io) to install the linter plugin. @@ -29,7 +29,7 @@ For example: ```json "linters": { "annotations": { - "warnings": "[FOO], BAR", + "warnings": ["FOO", "BAR"], "errors": ["WHAT?", "OMG!"] } } diff --git a/linter.py b/linter.py index 0fb2c28..1ebad2f 100644 --- a/linter.py +++ b/linter.py @@ -37,23 +37,26 @@ class Annotations(Linter): cmd = None line_col_base = (0, 0) - regex = re.compile(r'^(?P\d+):(?P\d+):' - r' (warning \((?P.+?)\)|error \((?P.+?)\)):' - r' (?P.*)') + regex = ( + r'^(?P\d+):(?P\d+):' + r' (?P.+?) \((?P.+)\):' + r' (?P.*)' + ) # We use this to do the matching - mark_regex_template = r'(?:(?P{warnings})|(?P{errors})):?\s*(?P.*)' + mark_regex_template = r'(?:(?P{infos})|(?P{warnings})|(?P{errors})):?\s*(?P.*)' # Words to look for defaults = { 'selector': '', # select all views - 'errors': ['FIXME'], - 'warnings': ['NOTE', 'README', 'TODO', '@todo', 'XXX', 'WIP'], + 'errors': ['FIXME', 'ERROR'], + 'warnings': ['TODO', '@todo', 'XXX', 'WIP', 'WARNING'], + 'infos': ['NOTE', 'README', 'INFO'], } def run(self, cmd, code): options = {} - for option in ('errors', 'warnings'): + for option in ('errors', 'warnings', 'infos'): words = self.settings.get(option) options[option] = '|'.join(_escape_words(words)) @@ -79,7 +82,11 @@ def run(self, cmd, code): error_type = ERROR else: word = match.group('warning') - error_type = WARNING + if word: + error_type = WARNING + else: + word = match.group('info') + error_type = 'info' output.append('{row}:{col}: {error_type} ({word}): {message}' .format(**locals()))