Skip to content

Commit

Permalink
Merge pull request #9 from kaste/patch-1
Browse files Browse the repository at this point in the history
Update for SL4
  • Loading branch information
kaste committed Mar 22, 2018
2 parents 1bb016a + 7a6c03c commit d648f13
Showing 1 changed file with 7 additions and 27 deletions.
34 changes: 7 additions & 27 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,20 @@

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

import os
from SublimeLinter.lint import RubyLinter, util
from SublimeLinter.lint import RubyLinter


class HamlLint(RubyLinter):
"""Provides an interface to haml-lint."""

syntax = 'ruby haml'
cmd = 'ruby -S haml-lint'
version_args = '-S haml-lint --version'
version_re = r'(?P<version>\d+\.\d+\.\d+)'
version_requirement = '>= 0.6.0'
regex = r'^.+?:(?P<line>\d+) \[(:?(?P<warning>W)|(?P<error>E))\] (?P<message>.+)'
tempfile_suffix = 'haml'
config_file = ('--config', '.haml-lint.yml')

def build_args(self, settings):
"""
Return a list of args to add to cls.cmd.
We hook into this method to find the rubocop config and set it as an
environment variable for the rubocop linter to pick up.
"""
rubocop_file = settings.get('rubocop-config', '.rubocop.yml')
if self.filename:
rubocop_config = util.find_file(
os.path.dirname(self.filename),
rubocop_file,
aux_dirs='~'
)
print(rubocop_config)
if rubocop_config:
self.env['HAML_LINT_RUBOCOP_CONF'] = rubocop_config
else:
self.env.pop('HAML_LINT_RUBOCOP_CONF', None)

return super().build_args(settings)
defaults = {
'--config': '${folder}/.haml-lint.yml',
'env': {
'HAML_LINT_RUBOCOP_CONF': '${folder}/.rubocop.yml'
}
}

0 comments on commit d648f13

Please sign in to comment.