mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
#4454 Clean up more tests and code
* Remove some tests we no longer need * Delete blocks of redundant code * Compress some tests together to simplify them * Remove a little code for ancient linter versions * Escape more executables we didn't escape before * Rename a deno option that didn't match our conventions
This commit is contained in:
@@ -6,16 +6,6 @@
|
||||
call ale#Set('go_go_executable', 'go')
|
||||
call ale#Set('go_gobuild_options', '')
|
||||
|
||||
function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GetMatches(lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
@@ -50,7 +40,12 @@ call ale#linter#Define('go', {
|
||||
\ 'aliases': ['go build'],
|
||||
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gobuild#GetCommand'),
|
||||
\ 'command': {b ->
|
||||
\ ale#go#EnvString(b)
|
||||
\ . ale#Escape(ale#Var(b, 'go_go_executable')) . ' test'
|
||||
\ . ale#Pad(ale#Var(b, 'go_gobuild_options'))
|
||||
\ . ' -c -o /dev/null ./'
|
||||
\ },
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -1,28 +1,21 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Author: neersighted <bjorn@neersighted.com>, John Eikenberry <jae@zhar.net>
|
||||
" Description: go vet for Go files
|
||||
"
|
||||
" Author: John Eikenberry <jae@zhar.net>
|
||||
" Description: updated to work with go1.10
|
||||
|
||||
call ale#Set('go_go_executable', 'go')
|
||||
call ale#Set('go_govet_options', '')
|
||||
|
||||
function! ale_linters#go#govet#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_govet_options')
|
||||
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'govet',
|
||||
\ 'aliases': ['go vet'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#govet#GetCommand'),
|
||||
\ 'command': {b ->
|
||||
\ ale#go#EnvString(b)
|
||||
\ . '%e vet'
|
||||
\ . ale#Pad(ale#Var(b, 'go_govet_options'))
|
||||
\ . ' .'
|
||||
\ },
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -16,12 +16,7 @@ function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) a
|
||||
return '%e --format=json --filename %s'
|
||||
endif
|
||||
|
||||
if ale#semver#GTE(a:version, [1, 6, 0])
|
||||
" Reading from stdin was introduced in ember-template-lint@1.6.0
|
||||
return '%e --json --filename %s'
|
||||
endif
|
||||
|
||||
return '%e --json %t'
|
||||
return '%e --json --filename %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
|
||||
|
||||
@@ -4,17 +4,6 @@
|
||||
call ale#Set('v_v_executable', 'v')
|
||||
call ale#Set('v_v_options', '')
|
||||
|
||||
function! ale_linters#v#v#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'v_v_options')
|
||||
|
||||
" Run v in local directory with relative path
|
||||
let l:command = ale#Var(a:buffer, 'v_v_executable')
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' .' . ' -o /tmp/vim-ale-v'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#v#v#Handler(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
@@ -73,9 +62,11 @@ endfunction
|
||||
|
||||
call ale#linter#Define('v', {
|
||||
\ 'name': 'v',
|
||||
\ 'aliases': [],
|
||||
\ 'executable': {b -> ale#Var(b, 'v_v_executable')},
|
||||
\ 'command': function('ale_linters#v#v#GetCommand'),
|
||||
\ 'command': {b ->
|
||||
\ '%e' . ale#Pad(ale#Var(b, 'v_v_options'))
|
||||
\ . ' . -o /tmp/vim-ale-v'
|
||||
\ },
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#v#v#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
Reference in New Issue
Block a user