forked from stopdropandrew/SublimeLinter-puppet-lint
-
Notifications
You must be signed in to change notification settings - Fork 2
/
linter.py
47 lines (35 loc) · 1.05 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Andrew Grim
# Copyright (c) 2014 Andrew Grim
#
# License: MIT
#
"""This module exports the PuppetLint plugin class."""
from SublimeLinter.lint import RubyLinter
class PuppetLint(RubyLinter):
"""Provides an interface to puppet-lint."""
defaults = {
'selector': 'source.puppet'
}
cmd = ('puppet-lint', '--log-format', '%{line}:%{column}:%{kind}:%{message}')
regex = (
r'^(?P<line>\d+):(?P<col>\d+):'
r'((?P<warning>warning)|(?P<error>error)):'
r'(?P<message>.+)'
)
tempfile_suffix = '-'
def cmd(self):
"""Build command, using bundle exec if the option is set."""
settings = self.get_view_settings()
command = []
if settings.get('use_bundle_exec', False):
command.extend(['bundle', 'exec'])
command.extend([
'puppet-lint',
'--log-format',
'%{line}:%{column}:%{kind}:%{message}',
])
return command