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

from SublimeLinter.lint import Linter, util


class AnsibleLint(Linter):
    """Provides an interface to ansible-lint."""

    # ansbile-lint verison requirements check
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 3.0.1'

    # linter settings
    cmd = ('ansible-lint', '${args}', '${file}')
    regex = r'.+:(?P<line>\d+): \[(?P<error>.z+)\] (?P<message>.+)'
    # -p generate non-multi-line, pep8 compatible output
    multiline = False

    # ansible-lint does not support column number
    word_re = False
    line_col_base = (1, 1)

    tempfile_suffix = 'yml'
    error_stream = util.STREAM_STDOUT
    defaults = {
        'selector': 'source.ansible',
        'args': '-p'
    }


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

from SublimeLinter.lint import Linter, util


class AnsibleLint(Linter):
    """Provides an interface to ansible-lint."""

    # ansbile-lint verison requirements check
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 3.0.1'

    # linter settings
    cmd = ('ansible-lint', '${args}', '@')
    regex = r'^.+:(?P<line>\d+): \[.(?P<error>.+)\] (?P<message>.+)'
    # -p generate non-multi-line, pep8 compatible output
    multiline = False

    # ansible-lint does not support column number
    word_re = False
    line_col_base = (1, 1)

    tempfile_suffix = 'yml'
    error_stream = util.STREAM_STDOUT

    defaults = {
        'selector': 'source.ansible',
        'args': '--nocolor -p',
        '--exclude= +': ['.galaxy'],
    }
    inline_overrides = ['exclude']

Update to support SublimeLinter 4
Update to support SublimeLinter 4

  
  """This module exports the AnsibleLint plugin class."""
  
  from SublimeLinter.lint import Linter, util
  
  
  class AnsibleLint(Linter):
      """Provides an interface to ansible-lint."""
  
      # ansbile-lint verison requirements check
      version_args = '--version'
      version_re = r'(?P<version>\d+\.\d+\.\d+)'
      version_requirement = '>= 3.0.1'
  
      # linter settings
-     cmd = ('ansible-lint', '${args}', '${file}')
+     cmd = ('ansible-lint', '${args}', '@')
-     regex = r'.+:(?P<line>\d+): \[(?P<error>.z+)\] (?P<message>.+)'
+     regex = r'^.+:(?P<line>\d+): \[.(?P<error>.+)\] (?P<message>.+)'
      # -p generate non-multi-line, pep8 compatible output
      multiline = False
  
      # ansible-lint does not support column number
      word_re = False
      line_col_base = (1, 1)
  
      tempfile_suffix = 'yml'
      error_stream = util.STREAM_STDOUT
+ 
      defaults = {
          'selector': 'source.ansible',
-         'args': '-p'
+         'args': '--nocolor -p',
+         '--exclude= +': ['.galaxy'],
      }
+     inline_overrides = ['exclude']
  
Update to support SublimeLinter 4
## Code Before:

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

from SublimeLinter.lint import Linter, util


class AnsibleLint(Linter):
    """Provides an interface to ansible-lint."""

    # ansbile-lint verison requirements check
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 3.0.1'

    # linter settings
    cmd = ('ansible-lint', '${args}', '${file}')
    regex = r'.+:(?P<line>\d+): \[(?P<error>.z+)\] (?P<message>.+)'
    # -p generate non-multi-line, pep8 compatible output
    multiline = False

    # ansible-lint does not support column number
    word_re = False
    line_col_base = (1, 1)

    tempfile_suffix = 'yml'
    error_stream = util.STREAM_STDOUT
    defaults = {
        'selector': 'source.ansible',
        'args': '-p'
    }

## Instruction:
Update to support SublimeLinter 4
## Code After:

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

from SublimeLinter.lint import Linter, util


class AnsibleLint(Linter):
    """Provides an interface to ansible-lint."""

    # ansbile-lint verison requirements check
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 3.0.1'

    # linter settings
    cmd = ('ansible-lint', '${args}', '@')
    regex = r'^.+:(?P<line>\d+): \[.(?P<error>.+)\] (?P<message>.+)'
    # -p generate non-multi-line, pep8 compatible output
    multiline = False

    # ansible-lint does not support column number
    word_re = False
    line_col_base = (1, 1)

    tempfile_suffix = 'yml'
    error_stream = util.STREAM_STDOUT

    defaults = {
        'selector': 'source.ansible',
        'args': '--nocolor -p',
        '--exclude= +': ['.galaxy'],
    }
    inline_overrides = ['exclude']
