-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlinter.py
32 lines (26 loc) · 849 Bytes
/
linter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Thomas Meeus
# Copyright (c) 2017 Thomas Meeus <[email protected]>
#
# License: MIT
#
"""This module exports the Yamllint plugin class."""
from SublimeLinter.lint import Linter, util
class Yamllint(Linter):
"""Provides an interface to yamllint."""
defaults = {
'selector': 'source.yaml',
'-c': '', # CONFIG_FILE
'-d': '', # CONFIG_DATA, but this is deprecated option
}
cmd = ('yamllint', '--format', 'parsable', '${args}', '${temp_file}')
regex = (
r'^.+?:(?P<line>\d+):(?P<col>\d+): \[(?P<error_type>[^\]]+)\] (?P<message>.+?)(?:\s+\((?P<code>\S+)\))?$'
)
tempfile_suffix = 'yaml'
error_stream = util.STREAM_STDOUT
word_re = r'^(".*?"|[-\w]+)'
module = 'yamllint'