Close #3325 - Apply new formatting where possible

This commit is contained in:
w0rp 2020-08-28 19:50:36 +01:00
parent 3d5a2690ce
commit 7d4ce4e6aa
No known key found for this signature in database
GPG key ID: 0FC1ECAA8C81CD83
30 changed files with 71 additions and 96 deletions

5
.gitignore vendored
View file

@ -1,11 +1,12 @@
!.editorconfig !.editorconfig
*.obj *.obj
*.pyc
# Ignore all hidden files everywhere. # Ignore all hidden files everywhere.
# Use `git add -f` to add hidden files. # Use `git add -f` to add hidden files.
.* .*
__pycache__
*.pyc
/doc/tags /doc/tags
/init.vim /init.vim
/test/ale-info-test-file /test/ale-info-test-file
/vader_output
__pycache__
tags tags

View file

@ -18,7 +18,7 @@ function! ale_linters#ada#gcc#GetCommand(buffer) abort
" -gnatc: Check syntax and semantics only (no code generation attempted) " -gnatc: Check syntax and semantics only (no code generation attempted)
return '%e -x ada -c -gnatc' return '%e -x ada -c -gnatc'
\ . ' -o ' . ale#Escape(l:out_file) \ . ' -o ' . ale#Escape(l:out_file)
\ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . ' -I %s:h'
\ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options')) \ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options'))
\ . ' %t' \ . ' %t'
endfunction endfunction

View file

@ -9,7 +9,7 @@ function! ale_linters#asm#gcc#GetCommand(buffer) abort
" -fsyntax-only doesn't catch everything. " -fsyntax-only doesn't catch everything.
return '%e -x assembler' return '%e -x assembler'
\ . ' -o ' . g:ale#util#nul_file \ . ' -o ' . g:ale#util#nul_file
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . '-iquote %s:h'
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -' \ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
endfunction endfunction

View file

@ -38,7 +38,7 @@ function! ale_linters#c#cc#GetCommand(buffer, output) abort
" -fsyntax-only doesn't catch everything. " -fsyntax-only doesn't catch everything.
return '%e -S -x c' return '%e -S -x c'
\ . ' -o ' . g:ale#util#nul_file \ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . ' -iquote %s:h'
\ . ale#Pad(l:cflags) \ . ale#Pad(l:cflags)
\ . ale#Pad(l:ale_flags) . ' -' \ . ale#Pad(l:ale_flags) . ' -'
endfunction endfunction

View file

@ -38,7 +38,7 @@ function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
" -fsyntax-only doesn't catch everything. " -fsyntax-only doesn't catch everything.
return '%e -S -x c++' return '%e -S -x c++'
\ . ' -o ' . g:ale#util#nul_file \ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . ' -iquote %s:h'
\ . ale#Pad(l:cflags) \ . ale#Pad(l:cflags)
\ . ale#Pad(l:ale_flags) . ' -' \ . ale#Pad(l:ale_flags) . ' -'
endfunction endfunction

View file

@ -5,9 +5,6 @@ call ale#Set('cuda_nvcc_executable', 'nvcc')
call ale#Set('cuda_nvcc_options', '-std=c++11') call ale#Set('cuda_nvcc_options', '-std=c++11')
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
" Unused: use ale#util#nul_file
" let l:output_file = ale#util#Tempname() . '.ii'
" call ale#command#ManageFile(a:buffer, l:output_file)
return '%e -cuda' return '%e -cuda'
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))) \ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options')) \ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))

View file

@ -11,7 +11,7 @@ function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'ruumba') return ale#ruby#EscapeExecutable(l:executable, 'ruumba')
\ . ' --format json --force-exclusion ' \ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'eruby_ruumba_options') \ . ale#Var(a:buffer, 'eruby_ruumba_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) \ . ' --stdin %s'
endfunction endfunction
function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort

View file

@ -7,10 +7,9 @@ call ale#Set('nasm_nasm_options', '')
function! ale_linters#nasm#nasm#GetCommand(buffer) abort function! ale_linters#nasm#nasm#GetCommand(buffer) abort
" Note that NASM requires a trailing slash for the -I option. " Note that NASM requires a trailing slash for the -I option.
let l:separator = has('win32') ? '\' : '/' let l:separator = has('win32') ? '\' : '/'
let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator
let l:output_null = has('win32') ? 'NUL' : '/dev/null' let l:output_null = has('win32') ? 'NUL' : '/dev/null'
return '%e -X gnu -I ' . ale#Escape(l:path) return '%e -X gnu -I %s:h' . l:separator
\ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options')) \ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
\ . ' %s' \ . ' %s'
\ . ' -o ' . l:output_null \ . ' -o ' . l:output_null

View file

@ -10,7 +10,7 @@ function! ale_linters#objc#clang#GetCommand(buffer) abort
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return 'clang -S -x objective-c -fsyntax-only ' return 'clang -S -x objective-c -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . '-iquote %s:h'
\ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -' \ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -'
endfunction endfunction

View file

@ -10,7 +10,7 @@ function! ale_linters#objcpp#clang#GetCommand(buffer) abort
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return 'clang++ -S -x objective-c++ -fsyntax-only ' return 'clang++ -S -x objective-c++ -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) \ . '-iquote %s:h'
\ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -' \ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -'
endfunction endfunction

View file

@ -6,9 +6,7 @@ call ale#Set('pyrex_cython_executable', 'cython')
call ale#Set('pyrex_cython_options', '--warning-extra') call ale#Set('pyrex_cython_options', '--warning-extra')
function! ale_linters#pyrex#cython#GetCommand(buffer) abort function! ale_linters#pyrex#cython#GetCommand(buffer) abort
let l:local_dir = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) return '%e --working %s:h --include-dir %s:h'
return '%e --working ' . l:local_dir . ' --include-dir ' . l:local_dir
\ . ale#Pad(ale#Var(a:buffer, 'pyrex_cython_options')) \ . ale#Pad(ale#Var(a:buffer, 'pyrex_cython_options'))
\ . ' --output-file ' . g:ale#util#nul_file . ' %t' \ . ' --output-file ' . g:ale#util#nul_file . ' %t'
endfunction endfunction

View file

@ -16,17 +16,15 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
let l:dir = fnamemodify(bufname(a:buffer), ':p:h')
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer) let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv$' let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run pydocstyle' \ ? ' run pydocstyle'
\ : '' \ : ''
return ale#path#CdString(l:dir) return ale#path#BufferCdString(a:buffer)
\ . ale#Escape(l:executable) . l:exec_args \ . ale#Escape(l:executable) . l:exec_args
\ . ' ' . ale#Var(a:buffer, 'python_pydocstyle_options') \ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options'))
\ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:t')) \ . ' %s:t'
endfunction endfunction
function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort

View file

@ -10,7 +10,7 @@ function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'rubocop') return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . ' --format json --force-exclusion ' \ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'ruby_rubocop_options') \ . ale#Var(a:buffer, 'ruby_rubocop_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) \ . ' --stdin %s'
endfunction endfunction
function! ale_linters#ruby#rubocop#GetType(severity) abort function! ale_linters#ruby#rubocop#GetType(severity) abort

View file

@ -11,7 +11,7 @@ function! ale_linters#ruby#standardrb#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'standardrb') return ale#ruby#EscapeExecutable(l:executable, 'standardrb')
\ . ' --format json --force-exclusion ' \ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'ruby_standardrb_options') \ . ale#Var(a:buffer, 'ruby_standardrb_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) \ . ' --stdin %s'
endfunction endfunction
" standardrb is based on RuboCop so the callback is the same " standardrb is based on RuboCop so the callback is the same

View file

@ -501,10 +501,10 @@ endfunction
function! ale#c#GetMakeCommand(buffer) abort function! ale#c#GetMakeCommand(buffer) abort
if s:CanParseMakefile(a:buffer) if s:CanParseMakefile(a:buffer)
let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile') let l:path = ale#path#FindNearestFile(a:buffer, 'Makefile')
if !empty(l:makefile_path) if !empty(l:path)
return 'cd '. fnamemodify(l:makefile_path, ':p:h') . ' && make -n' return ale#path#CdString(fnamemodify(l:path, ':h')) . 'make -n'
endif endif
endif endif

View file

@ -5,14 +5,13 @@ call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat')
call ale#Set('ocaml_ocamlformat_options', '') call ale#Set('ocaml_ocamlformat_options', '')
function! ale#fixers#ocamlformat#Fix(buffer) abort function! ale#fixers#ocamlformat#Fix(buffer) abort
let l:filename = expand('#' . a:buffer . ':p')
let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable') let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable')
let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options') let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options')
return { return {
\ 'command': ale#Escape(l:executable) \ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options) \ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --name=' . ale#Escape(l:filename) \ . ' --name=%s'
\ . ' -' \ . ' -'
\} \}
endfunction endfunction

View file

@ -29,8 +29,7 @@ function! ale#fixers#rubocop#GetCommand(buffer) abort
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct') \ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct')
\ . ' --force-exclusion --stdin ' \ . ' --force-exclusion --stdin %s'
\ . ale#Escape(expand('#' . a:buffer . ':p'))
endfunction endfunction
function! ale#fixers#rubocop#Fix(buffer) abort function! ale#fixers#rubocop#Fix(buffer) abort

View file

@ -18,11 +18,10 @@ After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable): Execute(The executable should be configurable):
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') . ' -x ada -c -gnatc' \ ale#Escape('gcc') . ' -x ada -c -gnatc'
\ . ' -o ' . b:out_file \ . ' -o ' . b:out_file
\ . ' -I ' . ale#Escape(getcwd()) \ . ' -I %s:h'
\ . ' -gnatwa -gnatq %t' \ . ' -gnatwa -gnatq %t'
let b:ale_ada_gcc_executable = 'foo' let b:ale_ada_gcc_executable = 'foo'
@ -30,15 +29,14 @@ Execute(The executable should be configurable):
AssertLinter 'foo', AssertLinter 'foo',
\ ale#Escape('foo') . ' -x ada -c -gnatc' \ ale#Escape('foo') . ' -x ada -c -gnatc'
\ . ' -o ' . b:out_file \ . ' -o ' . b:out_file
\ . ' -I ' . ale#Escape(getcwd()) \ . ' -I %s:h'
\ . ' -gnatwa -gnatq %t' \ . ' -gnatwa -gnatq %t'
Execute(The options should be configurable): Execute(The options should be configurable):
let g:ale_ada_gcc_options = '--foo --bar' let g:ale_ada_gcc_options = '--foo --bar'
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') . ' -x ada -c -gnatc' \ ale#Escape('gcc') . ' -x ada -c -gnatc'
\ . ' -o ' . b:out_file \ . ' -o ' . b:out_file
\ . ' -I ' . ale#Escape(getcwd()) \ . ' -I %s:h'
\ . ' --foo --bar %t' \ . ' --foo --bar %t'

View file

@ -3,7 +3,7 @@ Before:
call ale#test#SetFilename('test.cpp') call ale#test#SetFilename('test.cpp')
let b:command_tail = ' -x assembler' let b:command_tail = ' -x assembler'
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
\ . '-iquote ' . ale#Escape(g:dir) \ . '-iquote %s:h'
\ . ' -Wall -' \ . ' -Wall -'
After: After:

View file

@ -23,7 +23,7 @@ Before:
let b:command_tail = ' -S -x c' let b:command_tail = ' -S -x c'
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(getcwd()) \ . ' -iquote %s:h'
\ . ' -std=c11 -Wall -' \ . ' -std=c11 -Wall -'
After: After:

View file

@ -43,7 +43,7 @@ Execute(The C cc linter should include 'include' directories for projects with a
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') \ ale#Escape('gcc')
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir')) \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include')) \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
\ . ' -' \ . ' -'
@ -55,7 +55,7 @@ Execute(The C cc linter should include 'include' directories for projects with a
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') \ ale#Escape('gcc')
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir')) \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include')) \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
\ . ' -' \ . ' -'
@ -67,7 +67,7 @@ Execute(The C cc linter should include root directories for projects with .h fil
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') \ ale#Escape('gcc')
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir')) \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project')) \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
\ . ' -' \ . ' -'
@ -79,7 +79,7 @@ Execute(The C cc linter should include root directories for projects with .hpp f
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') \ ale#Escape('gcc')
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir')) \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project')) \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
\ . ' -' \ . ' -'
@ -101,7 +101,7 @@ Execute(The C++ cc linter should include 'include' directories for projects with
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') \ ale#Escape('gcc')
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir')) \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include')) \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
\ . ' -' \ . ' -'
@ -113,7 +113,7 @@ Execute(The C++ cc linter should include 'include' directories for projects with
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') \ ale#Escape('gcc')
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir')) \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include')) \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
\ . ' -' \ . ' -'
@ -125,7 +125,7 @@ Execute(The C++ cc linter should include root directories for projects with .h f
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') \ ale#Escape('gcc')
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir')) \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project')) \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
\ . ' -' \ . ' -'
@ -137,7 +137,7 @@ Execute(The C++ cc linter should include root directories for projects with .hpp
AssertLinter 'gcc', AssertLinter 'gcc',
\ ale#Escape('gcc') \ ale#Escape('gcc')
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir')) \ . ' -iquote %s:h'
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project')) \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
\ . ' -' \ . ' -'

View file

@ -23,7 +23,7 @@ Before:
let b:command_tail = ' -S -x c++' let b:command_tail = ' -S -x c++'
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null') \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(getcwd()) \ . ' -iquote %s:h'
\ . ' -std=c++14 -Wall -' \ . ' -std=c++14 -Wall -'
After: After:

View file

@ -2,9 +2,9 @@ Before:
call ale#assert#SetUpLinterTest('nasm', 'nasm') call ale#assert#SetUpLinterTest('nasm', 'nasm')
let b:command_tail = let b:command_tail =
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null') \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
let b:command_tail_opt = let b:command_tail_opt =
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null') \ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
After: After:
unlet! b:command_tail unlet! b:command_tail
@ -23,7 +23,8 @@ Execute(The options should be configurable):
let b:ale_nasm_nasm_options = '-w-macro-params' let b:ale_nasm_nasm_options = '-w-macro-params'
AssertLinter 'nasm', ale#Escape('nasm') AssertLinter 'nasm', ale#Escape('nasm')
\ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null') \ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/')
\ . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
Execute(The options should be used in command): Execute(The options should be used in command):
let b:ale_nasm_nasm_options = '-w+orphan-labels' let b:ale_nasm_nasm_options = '-w+orphan-labels'

View file

@ -7,34 +7,34 @@ After:
Execute(The pydocstyle command callback should return default string): Execute(The pydocstyle command callback should return default string):
AssertLinter 'pydocstyle', AssertLinter 'pydocstyle',
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('pydocstyle') . ' ' . ale#Escape('test.py') \ . ale#Escape('pydocstyle') . ' %s:t'
Execute(The pydocstyle command callback should allow options): Execute(The pydocstyle command callback should allow options):
let g:ale_python_pydocstyle_options = '--verbose' let g:ale_python_pydocstyle_options = '--verbose'
AssertLinter 'pydocstyle', AssertLinter 'pydocstyle',
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('pydocstyle') . ' --verbose ' . ale#Escape('test.py') \ . ale#Escape('pydocstyle') . ' --verbose %s:t'
Execute(The pydocstyle executable should be configurable): Execute(The pydocstyle executable should be configurable):
let g:ale_python_pydocstyle_executable = '~/.local/bin/pydocstyle' let g:ale_python_pydocstyle_executable = '~/.local/bin/pydocstyle'
AssertLinter '~/.local/bin/pydocstyle', AssertLinter '~/.local/bin/pydocstyle',
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('~/.local/bin/pydocstyle') . ' ' . ale#Escape('test.py') \ . ale#Escape('~/.local/bin/pydocstyle') . ' %s:t'
Execute(Setting executable to 'pipenv' appends 'run pydocstyle'): Execute(Setting executable to 'pipenv' appends 'run pydocstyle'):
let g:ale_python_pydocstyle_executable = 'path/to/pipenv' let g:ale_python_pydocstyle_executable = 'path/to/pipenv'
AssertLinter 'path/to/pipenv', AssertLinter 'path/to/pipenv',
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('path/to/pipenv') . ' run pydocstyle ' . ale#Escape('test.py') \ . ale#Escape('path/to/pipenv') . ' run pydocstyle %s:t'
Execute(Pipenv is detected when python_pydocstyle_auto_pipenv is set): Execute(Pipenv is detected when python_pydocstyle_auto_pipenv is set):
let g:ale_python_pydocstyle_auto_pipenv = 1 let g:ale_python_pydocstyle_auto_pipenv = 1
call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py') call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertLinter 'pipenv', AssertLinter 'pipenv',
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) \ ale#path#BufferCdString(bufnr(''))
\ . ale#Escape('pipenv') . ' run pydocstyle ' . ale#Escape('whatever.py') \ . ale#Escape('pipenv') . ' run pydocstyle %s:t'

View file

@ -6,8 +6,8 @@ After:
Execute(The default cython command should be correct): Execute(The default cython command should be correct):
AssertLinter 'cython', ale#Escape('cython') AssertLinter 'cython', ale#Escape('cython')
\ . ' --working ' . ale#Escape(g:dir) \ . ' --working %s:h'
\ . ' --include-dir ' . ale#Escape(g:dir) \ . ' --include-dir %s:h'
\ . ' --warning-extra' \ . ' --warning-extra'
\ . ' --output-file ' . g:ale#util#nul_file . ' %t' \ . ' --output-file ' . g:ale#util#nul_file . ' %t'
@ -15,8 +15,8 @@ Execute(The cython executable should be configurable):
let b:ale_pyrex_cython_executable = 'cython_foobar' let b:ale_pyrex_cython_executable = 'cython_foobar'
AssertLinter 'cython_foobar', ale#Escape('cython_foobar') AssertLinter 'cython_foobar', ale#Escape('cython_foobar')
\ . ' --working ' . ale#Escape(g:dir) \ . ' --working %s:h'
\ . ' --include-dir ' . ale#Escape(g:dir) \ . ' --include-dir %s:h'
\ . ' --warning-extra' \ . ' --warning-extra'
\ . ' --output-file ' . g:ale#util#nul_file . ' %t' \ . ' --output-file ' . g:ale#util#nul_file . ' %t'
@ -24,7 +24,7 @@ Execute(Additional cython options should be configurable):
let b:ale_pyrex_cython_options = '--foobar' let b:ale_pyrex_cython_options = '--foobar'
AssertLinter 'cython', ale#Escape('cython') AssertLinter 'cython', ale#Escape('cython')
\ . ' --working ' . ale#Escape(g:dir) \ . ' --working %s:h'
\ . ' --include-dir ' . ale#Escape(g:dir) \ . ' --include-dir %s:h'
\ . ' --foobar' \ . ' --foobar'
\ . ' --output-file ' . g:ale#util#nul_file . ' %t' \ . ' --output-file ' . g:ale#util#nul_file . ' %t'

View file

@ -10,20 +10,17 @@ After:
Execute(Executable should default to rubocop): Execute(Executable should default to rubocop):
AssertLinter 'rubocop', ale#Escape('rubocop') AssertLinter 'rubocop', ale#Escape('rubocop')
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
Execute(Should be able to set a custom executable): Execute(Should be able to set a custom executable):
let g:ale_ruby_rubocop_executable = 'bin/rubocop' let g:ale_ruby_rubocop_executable = 'bin/rubocop'
AssertLinter 'bin/rubocop' , ale#Escape('bin/rubocop') AssertLinter 'bin/rubocop' , ale#Escape('bin/rubocop')
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
Execute(Setting bundle appends 'exec rubocop'): Execute(Setting bundle appends 'exec rubocop'):
let g:ale_ruby_rubocop_executable = 'path to/bundle' let g:ale_ruby_rubocop_executable = 'path to/bundle'
AssertLinter 'path to/bundle', ale#Escape('path to/bundle') AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
\ . ' exec rubocop' \ . ' exec rubocop'
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))

View file

@ -10,20 +10,17 @@ After:
Execute(Executable should default to ruumba): Execute(Executable should default to ruumba):
AssertLinter 'ruumba', ale#Escape('ruumba') AssertLinter 'ruumba', ale#Escape('ruumba')
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))
Execute(Should be able to set a custom executable): Execute(Should be able to set a custom executable):
let g:ale_eruby_ruumba_executable = 'bin/ruumba' let g:ale_eruby_ruumba_executable = 'bin/ruumba'
AssertLinter 'bin/ruumba' , ale#Escape('bin/ruumba') AssertLinter 'bin/ruumba' , ale#Escape('bin/ruumba')
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))
Execute(Setting bundle appends 'exec ruumba'): Execute(Setting bundle appends 'exec ruumba'):
let g:ale_eruby_ruumba_executable = 'path to/bundle' let g:ale_eruby_ruumba_executable = 'path to/bundle'
AssertLinter 'path to/bundle', ale#Escape('path to/bundle') AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
\ . ' exec ruumba' \ . ' exec ruumba'
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))

View file

@ -10,20 +10,17 @@ After:
Execute(Executable should default to standardrb): Execute(Executable should default to standardrb):
AssertLinter 'standardrb', ale#Escape('standardrb') AssertLinter 'standardrb', ale#Escape('standardrb')
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
Execute(Should be able to set a custom executable): Execute(Should be able to set a custom executable):
let g:ale_ruby_standardrb_executable = 'bin/standardrb' let g:ale_ruby_standardrb_executable = 'bin/standardrb'
AssertLinter 'bin/standardrb' , ale#Escape('bin/standardrb') AssertLinter 'bin/standardrb' , ale#Escape('bin/standardrb')
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
Execute(Setting bundle appends 'exec standardrb'): Execute(Setting bundle appends 'exec standardrb'):
let g:ale_ruby_standardrb_executable = 'path to/bundle' let g:ale_ruby_standardrb_executable = 'path to/bundle'
AssertLinter 'path to/bundle', ale#Escape('path to/bundle') AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
\ . ' exec standardrb' \ . ' exec standardrb'
\ . ' --format json --force-exclusion --stdin ' \ . ' --format json --force-exclusion --stdin %s'
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))

View file

@ -19,8 +19,7 @@ Execute(The ocamlformat callback should return the correct default values):
AssertEqual AssertEqual
\ { \ {
\ 'command': ale#Escape('xxxinvalid') \ 'command': ale#Escape('xxxinvalid')
\ . ' --name=' . ale#Escape(bufname(bufnr(''))) \ . ' --name=%s -',
\ . ' -',
\ }, \ },
\ ale#fixers#ocamlformat#Fix(bufnr('')) \ ale#fixers#ocamlformat#Fix(bufnr(''))
@ -32,7 +31,6 @@ Execute(The ocamlformat callback should include custom ocamlformat options):
\ { \ {
\ 'command': ale#Escape('xxxinvalid') \ 'command': ale#Escape('xxxinvalid')
\ . ' ' . g:ale_ocaml_ocamlformat_options \ . ' ' . g:ale_ocaml_ocamlformat_options
\ . ' --name=' . ale#Escape(bufname(bufnr(''))) \ . ' --name=%s -',
\ . ' -',
\ }, \ },
\ ale#fixers#ocamlformat#Fix(bufnr('')) \ ale#fixers#ocamlformat#Fix(bufnr(''))

View file

@ -23,8 +23,7 @@ Execute(The rubocop callback should return the correct default values):
\ { \ {
\ 'process_with': 'ale#fixers#rubocop#PostProcess', \ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable) \ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --auto-correct --force-exclusion --stdin ' \ . ' --auto-correct --force-exclusion --stdin %s',
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
\ }, \ },
\ ale#fixers#rubocop#Fix(bufnr('')) \ ale#fixers#rubocop#Fix(bufnr(''))
@ -36,8 +35,7 @@ Execute(The rubocop callback should include configuration files):
\ 'process_with': 'ale#fixers#rubocop#PostProcess', \ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable) \ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml')) \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
\ . ' --auto-correct --force-exclusion --stdin ' \ . ' --auto-correct --force-exclusion --stdin %s',
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
\ }, \ },
\ ale#fixers#rubocop#Fix(bufnr('')) \ ale#fixers#rubocop#Fix(bufnr(''))
@ -51,8 +49,7 @@ Execute(The rubocop callback should include custom rubocop options):
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable) \ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml')) \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
\ . ' --except Lint/Debugger' \ . ' --except Lint/Debugger'
\ . ' --auto-correct --force-exclusion --stdin ' \ . ' --auto-correct --force-exclusion --stdin %s',
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
\ }, \ },
\ ale#fixers#rubocop#Fix(bufnr('')) \ ale#fixers#rubocop#Fix(bufnr(''))
@ -65,8 +62,7 @@ Execute(The rubocop callback should use auto-correct-all option when set):
\ 'process_with': 'ale#fixers#rubocop#PostProcess', \ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable) \ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml')) \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
\ . ' --auto-correct-all --force-exclusion --stdin ' \ . ' --auto-correct-all --force-exclusion --stdin %s'
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
\ }, \ },
\ ale#fixers#rubocop#Fix(bufnr('')) \ ale#fixers#rubocop#Fix(bufnr(''))