Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
|
0c17ba2a0f | ||
|
2dbfbe7b02 | ||
|
ceb2e8d350 | ||
|
96d84aec8f |
34 changed files with 156 additions and 103 deletions
|
@ -29,9 +29,16 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
|
||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
||||||
|
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||||
|
|
||||||
|
return ale#path#CdString(l:project_root)
|
||||||
|
\ . ' mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('elixir', {
|
call ale#linter#Define('elixir', {
|
||||||
\ 'name': 'credo',
|
\ 'name': 'credo',
|
||||||
\ 'executable': 'mix',
|
\ 'executable': 'mix',
|
||||||
\ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s',
|
\ 'command_callback': 'ale_linters#elixir#credo#GetCommand',
|
||||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||||
\})
|
\})
|
||||||
|
|
|
@ -25,10 +25,17 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort
|
||||||
|
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||||
|
|
||||||
|
return ale#path#CdString(l:project_root)
|
||||||
|
\ . ' mix help dialyzer && mix dialyzer'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('elixir', {
|
call ale#linter#Define('elixir', {
|
||||||
\ 'name': 'dialyxir',
|
\ 'name': 'dialyxir',
|
||||||
\ 'executable': 'mix',
|
\ 'executable': 'mix',
|
||||||
\ 'command': 'mix help dialyzer && mix dialyzer',
|
\ 'command_callback': 'ale_linters#elixir#dialyxir#GetCommand',
|
||||||
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||||
\})
|
\})
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,17 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
|
||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#dogma#GetCommand(buffer) abort
|
||||||
|
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||||
|
|
||||||
|
return ale#path#CdString(l:project_root)
|
||||||
|
\ . ' mix help dogma && mix dogma %s --format=flycheck'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('elixir', {
|
call ale#linter#Define('elixir', {
|
||||||
\ 'name': 'dogma',
|
\ 'name': 'dogma',
|
||||||
\ 'executable': 'mix',
|
\ 'executable': 'mix',
|
||||||
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
|
\ 'command_callback': 'ale_linters#elixir#dogma#GetCommand',
|
||||||
\ 'lint_file': 1,
|
\ 'lint_file': 1,
|
||||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||||
\})
|
\})
|
||||||
|
|
|
@ -29,18 +29,8 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort
|
|
||||||
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
|
|
||||||
|
|
||||||
if !empty(l:mix_file)
|
|
||||||
return fnamemodify(l:mix_file, ':p:h')
|
|
||||||
endif
|
|
||||||
|
|
||||||
return '.'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||||
let l:project_root = ale_linters#elixir#mix#FindProjectRoot(a:buffer)
|
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||||
|
|
||||||
let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
|
let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,20 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
||||||
|
|
||||||
" The message is truncated and saved to the history.
|
" The message is truncated and saved to the history.
|
||||||
setlocal shortmess+=T
|
setlocal shortmess+=T
|
||||||
|
|
||||||
|
try
|
||||||
exec "norm! :echomsg l:message\n"
|
exec "norm! :echomsg l:message\n"
|
||||||
|
catch /^Vim\%((\a\+)\)\=:E523/
|
||||||
|
" Fallback into manual truncate (#1987)
|
||||||
|
let l:winwidth = winwidth(0)
|
||||||
|
|
||||||
|
if l:winwidth < strdisplaywidth(l:message)
|
||||||
|
" Truncate message longer than window width with trailing '...'
|
||||||
|
let l:message = l:message[:l:winwidth - 4] . '...'
|
||||||
|
endif
|
||||||
|
|
||||||
|
exec 'echomsg l:message'
|
||||||
|
endtry
|
||||||
|
|
||||||
" Reset the cursor position if we moved off the end of the line.
|
" Reset the cursor position if we moved off the end of the line.
|
||||||
" Using :norm and :echomsg can move the cursor off the end of the
|
" Using :norm and :echomsg can move the cursor off the end of the
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
" Author: butlerx <butlerx@notthe,cloud>
|
" Author: butlerx <butlerx@notthe,cloud>
|
||||||
" Description: Integration of Google-java-format with ALE.
|
" Description: Integration of Google-java-format with ALE.
|
||||||
|
|
||||||
call ale#Set('google_java_format_executable', 'google-java-format')
|
call ale#Set('java_google_java_format_executable', 'google-java-format')
|
||||||
call ale#Set('google_java_format_use_global', get(g:, 'ale_use_global_executables', 0))
|
call ale#Set('java_google_java_format_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
call ale#Set('google_java_format_options', '')
|
call ale#Set('java_google_java_format_options', '')
|
||||||
|
|
||||||
function! ale#fixers#google_java_format#Fix(buffer) abort
|
function! ale#fixers#google_java_format#Fix(buffer) abort
|
||||||
let l:options = ale#Var(a:buffer, 'google_java_format_options')
|
let l:options = ale#Var(a:buffer, 'java_google_java_format_options')
|
||||||
let l:executable = ale#Var(a:buffer, 'google_java_format_executable')
|
let l:executable = ale#Var(a:buffer, 'java_google_java_format_executable')
|
||||||
|
|
||||||
if !executable(l:executable)
|
if !executable(l:executable)
|
||||||
return 0
|
return 0
|
||||||
|
|
13
autoload/ale/handlers/elixir.vim
Normal file
13
autoload/ale/handlers/elixir.vim
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
" Author: Matteo Centenaro (bugant) - https://github.com/bugant
|
||||||
|
"
|
||||||
|
" Description: find the root directory for an elixir project that uses mix
|
||||||
|
|
||||||
|
function! ale#handlers#elixir#FindMixProjectRoot(buffer) abort
|
||||||
|
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
|
||||||
|
|
||||||
|
if !empty(l:mix_file)
|
||||||
|
return fnamemodify(l:mix_file, ':p:h')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return '.'
|
||||||
|
endfunction
|
|
@ -65,7 +65,11 @@ endfunction
|
||||||
" Output 'cd <directory> && '
|
" Output 'cd <directory> && '
|
||||||
" This function can be used changing the directory for a linter command.
|
" This function can be used changing the directory for a linter command.
|
||||||
function! ale#path#CdString(directory) abort
|
function! ale#path#CdString(directory) abort
|
||||||
|
if has('win32')
|
||||||
|
return 'cd /d ' . ale#Escape(a:directory) . ' && '
|
||||||
|
else
|
||||||
return 'cd ' . ale#Escape(a:directory) . ' && '
|
return 'cd ' . ale#Escape(a:directory) . ' && '
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Output 'cd <buffer_filename_directory> && '
|
" Output 'cd <buffer_filename_directory> && '
|
||||||
|
|
|
@ -13,7 +13,7 @@ set VADER_OUTPUT_FILE=%~dp0\vader_output
|
||||||
REM Automatically re-run Windows tests, which can fail some times.
|
REM Automatically re-run Windows tests, which can fail some times.
|
||||||
set tries=0
|
set tries=0
|
||||||
|
|
||||||
RUN_TESTS:
|
:RUN_TESTS
|
||||||
set /a tries=%tries%+1
|
set /a tries=%tries%+1
|
||||||
type nul > "%VADER_OUTPUT_FILE%"
|
type nul > "%VADER_OUTPUT_FILE%"
|
||||||
C:\vim\vim\vim80\vim.exe -u test/vimrc "+Vader! %tests%"
|
C:\vim\vim\vim80\vim.exe -u test/vimrc "+Vader! %tests%"
|
||||||
|
@ -23,7 +23,7 @@ IF %code% EQU 0 GOTO :SHOW_RESULTS
|
||||||
IF %tries% GEQ 2 GOTO :SHOW_RESULTS
|
IF %tries% GEQ 2 GOTO :SHOW_RESULTS
|
||||||
GOTO :RUN_TESTS
|
GOTO :RUN_TESTS
|
||||||
|
|
||||||
SHOW_RESULTS:
|
:SHOW_RESULTS
|
||||||
type "%VADER_OUTPUT_FILE%"
|
type "%VADER_OUTPUT_FILE%"
|
||||||
del "%VADER_OUTPUT_FILE%"
|
del "%VADER_OUTPUT_FILE%"
|
||||||
|
|
||||||
|
|
3
test/command_callback/elixir_paths/mix_project/mix.exs
Normal file
3
test/command_callback/elixir_paths/mix_project/mix.exs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
defmodule Test.MixProject do
|
||||||
|
# fake mix project file
|
||||||
|
end
|
|
@ -19,6 +19,6 @@ Execute(cppcheck for C++ should detect compile_commands.json files):
|
||||||
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
|
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
|
||||||
|
|
||||||
AssertLinter 'cppcheck',
|
AssertLinter 'cppcheck',
|
||||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths/one')) . ' && '
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/cppcheck_paths/one'))
|
||||||
\ . ale#Escape('cppcheck')
|
\ . ale#Escape('cppcheck')
|
||||||
\ . ' -q --language=c --project=compile_commands.json --enable=style %t'
|
\ . ' -q --language=c --project=compile_commands.json --enable=style %t'
|
||||||
|
|
|
@ -17,6 +17,6 @@ Execute(cppcheck for C++ should detect compile_commands.json files):
|
||||||
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
|
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
|
||||||
|
|
||||||
AssertLinter 'cppcheck',
|
AssertLinter 'cppcheck',
|
||||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths/one')) . ' && '
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/cppcheck_paths/one'))
|
||||||
\ . ale#Escape('cppcheck')
|
\ . ale#Escape('cppcheck')
|
||||||
\ . ' -q --language=c++ --project=compile_commands.json --enable=style %t'
|
\ . ' -q --language=c++ --project=compile_commands.json --enable=style %t'
|
||||||
|
|
|
@ -5,43 +5,43 @@ After:
|
||||||
call ale#assert#TearDownLinterTest()
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
Execute(The mcsc linter should return the correct default command):
|
Execute(The mcsc linter should return the correct default command):
|
||||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
AssertLinter 'mcs', ale#path#CdString(g:dir)
|
||||||
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||||
|
|
||||||
Execute(The options should be be used in the command):
|
Execute(The options should be be used in the command):
|
||||||
let g:ale_cs_mcsc_options = '-pkg:dotnet'
|
let g:ale_cs_mcsc_options = '-pkg:dotnet'
|
||||||
|
|
||||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
AssertLinter 'mcs', ale#path#CdString(g:dir)
|
||||||
\ . 'mcs -unsafe -pkg:dotnet -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
\ . 'mcs -unsafe -pkg:dotnet -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||||
|
|
||||||
Execute(The souce path should be be used in the command):
|
Execute(The souce path should be be used in the command):
|
||||||
let g:ale_cs_mcsc_source = '../foo/bar'
|
let g:ale_cs_mcsc_source = '../foo/bar'
|
||||||
|
|
||||||
AssertLinter 'mcs', 'cd ' . ale#Escape('../foo/bar') . ' && '
|
AssertLinter 'mcs', ale#path#CdString('../foo/bar')
|
||||||
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||||
|
|
||||||
Execute(The list of search pathes for assemblies should be be used in the command if not empty):
|
Execute(The list of search pathes for assemblies should be be used in the command if not empty):
|
||||||
let g:ale_cs_mcsc_assembly_path = ['/usr/lib/mono', '../foo/bar']
|
let g:ale_cs_mcsc_assembly_path = ['/usr/lib/mono', '../foo/bar']
|
||||||
|
|
||||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
AssertLinter 'mcs', ale#path#CdString(g:dir)
|
||||||
\ . 'mcs -unsafe'
|
\ . 'mcs -unsafe'
|
||||||
\ . ' -lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar')
|
\ . ' -lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar')
|
||||||
\ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
\ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||||
|
|
||||||
let g:ale_cs_mcsc_assembly_path = []
|
let g:ale_cs_mcsc_assembly_path = []
|
||||||
|
|
||||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
AssertLinter 'mcs', ale#path#CdString(g:dir)
|
||||||
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||||
|
|
||||||
Execute(The list of assemblies should be be used in the command if not empty):
|
Execute(The list of assemblies should be be used in the command if not empty):
|
||||||
let g:ale_cs_mcsc_assemblies = ['foo.dll', 'bar.dll']
|
let g:ale_cs_mcsc_assemblies = ['foo.dll', 'bar.dll']
|
||||||
|
|
||||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
AssertLinter 'mcs', ale#path#CdString(g:dir)
|
||||||
\ . 'mcs -unsafe'
|
\ . 'mcs -unsafe'
|
||||||
\ . ' -r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll')
|
\ . ' -r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll')
|
||||||
\ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
\ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||||
|
|
||||||
let g:ale_cs_mcsc_assemblies = []
|
let g:ale_cs_mcsc_assemblies = []
|
||||||
|
|
||||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
AssertLinter 'mcs', ale#path#CdString(g:dir)
|
||||||
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||||
|
|
|
@ -17,3 +17,10 @@ Execute(The default mix command should be correct):
|
||||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/mix_paths/wrapped_project'))
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/mix_paths/wrapped_project'))
|
||||||
\ . g:env_prefix
|
\ . g:env_prefix
|
||||||
\ . 'mix compile %s'
|
\ . 'mix compile %s'
|
||||||
|
|
||||||
|
Execute(The FindMixProjectRoot should detect the project root directory via mix.exs):
|
||||||
|
silent execute 'file ' . fnameescape(g:dir . '/elixir_paths/mix_project/lib/app.ex')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ ale#path#Simplify(g:dir . '/elixir_paths/mix_project'),
|
||||||
|
\ ale#handlers#elixir#FindMixProjectRoot(bufnr(''))
|
||||||
|
|
|
@ -11,14 +11,14 @@ After:
|
||||||
|
|
||||||
Execute(The default commands should be correct):
|
Execute(The default commands should be correct):
|
||||||
AssertLinter 'go',
|
AssertLinter 'go',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . 'go test -c -o /dev/null ./'
|
\ . 'go test -c -o /dev/null ./'
|
||||||
|
|
||||||
Execute(Extra options should be supported):
|
Execute(Extra options should be supported):
|
||||||
let g:ale_go_gobuild_options = '--foo-bar'
|
let g:ale_go_gobuild_options = '--foo-bar'
|
||||||
|
|
||||||
AssertLinter 'go',
|
AssertLinter 'go',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . 'go test --foo-bar -c -o /dev/null ./'
|
\ . 'go test --foo-bar -c -o /dev/null ./'
|
||||||
|
|
||||||
let g:ale_go_gobuild_options = ''
|
let g:ale_go_gobuild_options = ''
|
||||||
|
@ -27,5 +27,5 @@ Execute(The executable should be configurable):
|
||||||
let g:ale_go_go_executable = 'foobar'
|
let g:ale_go_go_executable = 'foobar'
|
||||||
|
|
||||||
AssertLinter 'foobar',
|
AssertLinter 'foobar',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . 'foobar test -c -o /dev/null ./'
|
\ . 'foobar test -c -o /dev/null ./'
|
||||||
|
|
|
@ -7,7 +7,7 @@ After:
|
||||||
|
|
||||||
Execute(The golangci-lint defaults should be correct):
|
Execute(The golangci-lint defaults should be correct):
|
||||||
AssertLinter 'golangci-lint',
|
AssertLinter 'golangci-lint',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('golangci-lint')
|
\ . ale#Escape('golangci-lint')
|
||||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||||
\ . ' --enable-all'
|
\ . ' --enable-all'
|
||||||
|
@ -16,7 +16,7 @@ Execute(The golangci-lint callback should use a configured executable):
|
||||||
let b:ale_go_golangci_lint_executable = 'something else'
|
let b:ale_go_golangci_lint_executable = 'something else'
|
||||||
|
|
||||||
AssertLinter 'something else',
|
AssertLinter 'something else',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('something else')
|
\ . ale#Escape('something else')
|
||||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||||
\ . ' --enable-all'
|
\ . ' --enable-all'
|
||||||
|
@ -25,7 +25,7 @@ Execute(The golangci-lint callback should use configured options):
|
||||||
let b:ale_go_golangci_lint_options = '--foobar'
|
let b:ale_go_golangci_lint_options = '--foobar'
|
||||||
|
|
||||||
AssertLinter 'golangci-lint',
|
AssertLinter 'golangci-lint',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('golangci-lint')
|
\ . ale#Escape('golangci-lint')
|
||||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||||
\ . ' --foobar'
|
\ . ' --foobar'
|
||||||
|
@ -34,5 +34,5 @@ Execute(The golangci-lint `lint_package` option should use the correct command):
|
||||||
let b:ale_go_golangci_lint_package = 1
|
let b:ale_go_golangci_lint_package = 1
|
||||||
|
|
||||||
AssertLinter 'golangci-lint',
|
AssertLinter 'golangci-lint',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('golangci-lint') . ' run --enable-all'
|
\ . ale#Escape('golangci-lint') . ' run --enable-all'
|
||||||
|
|
|
@ -7,7 +7,7 @@ After:
|
||||||
|
|
||||||
Execute(The gometalinter defaults should be correct):
|
Execute(The gometalinter defaults should be correct):
|
||||||
AssertLinter 'gometalinter',
|
AssertLinter 'gometalinter',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('gometalinter')
|
\ . ale#Escape('gometalinter')
|
||||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||||
\ . ' .'
|
\ . ' .'
|
||||||
|
@ -16,7 +16,7 @@ Execute(The gometalinter callback should use a configured executable):
|
||||||
let b:ale_go_gometalinter_executable = 'something else'
|
let b:ale_go_gometalinter_executable = 'something else'
|
||||||
|
|
||||||
AssertLinter 'something else',
|
AssertLinter 'something else',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('something else')
|
\ . ale#Escape('something else')
|
||||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||||
\ . ' .'
|
\ . ' .'
|
||||||
|
@ -25,7 +25,7 @@ Execute(The gometalinter callback should use configured options):
|
||||||
let b:ale_go_gometalinter_options = '--foobar'
|
let b:ale_go_gometalinter_options = '--foobar'
|
||||||
|
|
||||||
AssertLinter 'gometalinter',
|
AssertLinter 'gometalinter',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('gometalinter')
|
\ . ale#Escape('gometalinter')
|
||||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||||
\ . ' --foobar' . ' .'
|
\ . ' --foobar' . ' .'
|
||||||
|
@ -34,5 +34,5 @@ Execute(The gometalinter `lint_package` option should use the correct command):
|
||||||
let b:ale_go_gometalinter_lint_package = 1
|
let b:ale_go_gometalinter_lint_package = 1
|
||||||
|
|
||||||
AssertLinter 'gometalinter',
|
AssertLinter 'gometalinter',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('gometalinter') . ' .'
|
\ . ale#Escape('gometalinter') . ' .'
|
||||||
|
|
|
@ -7,4 +7,4 @@ After:
|
||||||
|
|
||||||
Execute(The default gosimple command should be correct):
|
Execute(The default gosimple command should be correct):
|
||||||
AssertLinter 'gosimple',
|
AssertLinter 'gosimple',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && gosimple .'
|
\ ale#path#CdString(expand('%:p:h')) . ' gosimple .'
|
||||||
|
|
|
@ -7,7 +7,7 @@ After:
|
||||||
|
|
||||||
Execute(The default gotype command should be correct):
|
Execute(The default gotype command should be correct):
|
||||||
AssertLinter 'gotype',
|
AssertLinter 'gotype',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && gotype .'
|
\ ale#path#CdString(expand('%:p:h')) . ' gotype .'
|
||||||
|
|
||||||
Execute(The gotype callback should ignore test files):
|
Execute(The gotype callback should ignore test files):
|
||||||
call ale#test#SetFilename('bla_test.go')
|
call ale#test#SetFilename('bla_test.go')
|
||||||
|
|
|
@ -8,12 +8,12 @@ After:
|
||||||
call ale#assert#TearDownLinterTest()
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
Execute(The default command should be correct):
|
Execute(The default command should be correct):
|
||||||
AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet .'
|
AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet .'
|
||||||
|
|
||||||
Execute(Extra options should be supported):
|
Execute(Extra options should be supported):
|
||||||
let g:ale_go_govet_options = '--foo-bar'
|
let g:ale_go_govet_options = '--foo-bar'
|
||||||
AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet --foo-bar .'
|
AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet --foo-bar .'
|
||||||
|
|
||||||
Execute(The executable should be configurable):
|
Execute(The executable should be configurable):
|
||||||
let g:ale_go_go_executable = 'foobar'
|
let g:ale_go_go_executable = 'foobar'
|
||||||
AssertLinter 'foobar', 'cd ' . ale#Escape(expand('%:p:h')) . ' && foobar vet .'
|
AssertLinter 'foobar', ale#path#CdString(expand('%:p:h')) . ' foobar vet .'
|
||||||
|
|
|
@ -3,7 +3,7 @@ Before:
|
||||||
call ale#test#SetFilename('dummy.java')
|
call ale#test#SetFilename('dummy.java')
|
||||||
|
|
||||||
let g:cp_sep = has('unix') ? ':' : ';'
|
let g:cp_sep = has('unix') ? ':' : ';'
|
||||||
let g:prefix = 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
let g:prefix = ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('javac') . ' -Xlint'
|
\ . ale#Escape('javac') . ' -Xlint'
|
||||||
|
|
||||||
function! GetCommand(previous_output) abort
|
function! GetCommand(previous_output) abort
|
||||||
|
@ -43,7 +43,7 @@ Execute(The executable should be configurable):
|
||||||
let g:ale_java_javac_executable = 'foobar'
|
let g:ale_java_javac_executable = 'foobar'
|
||||||
|
|
||||||
AssertLinter 'foobar',
|
AssertLinter 'foobar',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('foobar') . ' -Xlint'
|
\ . ale#Escape('foobar') . ' -Xlint'
|
||||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ Execute(The javac callback should detect source directories):
|
||||||
call ale#engine#InitBufferInfo(bufnr(''))
|
call ale#engine#InitBufferInfo(bufnr(''))
|
||||||
|
|
||||||
AssertLinter 'javac',
|
AssertLinter 'javac',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
|
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||||
\ . ' -sourcepath ' . ale#Escape(
|
\ . ' -sourcepath ' . ale#Escape(
|
||||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
|
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
|
||||||
\ )
|
\ )
|
||||||
|
@ -124,7 +124,7 @@ Execute(The javac callback should combine detected source directories and classp
|
||||||
\ '/xyz/abc.jar',
|
\ '/xyz/abc.jar',
|
||||||
\]
|
\]
|
||||||
AssertLinter 'javac',
|
AssertLinter 'javac',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
|
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||||
\ . ' -cp ' . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep))
|
\ . ' -cp ' . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep))
|
||||||
\ . ' -sourcepath ' . ale#Escape(
|
\ . ' -sourcepath ' . ale#Escape(
|
||||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
|
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
|
||||||
|
@ -147,7 +147,7 @@ Execute(The javac callback should include src/test/java for test paths):
|
||||||
call ale#engine#InitBufferInfo(bufnr(''))
|
call ale#engine#InitBufferInfo(bufnr(''))
|
||||||
|
|
||||||
AssertLinter 'javac',
|
AssertLinter 'javac',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
|
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||||
\ . ' -sourcepath ' . ale#Escape(join([
|
\ . ' -sourcepath ' . ale#Escape(join([
|
||||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||||
\ ale#path#Simplify(g:dir . '/java_paths/src/test/java/'),
|
\ ale#path#Simplify(g:dir . '/java_paths/src/test/java/'),
|
||||||
|
@ -160,7 +160,7 @@ Execute(The javac callback should include src/main/jaxb when available):
|
||||||
call ale#engine#InitBufferInfo(bufnr(''))
|
call ale#engine#InitBufferInfo(bufnr(''))
|
||||||
|
|
||||||
AssertLinter 'javac',
|
AssertLinter 'javac',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
|
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||||
\ . ' -sourcepath ' . ale#Escape(join([
|
\ . ' -sourcepath ' . ale#Escape(join([
|
||||||
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/java/'),
|
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/java/'),
|
||||||
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/jaxb/'),
|
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/jaxb/'),
|
||||||
|
|
|
@ -6,7 +6,7 @@ After:
|
||||||
|
|
||||||
Execute(The default lintr command should be correct):
|
Execute(The default lintr command should be correct):
|
||||||
AssertLinter 'Rscript',
|
AssertLinter 'Rscript',
|
||||||
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
\ ale#path#CdString(getcwd())
|
||||||
\ . 'Rscript --vanilla -e '
|
\ . 'Rscript --vanilla -e '
|
||||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||||
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||||
|
@ -17,7 +17,7 @@ Execute(The lintr options should be configurable):
|
||||||
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
|
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
|
||||||
|
|
||||||
AssertLinter 'Rscript',
|
AssertLinter 'Rscript',
|
||||||
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
\ ale#path#CdString(getcwd())
|
||||||
\ . 'Rscript --vanilla -e '
|
\ . 'Rscript --vanilla -e '
|
||||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||||
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||||
|
@ -28,7 +28,7 @@ Execute(If the lint_package flag is set, lintr::lint_package should be called):
|
||||||
let b:ale_r_lintr_lint_package = 1
|
let b:ale_r_lintr_lint_package = 1
|
||||||
|
|
||||||
AssertLinter 'Rscript',
|
AssertLinter 'Rscript',
|
||||||
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
\ ale#path#CdString(getcwd())
|
||||||
\ . 'Rscript --vanilla -e '
|
\ . 'Rscript --vanilla -e '
|
||||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||||
\ . 'lint_package(cache = FALSE, '
|
\ . 'lint_package(cache = FALSE, '
|
||||||
|
|
|
@ -12,7 +12,7 @@ After:
|
||||||
|
|
||||||
Execute(The mypy callbacks should return the correct default values):
|
Execute(The mypy callbacks should return the correct default values):
|
||||||
AssertLinter 'mypy',
|
AssertLinter 'mypy',
|
||||||
\ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
|
\ ale#path#CdString(g:dir) . ale#Escape('mypy')
|
||||||
\ . ' --show-column-numbers '
|
\ . ' --show-column-numbers '
|
||||||
\ . '--shadow-file %s %t %s'
|
\ . '--shadow-file %s %t %s'
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ Execute(The mypy executable should be configurable, and escaped properly):
|
||||||
let g:ale_python_mypy_executable = 'executable with spaces'
|
let g:ale_python_mypy_executable = 'executable with spaces'
|
||||||
|
|
||||||
AssertLinter 'executable with spaces',
|
AssertLinter 'executable with spaces',
|
||||||
\ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('executable with spaces')
|
\ ale#path#CdString(g:dir) . ale#Escape('executable with spaces')
|
||||||
\ . ' --show-column-numbers '
|
\ . ' --show-column-numbers '
|
||||||
\ . '--shadow-file %s %t %s'
|
\ . '--shadow-file %s %t %s'
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ Execute(The mypy command callback should let you set options):
|
||||||
let g:ale_python_mypy_options = '--some-option'
|
let g:ale_python_mypy_options = '--some-option'
|
||||||
|
|
||||||
AssertLinter 'mypy',
|
AssertLinter 'mypy',
|
||||||
\ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
|
\ ale#path#CdString(g:dir) . ale#Escape('mypy')
|
||||||
\ . ' --show-column-numbers --some-option '
|
\ . ' --show-column-numbers --some-option '
|
||||||
\ . '--shadow-file %s %t %s'
|
\ . '--shadow-file %s %t %s'
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ Execute(The mypy command should switch directories to the detected project root)
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py')
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py')
|
||||||
|
|
||||||
AssertLinter 'mypy',
|
AssertLinter 'mypy',
|
||||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir'))
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir'))
|
||||||
\ . ' && ' . ale#Escape('mypy')
|
\ . ale#Escape('mypy')
|
||||||
\ . ' --show-column-numbers '
|
\ . ' --show-column-numbers '
|
||||||
\ . '--shadow-file %s %t %s'
|
\ . '--shadow-file %s %t %s'
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ Execute(The mypy callbacks should detect virtualenv directories and switch to th
|
||||||
let b:executable = ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/mypy')
|
let b:executable = ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/mypy')
|
||||||
|
|
||||||
AssertLinter b:executable,
|
AssertLinter b:executable,
|
||||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
|
||||||
\ . ' && ' . ale#Escape(b:executable)
|
\ . ale#Escape(b:executable)
|
||||||
\ . ' --show-column-numbers '
|
\ . ' --show-column-numbers '
|
||||||
\ . '--shadow-file %s %t %s'
|
\ . '--shadow-file %s %t %s'
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ Execute(You should able able to use the global mypy instead):
|
||||||
let g:ale_python_mypy_use_global = 1
|
let g:ale_python_mypy_use_global = 1
|
||||||
|
|
||||||
AssertLinter 'mypy',
|
AssertLinter 'mypy',
|
||||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
|
||||||
\ . ' && ' . ale#Escape('mypy')
|
\ . ale#Escape('mypy')
|
||||||
\ . ' --show-column-numbers '
|
\ . ' --show-column-numbers '
|
||||||
\ . '--shadow-file %s %t %s'
|
\ . '--shadow-file %s %t %s'
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,5 @@ After:
|
||||||
|
|
||||||
Execute(The default sasslint command should be correct):
|
Execute(The default sasslint command should be correct):
|
||||||
AssertLinter 'sass-lint',
|
AssertLinter 'sass-lint',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('sass-lint') . ' -v -q -f compact %t'
|
\ . ale#Escape('sass-lint') . ' -v -q -f compact %t'
|
||||||
|
|
|
@ -2,7 +2,7 @@ Before:
|
||||||
call ale#assert#SetUpLinterTest('sh', 'shellcheck')
|
call ale#assert#SetUpLinterTest('sh', 'shellcheck')
|
||||||
call ale#test#SetFilename('test.sh')
|
call ale#test#SetFilename('test.sh')
|
||||||
|
|
||||||
let b:prefix = 'cd ' . ale#Escape(ale#path#Simplify(g:dir)) . ' && '
|
let b:prefix = ale#path#CdString(ale#path#Simplify(g:dir))
|
||||||
let b:suffix = ' -f gcc -'
|
let b:suffix = ' -f gcc -'
|
||||||
|
|
||||||
After:
|
After:
|
||||||
|
|
|
@ -7,7 +7,7 @@ After:
|
||||||
|
|
||||||
Execute(The staticcheck callback should return the right defaults):
|
Execute(The staticcheck callback should return the right defaults):
|
||||||
AssertLinter 'staticcheck',
|
AssertLinter 'staticcheck',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . 'staticcheck '
|
\ . 'staticcheck '
|
||||||
\ . ale#Escape(expand('%' . ':t'))
|
\ . ale#Escape(expand('%' . ':t'))
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ Execute(The staticcheck callback should use configured options):
|
||||||
let b:ale_go_staticcheck_options = '-test'
|
let b:ale_go_staticcheck_options = '-test'
|
||||||
|
|
||||||
AssertLinter 'staticcheck',
|
AssertLinter 'staticcheck',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . 'staticcheck '
|
\ . 'staticcheck '
|
||||||
\ . '-test ' . ale#Escape(expand('%' . ':t'))
|
\ . '-test ' . ale#Escape(expand('%' . ':t'))
|
||||||
|
|
||||||
|
@ -23,4 +23,4 @@ Execute(The staticcheck `lint_package` option should use the correct command):
|
||||||
let b:ale_go_staticcheck_lint_package = 1
|
let b:ale_go_staticcheck_lint_package = 1
|
||||||
|
|
||||||
AssertLinter 'staticcheck',
|
AssertLinter 'staticcheck',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && staticcheck .',
|
\ ale#path#CdString(expand('%:p:h')) . 'staticcheck .',
|
||||||
|
|
|
@ -7,14 +7,14 @@ After:
|
||||||
|
|
||||||
Execute(The default tslint command should be correct):
|
Execute(The default tslint command should be correct):
|
||||||
AssertLinter 'tslint',
|
AssertLinter 'tslint',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('tslint') . ' --format json %t'
|
\ . ale#Escape('tslint') . ' --format json %t'
|
||||||
|
|
||||||
Execute(The rules directory option should be included if set):
|
Execute(The rules directory option should be included if set):
|
||||||
let b:ale_typescript_tslint_rules_dir = '/foo/bar'
|
let b:ale_typescript_tslint_rules_dir = '/foo/bar'
|
||||||
|
|
||||||
AssertLinter 'tslint',
|
AssertLinter 'tslint',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('tslint') . ' --format json'
|
\ . ale#Escape('tslint') . ' --format json'
|
||||||
\ . ' -r ' . ale#Escape('/foo/bar')
|
\ . ' -r ' . ale#Escape('/foo/bar')
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
|
@ -23,5 +23,5 @@ Execute(The executable should be configurable and escaped):
|
||||||
let b:ale_typescript_tslint_executable = 'foo bar'
|
let b:ale_typescript_tslint_executable = 'foo bar'
|
||||||
|
|
||||||
AssertLinter 'foo bar',
|
AssertLinter 'foo bar',
|
||||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('foo bar') . ' --format json %t'
|
\ . ale#Escape('foo bar') . ' --format json %t'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Before:
|
Before:
|
||||||
Save g:ale_google_java_format_executable
|
Save g:ale_java_google_java_format_executable
|
||||||
|
|
||||||
" Use an invalid global executable, so we don't match it.
|
" Use an invalid global executable, so we don't match it.
|
||||||
let g:ale_google_java_format_executable = 'xxxinvalid'
|
let g:ale_java_google_java_format_executable = 'xxxinvalid'
|
||||||
|
|
||||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||||
|
|
||||||
|
@ -17,11 +17,11 @@ Execute(The google-java-format callback should return 0 when the executable isn'
|
||||||
\ ale#fixers#google_java_format#Fix(bufnr(''))
|
\ ale#fixers#google_java_format#Fix(bufnr(''))
|
||||||
|
|
||||||
Execute(The google-java-format callback should run the command when the executable test passes):
|
Execute(The google-java-format callback should run the command when the executable test passes):
|
||||||
let g:ale_google_java_format_executable = has('win32') ? 'cmd' : 'echo'
|
let g:ale_java_google_java_format_executable = has('win32') ? 'cmd' : 'echo'
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command': ale#Escape(ale_google_java_format_executable) . ' --replace %t'
|
\ 'command': ale#Escape(ale_java_google_java_format_executable) . ' --replace %t'
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#google_java_format#Fix(bufnr(''))
|
\ ale#fixers#google_java_format#Fix(bufnr(''))
|
||||||
|
|
|
@ -27,7 +27,7 @@ Execute(The isort callback should return the correct default values):
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo')) . ' && '
|
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo'))
|
||||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#isort#Fix(bufnr(''))
|
\ ale#fixers#isort#Fix(bufnr(''))
|
||||||
|
@ -42,7 +42,7 @@ Execute(The isort callback should respect custom options):
|
||||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo')) . ' && '
|
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo'))
|
||||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort'))
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort'))
|
||||||
\ . ' --multi-line=3 --trailing-comma -',
|
\ . ' --multi-line=3 --trailing-comma -',
|
||||||
\ },
|
\ },
|
||||||
|
|
|
@ -85,7 +85,7 @@ Execute(The new --stdin-filepath option should be used when the version is new e
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('prettier-eslint')
|
\ . ale#Escape('prettier-eslint')
|
||||||
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
|
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -106,7 +106,7 @@ Execute(The version number should be cached):
|
||||||
" The newer command should be used.
|
" The newer command should be used.
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape('prettier-eslint')
|
\ . ale#Escape('prettier-eslint')
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
\ },
|
\ },
|
||||||
|
|
|
@ -74,7 +74,7 @@ Execute(--stdin-filepath should be used when prettier is new enough):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --no-semi'
|
\ . ' --no-semi'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -90,7 +90,7 @@ Execute(The version number should be cached):
|
||||||
" Call it again without the version output. We should use the newer command.
|
" Call it again without the version output. We should use the newer command.
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
\ },
|
\ },
|
||||||
|
@ -103,7 +103,7 @@ Execute(Should set --parser based on filetype, TypeScript):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser typescript'
|
\ . ' --parser typescript'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -117,7 +117,7 @@ Execute(Should set --parser based on filetype, CSS):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser css'
|
\ . ' --parser css'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -131,7 +131,7 @@ Execute(Should set --parser based on filetype, LESS):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser less'
|
\ . ' --parser less'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -145,7 +145,7 @@ Execute(Should set --parser based on filetype, SCSS):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser scss'
|
\ . ' --parser scss'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -159,7 +159,7 @@ Execute(Should set --parser based on filetype, JSON):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser json'
|
\ . ' --parser json'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -173,7 +173,7 @@ Execute(Should set --parser based on filetype, JSON5):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser json5'
|
\ . ' --parser json5'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -187,7 +187,7 @@ Execute(Should set --parser based on filetype, GraphQL):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser graphql'
|
\ . ' --parser graphql'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -201,7 +201,7 @@ Execute(Should set --parser based on filetype, Markdown):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser markdown'
|
\ . ' --parser markdown'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -215,7 +215,7 @@ Execute(Should set --parser based on filetype, Vue):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser vue'
|
\ . ' --parser vue'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -229,7 +229,7 @@ Execute(Should set --parser based on filetype, YAML):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser yaml'
|
\ . ' --parser yaml'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
@ -243,7 +243,7 @@ Execute(Should set --parser based on first filetype of multiple filetypes):
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ {
|
\ {
|
||||||
\ 'command': 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||||
\ . ' --parser css'
|
\ . ' --parser css'
|
||||||
\ . ' --stdin-filepath %s --stdin',
|
\ . ' --stdin-filepath %s --stdin',
|
||||||
|
|
|
@ -25,8 +25,8 @@ Execute(Should return 'gradlew' command if project includes gradle wapper):
|
||||||
call ale#test#SetFilename('gradle-test-files/wrapped-project/src/main/kotlin/dummy.kt')
|
call ale#test#SetFilename('gradle-test-files/wrapped-project/src/main/kotlin/dummy.kt')
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/gradle-test-files/wrapped-project'))
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/gradle-test-files/wrapped-project'))
|
||||||
\ . ' && ' . ale#Escape(ale#path#Simplify(g:dir . '/gradle-test-files/wrapped-project/gradlew'))
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/gradle-test-files/wrapped-project/gradlew'))
|
||||||
\ . g:command_tail,
|
\ . g:command_tail,
|
||||||
\ ale#gradle#BuildClasspathCommand(bufnr(''))
|
\ ale#gradle#BuildClasspathCommand(bufnr(''))
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ Execute(Should return 'gradle' command if project does not include gradle wapper
|
||||||
\ . ale#path#Simplify(g:dir . '/gradle-test-files')
|
\ . ale#path#Simplify(g:dir . '/gradle-test-files')
|
||||||
|
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/gradle-test-files/unwrapped-project'))
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/gradle-test-files/unwrapped-project'))
|
||||||
\ . ' && ' . ale#Escape('gradle')
|
\ . ale#Escape('gradle')
|
||||||
\ . g:command_tail,
|
\ . g:command_tail,
|
||||||
\ ale#gradle#BuildClasspathCommand(bufnr(''))
|
\ ale#gradle#BuildClasspathCommand(bufnr(''))
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,12 @@ After:
|
||||||
Execute(CdString should output the correct command string):
|
Execute(CdString should output the correct command string):
|
||||||
" We will check that escaping is done correctly for each platform.
|
" We will check that escaping is done correctly for each platform.
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ has('unix') ? 'cd ''/foo bar/baz'' && ' : 'cd "/foo bar/baz" && ',
|
\ has('unix') ? 'cd ''/foo bar/baz'' && ' : 'cd /d "/foo bar/baz" && ',
|
||||||
\ ale#path#CdString('/foo bar/baz')
|
\ ale#path#CdString('/foo bar/baz')
|
||||||
|
|
||||||
Execute(BufferCdString should output the correct command string):
|
Execute(BufferCdString should output the correct command string):
|
||||||
call ale#test#SetFilename('foo.txt')
|
call ale#test#SetFilename('foo.txt')
|
||||||
|
|
||||||
AssertEqual 'cd ' . ale#Escape(g:dir) . ' && ', ale#path#BufferCdString(bufnr(''))
|
AssertEqual
|
||||||
|
\ has('unix') ? 'cd ' . ale#Escape(g:dir) . ' && ' : 'cd /d ' . ale#Escape(g:dir) . ' && ',
|
||||||
|
\ ale#path#BufferCdString(bufnr(''))
|
||||||
|
|
Reference in a new issue