#
# coffeelint.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2015-2016 The SublimeLinterCommunity
# Copyright (c) 2013-2014 Aparajita Fishman
#
# License: MIT
#

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

import SublimeLinter.lint
from SublimeLinter.lint import NodeLinter, persist, util


class Coffeelint(NodeLinter):
    """Provides an interface to coffeelint."""

    syntax = ('coffeescript', 'coffeescript_literate')
    executable = 'coffeelint'
    npm_name = 'coffeelint'
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 1.4.0'
    regex = (
        r'^<issue line="(?P<line>\d+)"\s*\r?\n'
        r'\s*lineEnd="\d+"\s*\r?\n'
        r'\s*reason="\[(?:(?P<error>error)|(?P<warning>warn))\]\s+'
        r'(?:\[stdin\]:\d+:(?P<col>\d+):\s+error:\s+)?'
        r'(?P<message>[^"\n\r]+)["\n\r]'
    )
    multiline = True
    comment_re = r'\s*#'
    config_file = ('-f', 'coffeelint.json', '~')

    def cmd(self):
        """Return a tuple with the command line to execute."""

        command = [self.executable, '--reporter', 'jslint', '--stdin']
        api_version = getattr(SublimeLinter.lint, 'VERSION', 3)
        if api_version > 3:
            current_syntax = util.get_syntax(self.view)
        else:
            current_syntax = persist.get_syntax(self.view)

        if current_syntax == 'coffeescript_literate':
            command.append('--literate')

        return command

@@ -295,34 +295,8 @@
 %22%22%0A%0A
-import SublimeLinter.lint%0A
 from
@@ -337,17 +337,8 @@
 ter,
- persist,
  uti
@@ -482,175 +482,30 @@
     
-executable = 'coffeelint'%0A    npm_name = 'coffeelint'%0A    version_args = '--version'%0A    version_re = r'(?P%3Cversion%3E%5Cd+%5C.%5Cd+%5C.%5Cd+)'%0A    version_requirement = '%3E= 1.4.0
+npm_name = 'coffeelint
 '%0A  
@@ -796,81 +796,69 @@
 rue%0A
+%0A
     
-comment_re = r'%5Cs*#'%0A    config_file = ('-f', 'coffeelint.json', '~')
+defaults = %7B%0A        'working_dir': '$%7Bfile_path%7D'%0A    %7D
 %0A%0A  
@@ -961,23 +961,20 @@
  = %5B
-self.executable
+'coffeelint'
 , '-
@@ -1010,255 +1010,46 @@
 n'%5D%0A
-        api_version = getattr(SublimeLinter.lint, 'VERSION', 3)%0A        if api_version %3E 3:%0A            current_syntax = util.get_syntax(self.view)%0A        else:%0A            current_syntax = persist.get_syntax(self.view)%0A%0A        if current_syntax
+%0A        if util.get_syntax(self.view)
  == 

Update for SL4