コード例 #1
0
def check(codeString, filename, jshint_options):
    path = jshint_path()

    if os.path.exists(jsc_path):
        process = subprocess.Popen((jsc_path, os.path.join(path, 'jshint_jsc.js'), '--', str(codeString.count('\n')), jshint_options, path + os.path.sep),
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT,
                                    startupinfo=get_startupinfo())
    else:
        process = subprocess.Popen(('node', os.path.join(path, 'jshint_node.js'), jshint_options),
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT,
                                    startupinfo=get_startupinfo())

    result = process.communicate(codeString)

    if result:
        if process.returncode == 0:
            if result[0].startswith('jshint: '):
                print '{0}: {1}'.format(language, result[0][len('jshint: '):])
            else:
                return json.loads(result[0].strip() or '[]')
        else:
            print '{0}: {1}'.format(language, result[0])
    else:
        print '{0}: no result returned from jshint'

    return []
コード例 #2
0
def check(codeString, filename):
    path = jshint_path()

    if os.path.exists(jsc_path):
        process = subprocess.Popen((jsc_path, os.path.join(path, 'jshint_jsc.js'), '--', str(codeString.count('\n')), '{}', path + os.path.sep),
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT,
                                    startupinfo=get_startupinfo())
    else:
        process = subprocess.Popen(('node', os.path.join(path, 'jshint_node.js')),
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT,
                                    startupinfo=get_startupinfo())

    result = process.communicate(codeString)

    if result:
        if process.returncode == 0:
            if result[0].startswith('jshint: '):
                print '{0}: {1}'.format(language, result[0][len('jshint: '):])
            else:
                return json.loads(result[0].strip() or '[]')
        else:
            print '{0}: {1}'.format(language, result[0])
    else:
        print '{0}: no result returned from jshint'

    return []
コード例 #3
0
ファイル: ruby.py プロジェクト: farcaller/SublimeLinter
def is_enabled():
    try:
        subprocess.Popen(('ruby', '-v'), startupinfo=get_startupinfo())
    except OSError:
        return (False, 'ruby cannot be found')

    return True
コード例 #4
0
def is_enabled():
    try:
        subprocess.Popen(('ruby', '-v'), startupinfo=get_startupinfo())
    except OSError:
        return (False, 'ruby cannot be found')

    return True
コード例 #5
0
ファイル: ruby.py プロジェクト: farcaller/SublimeLinter
def check(codeString, filename):
    process = subprocess.Popen(('ruby', '-wc'),
                  stdin=subprocess.PIPE,
                  stdout=subprocess.PIPE,
                  stderr=subprocess.STDOUT,
                  startupinfo=get_startupinfo())
    result = process.communicate(codeString)[0]

    return result
コード例 #6
0
def check(codeString, filename):
    process = subprocess.Popen(('ruby', '-wc'),
                               stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.STDOUT,
                               startupinfo=get_startupinfo())
    result = process.communicate(codeString)[0]

    return result
コード例 #7
0
ファイル: perl.py プロジェクト: KnowAgenda/sublime-text-2
def check(codeString):
    global linter_executable
    process = subprocess.Popen((linter_executable, '-c'),
                                stdin=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.STDOUT,
                                startupinfo=get_startupinfo())
    result = process.communicate(codeString)[0]

    return result
コード例 #8
0
def is_enabled():
    if os.path.exists(jsc_path):
        return (True, 'using JavaScriptCore')
    try:
        subprocess.call(['node', '-v'], startupinfo=get_startupinfo())
        return (True, 'using node.js')
    except OSError:
        return (False, 'JavaScriptCore or node.js is required')
    except Exception as ex:
        return (False, unicode(ex))
コード例 #9
0
def is_enabled():
    if os.path.exists(jsc_path):
        return (True, 'using JavaScriptCore')
    try:
        subprocess.call(['node', '-v'], startupinfo=get_startupinfo())
        return (True, 'using node.js')
    except OSError:
        return (False, 'JavaScriptCore or node.js is required')
    except Exception as ex:
        return (False, unicode(ex))
コード例 #10
0
ファイル: perl.py プロジェクト: KnowAgenda/sublime-text-2
def is_enabled():
    global linter_executable
    linter_executable = get_executable('perl', 'perl')

    try:
        subprocess.Popen((linter_executable, '-v'), startupinfo=get_startupinfo(),
                         stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()
    except OSError:
        return (False, '"{0}" cannot be found'.format(linter_executable))

    return (True, 'using "{0}" for executable'.format(linter_executable))
コード例 #11
0
ファイル: php.py プロジェクト: farcaller/SublimeLinter
def check(codeString, args=[]):
    process = subprocess.Popen(('php', '-l', '-d display_errors=On'),
                                stdin=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                startupinfo=get_startupinfo())

    try:
        result = process.communicate(codeString)[0]
    except:
        result = ''

    return result
コード例 #12
0
ファイル: php.py プロジェクト: Kun1605/SublimeText2-Config
def check(codeString, args=[]):
    process = subprocess.Popen(('php', '-l', '-d display_errors=On'),
                               stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE,
                               startupinfo=get_startupinfo())

    try:
        result = process.communicate(codeString)[0]
    except:
        result = ''

    return result
コード例 #13
0
ファイル: php.py プロジェクト: KnowAgenda/sublime-text-2
def check(codeString):
    global linter_executable
    process = subprocess.Popen((linter_executable, '-l', '-d display_errors=On'),
                                stdin=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                startupinfo=get_startupinfo())

    try:
        result = process.communicate(codeString)[0]
    except:
        result = ''

    return result