Skip to content

Commit

Permalink
Merge pull request #6 from Sawrz/master
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste authored Aug 3, 2020
2 parents 385b015 + 8ce6fd2 commit 4705269
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions linter.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
from SublimeLinter.lint import RubyLinter
from SublimeLinter.lint import Linter


class RubyLinter(Linter):
def context_sensitive_executable_path(self, cmd):
# The default implementation will look for a user defined `executable`
# setting.
success, executable = super().context_sensitive_executable_path(cmd)
if success:
return True, executable

gem_name = cmd[0] if isinstance(cmd, list) else cmd

if self.settings.get('use_bundle_exec', False):
return True, ['bundle', 'exec', gem_name]

rvm = self.which('rvm-auto-ruby')
if rvm:
return True, [rvm, '-S', gem_name]

return False, None


class Mdl(RubyLinter):
executable = 'mdl'
cmd = ['mdl', '${temp_file}']
regex = r'^.+?:(?P<line>\d+): (?P<warning>(?P<message>[^`]*))'
line_col_base = (1, 1)
tempfile_suffix = 'md'
defaults = {
'selector': 'text.html.markdown'
}

def cmd(self):
"""Support bundle-exec."""

if self.get_view_settings().get('bundle-exec', False):
return ('bundle', 'exec', self.executable)
return (self.executable_path)

0 comments on commit 4705269

Please sign in to comment.