#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by James Hester
# Copyright (c) 2014 James Hester
#
# License: MIT
#

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

from SublimeLinter.lint import Linter, util
import os


class Lintr(Linter):

    """Provides an interface to lintr R package."""

    syntax = ['r', 'enhanced-r']
    executable = 'R'
    if os.name == 'nt':
        version_args = [
            '--slave',
            '--restore',
            '--no-save',
            '-e',
            'packageVersion(\'lintr\')'
        ]
    else:
        version_args = '--slave --restore --no-save -e "packageVersion(\\\"lintr\\\")"'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 0.1.0'
    defaults = {
        'linters': 'default_linters',
        'cache': 'TRUE'
    }
    regex = (
        r'^.+?:(?P<line>\d+):(?P<col>\d+): '
        r'(?:(?P<error>error)|(?P<warning>warning|style)): '
        r'(?P<message>.+)'
    )
    multiline = False
    line_col_base = (1, 1)
    tempfile_suffix = None
    error_stream = util.STREAM_BOTH
    selectors = {}
    word_re = None
    inline_settings = None
    inline_overrides = None
    comment_re = r'#'
    tempfile_suffix = 'lintr'

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

        settings = self.get_view_settings()
        command = 'library(lintr);lint(cache = {0}, commandArgs(TRUE), {1})'.format(settings['cache'],
                                                                                    settings['linters'])
        return [self.executable_path,
                '--slave',
                '--restore',
                '--no-save',
                '-e',
                command,
                '--args',
                '@']

@@ -262,18 +262,8 @@
 til%0A
-import os%0A
 %0A%0Acl
@@ -281,17 +281,16 @@
 inter):%0A
-%0A
     %22%22%22P
@@ -392,36 +392,8 @@
 'R'%0A
-    if os.name == 'nt':%0A    
     
@@ -409,36 +409,32 @@
 rgs = %5B%0A        
- 
-   
 '--slave',%0A     
@@ -420,36 +420,32 @@
      '--slave',%0A
-    
         '--resto
@@ -449,36 +449,32 @@
 store',%0A        
-  
-  
 '--no-save',%0A   
@@ -474,38 +474,30 @@
 e',%0A        
-    
 '-e',%0A
-    
         'pac
@@ -493,16 +493,17 @@
        '
+%22
 packageV
@@ -523,117 +523,16 @@
 r%5C')
+%22
 '%0A    
-   
- %5D%0A    else:%0A        version_args = '--slave --restore --no-save -e %22packageVersion(%5C%5C%5C%22lintr%5C%5C%5C%22)%22'
+%5D
 %0A   
@@ -1185,25 +1185,24 @@
 execute.%22%22%22%0A
-%0A
         sett

Update linter.py