Skip to content

Commit

Permalink
Merge pull request #4 from jeffbyrnes/add-bundler-functionality
Browse files Browse the repository at this point in the history
Add bundler functionality
  • Loading branch information
dschaaff authored Feb 25, 2020
2 parents ee0bff2 + bdc4fb9 commit 75d9785
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ To install via Package Control, do the following:
## Settings
For general information on how SublimeLinter works with settings, please see [Settings][settings]. For information on generic linter settings, please see [Linter Settings][linter-settings].

### Bundler
If you are using Bundler and would like to use the locked puppet-lint version, you must set `use_bundle_exec` to true:

```json
{
"linters": {
"puppetlint": {
"use_bundle_exec": true
}
}
}
```

## Contributing
If you would like to contribute enhancements or fixes, please do the following:

Expand Down
27 changes: 21 additions & 6 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,38 @@

"""This module exports the PuppetLint plugin class."""

from SublimeLinter.lint import RubyLinter, util
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}', '*')
executable = None

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 = '-'
error_stream = util.STREAM_STDOUT
word_re = r'^(".*?"|[-\w]+)'

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

0 comments on commit 75d9785

Please sign in to comment.