Updated plugins
This commit is contained in:
parent
587a185a98
commit
6bd9eda8c3
|
@ -4,15 +4,10 @@
|
|||
call ale#Set('asm_gcc_executable', 'gcc')
|
||||
call ale#Set('asm_gcc_options', '-Wall')
|
||||
|
||||
function! ale_linters#asm#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'asm_gcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#asm#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -x assembler -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||
return '%e -x assembler -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#asm#gcc#Handle(buffer, lines) abort
|
||||
|
@ -33,7 +28,7 @@ endfunction
|
|||
call ale#linter#Define('asm', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#asm#gcc#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('asm_gcc_executable'),
|
||||
\ 'command_callback': 'ale_linters#asm#gcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
||||
\})
|
||||
|
|
|
@ -1,29 +1,21 @@
|
|||
" Author: kmarc <korondi.mark@gmail.com>
|
||||
" Description: This file adds support for using GNU awk with sripts.
|
||||
|
||||
let g:ale_awk_gawk_executable =
|
||||
\ get(g:, 'ale_awk_gawk_executable', 'gawk')
|
||||
|
||||
let g:ale_awk_gawk_options =
|
||||
\ get(g:, 'ale_awk_gawk_options', '')
|
||||
|
||||
function! ale_linters#awk#gawk#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'awk_gawk_executable')
|
||||
endfunction
|
||||
call ale#Set('awk_gawk_executable', 'gawk')
|
||||
call ale#Set('awk_gawk_options', '')
|
||||
|
||||
function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
||||
" note the --source 'BEGIN ...' is to prevent
|
||||
" gawk from attempting to execute the body of the script
|
||||
" it is linting.
|
||||
return ale#Escape(ale_linters#awk#gawk#GetExecutable(a:buffer))
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
||||
\ . ' ' . '-f %t --lint /dev/null'
|
||||
\ . ' -f %t --lint /dev/null'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('awk', {
|
||||
\ 'name': 'gawk',
|
||||
\ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('awk_gawk_executable'),
|
||||
\ 'command_callback': 'ale_linters#awk#gawk#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gawk#HandleGawkFormat',
|
||||
\ 'output_stream': 'both'
|
||||
|
|
|
@ -4,17 +4,12 @@
|
|||
call ale#Set('c_clang_executable', 'clang')
|
||||
call ale#Set('c_clang_options', '-std=c11 -Wall')
|
||||
|
||||
function! ale_linters#c#clang#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_clang_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clang#GetCommand(buffer, output) abort
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c -fsyntax-only'
|
||||
return '%e -S -x c -fsyntax-only'
|
||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_clang_options')) . ' -'
|
||||
|
@ -23,7 +18,7 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clang',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#c#clang#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('c_clang_executable'),
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#c#clang#GetCommand'}
|
||||
|
|
|
@ -9,21 +9,14 @@ function! ale_linters#c#clangd#GetProjectRoot(buffer) abort
|
|||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangd#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_clangd_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#c#clangd#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'c_clangd_options')
|
||||
|
||||
return ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '')
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#c#clangd#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('c_clangd_executable'),
|
||||
\ 'command_callback': 'ale_linters#c#clangd#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#c#clangd#GetProjectRoot',
|
||||
\})
|
||||
|
|
|
@ -16,38 +16,16 @@ call ale#Set('c_clangtidy_checks', ['*'])
|
|||
call ale#Set('c_clangtidy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangtidy#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_clangtidy_executable')
|
||||
endfunction
|
||||
|
||||
function! s:GetBuildDirectory(buffer) abort
|
||||
" Don't include build directory for header files, as compile_commands.json
|
||||
" files don't consider headers to be translation units, and provide no
|
||||
" commands for compiling header files.
|
||||
if expand('#' . a:buffer) =~# '\v\.(h|hpp)$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
" c_build_dir has the priority if defined
|
||||
if !empty(l:build_dir)
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
||||
let l:build_dir = s:GetBuildDirectory(a:buffer)
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
\ ? ale#Var(a:buffer, 'c_clangtidy_options')
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(ale_linters#c#clangtidy#GetExecutable(a:buffer))
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
|
@ -57,7 +35,7 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable_callback': 'ale_linters#c#clangtidy#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('c_clangtidy_executable'),
|
||||
\ 'command_callback': 'ale_linters#c#clangtidy#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
call ale#Set('c_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_cppcheck_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||
" Search upwards from the file for compile_commands.json.
|
||||
"
|
||||
|
@ -23,8 +19,7 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
|||
\ : ''
|
||||
|
||||
return l:cd_command
|
||||
\ . ale#Escape(ale_linters#c#cppcheck#GetExecutable(a:buffer))
|
||||
\ . ' -q --language=c '
|
||||
\ . '%e -q --language=c '
|
||||
\ . l:compile_commands_option
|
||||
\ . ale#Var(a:buffer, 'c_cppcheck_options')
|
||||
\ . ' %t'
|
||||
|
@ -33,7 +28,7 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable_callback': 'ale_linters#c#cppcheck#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('c_cppcheck_executable'),
|
||||
\ 'command_callback': 'ale_linters#c#cppcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
|
|
|
@ -6,18 +6,14 @@ call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
|
|||
|
||||
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
if empty(l:project_root)
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
endif
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_cquery_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#c#cquery#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
@ -25,8 +21,8 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#c#cquery#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#c#cquery#GetCommand',
|
||||
\ 'executable_callback': ale#VarFunc('c_cquery_executable'),
|
||||
\ 'command': '%e',
|
||||
\ 'project_root_callback': 'ale_linters#c#cquery#GetProjectRoot',
|
||||
\ 'initialization_options_callback': 'ale_linters#c#cquery#GetInitializationOptions',
|
||||
\})
|
||||
|
|
|
@ -6,18 +6,12 @@ call ale#Set('c_flawfinder_options', '')
|
|||
call ale#Set('c_flawfinder_minlevel', 1)
|
||||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#c#flawfinder#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_flawfinder_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#flawfinder#GetCommand(buffer) abort
|
||||
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel')
|
||||
|
||||
return ale#Escape(ale_linters#c#flawfinder#GetExecutable(a:buffer))
|
||||
\ . ' -CDQS'
|
||||
\ . ale#Var(a:buffer, 'c_flawfinder_options')
|
||||
return '%e -CDQS'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_flawfinder_options'))
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
@ -25,7 +19,7 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'flawfinder',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable_callback': 'ale_linters#c#flawfinder#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('c_flawfinder_executable'),
|
||||
\ 'command_callback': 'ale_linters#c#flawfinder#GetCommand',
|
||||
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||
\})
|
||||
|
|
|
@ -4,17 +4,12 @@
|
|||
call ale#Set('c_gcc_executable', 'gcc')
|
||||
call ale#Set('c_gcc_options', '-std=c11 -Wall')
|
||||
|
||||
function! ale_linters#c#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_gcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#gcc#GetCommand(buffer, output) abort
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c -fsyntax-only'
|
||||
return '%e -S -x c -fsyntax-only'
|
||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -'
|
||||
|
@ -23,7 +18,7 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#c#gcc#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('c_gcc_executable'),
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#c#gcc#GetCommand'}
|
||||
|
|
|
@ -6,17 +6,10 @@
|
|||
call ale#Set('chef_foodcritic_executable', 'foodcritic')
|
||||
call ale#Set('chef_foodcritic_options', '')
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'chef_foodcritic_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#chef#foodcritic#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'chef_foodcritic_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . escape(l:options, '~') : '')
|
||||
\ . ' %s'
|
||||
return '%e' . ale#Pad(escape(l:options, '~')) . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||
|
@ -41,7 +34,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('chef', {
|
||||
\ 'name': 'foodcritic',
|
||||
\ 'executable_callback': 'ale_linters#chef#foodcritic#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('chef_foodcritic_executable'),
|
||||
\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand',
|
||||
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -4,17 +4,12 @@
|
|||
call ale#Set('cpp_clang_executable', 'clang++')
|
||||
call ale#Set('cpp_clang_options', '-std=c++14 -Wall')
|
||||
|
||||
function! ale_linters#cpp#clang#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_clang_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#clang#GetCommand(buffer, output) abort
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c++ -fsyntax-only'
|
||||
return '%e -S -x c++ -fsyntax-only'
|
||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_clang_options')) . ' -'
|
||||
|
@ -23,7 +18,7 @@ endfunction
|
|||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clang',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#clang#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_clang_executable'),
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#cpp#clang#GetCommand'},
|
||||
|
|
|
@ -5,10 +5,6 @@ call ale#Set('cpp_clangcheck_executable', 'clang-check')
|
|||
call ale#Set('cpp_clangcheck_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangcheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_clangcheck_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options')
|
||||
|
||||
|
@ -22,17 +18,16 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
|||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated. These are only added if no build directory can be
|
||||
" detected.
|
||||
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
|
||||
\ . ' -analyze %s'
|
||||
return '%e -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
||||
\ . (!empty(l:user_options) ? ' ' . l:user_options : '')
|
||||
\ . ale#Pad(l:user_options)
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangcheck',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#clangcheck#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_clangcheck_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#clangcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
call ale#Set('cpp_clangd_executable', 'clangd')
|
||||
call ale#Set('cpp_clangd_options', '')
|
||||
|
||||
function! ale_linters#cpp#clangd#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_clangd_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#clangd#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#cpp#clangd#GetProjectRoot',
|
||||
\})
|
|
@ -10,38 +10,16 @@ call ale#Set('cpp_clangtidy_checks', ['*'])
|
|||
call ale#Set('cpp_clangtidy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_clangtidy_executable')
|
||||
endfunction
|
||||
|
||||
function! s:GetBuildDirectory(buffer) abort
|
||||
" Don't include build directory for header files, as compile_commands.json
|
||||
" files don't consider headers to be translation units, and provide no
|
||||
" commands for compiling header files.
|
||||
if expand('#' . a:buffer) =~# '\v\.(h|hpp)$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
" c_build_dir has the priority if defined
|
||||
if !empty(l:build_dir)
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
|
||||
let l:build_dir = s:GetBuildDirectory(a:buffer)
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
\ ? ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(ale_linters#cpp#clangtidy#GetExecutable(a:buffer))
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
|
@ -51,7 +29,7 @@ endfunction
|
|||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable_callback': 'ale_linters#cpp#clangtidy#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_clangtidy_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#clangtidy#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
" Description: clazy linter for cpp files (clang-based and Qt-oriented)
|
||||
|
||||
call ale#Set('cpp_clazy_executable', 'clazy-standalone')
|
||||
" Set this option to check the checks clazy will apply.
|
||||
call ale#Set('cpp_clazy_checks', ['level1'])
|
||||
" Set this option to manually set some options for clazy.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('cpp_clazy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clazy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clazy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = ale#Var(a:buffer, 'cpp_clazy_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clazy',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_clazy_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#clazy#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -4,10 +4,6 @@
|
|||
call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_cppcheck_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||
" Search upwards from the file for compile_commands.json.
|
||||
"
|
||||
|
@ -23,8 +19,7 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
|||
\ : ''
|
||||
|
||||
return l:cd_command
|
||||
\ . ale#Escape(ale_linters#cpp#cppcheck#GetExecutable(a:buffer))
|
||||
\ . ' -q --language=c++ '
|
||||
\ . '%e -q --language=c++ '
|
||||
\ . l:compile_commands_option
|
||||
\ . ale#Var(a:buffer, 'cpp_cppcheck_options')
|
||||
\ . ' %t'
|
||||
|
@ -33,7 +28,7 @@ endfunction
|
|||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable_callback': 'ale_linters#cpp#cppcheck#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_cppcheck_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#cppcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
|
|
|
@ -4,22 +4,16 @@
|
|||
call ale#Set('cpp_cpplint_executable', 'cpplint')
|
||||
call ale#Set('cpp_cpplint_options', '')
|
||||
|
||||
function! ale_linters#cpp#cpplint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_cpplint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cpplint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'cpp_cpplint_options')
|
||||
|
||||
return ale#Escape(ale_linters#cpp#cpplint#GetExecutable(a:buffer))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %s'
|
||||
return '%e' . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cpplint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#cpplint#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_cpplint_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#cpplint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -7,18 +7,13 @@ call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery'))
|
|||
function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
if empty(l:project_root)
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
endif
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cquery#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_cquery_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cquery#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#cpp#cquery#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'cpp_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
@ -26,8 +21,8 @@ endfunction
|
|||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#cpp#cquery#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#cpp#cquery#GetCommand',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_cquery_executable'),
|
||||
\ 'command': '%e',
|
||||
\ 'project_root_callback': 'ale_linters#cpp#cquery#GetProjectRoot',
|
||||
\ 'initialization_options_callback': 'ale_linters#cpp#cquery#GetInitializationOptions',
|
||||
\})
|
||||
|
|
|
@ -6,17 +6,11 @@ call ale#Set('cpp_flawfinder_options', '')
|
|||
call ale#Set('cpp_flawfinder_minlevel', 1)
|
||||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#cpp#flawfinder#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_flawfinder_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort
|
||||
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel')
|
||||
|
||||
return ale#Escape(ale_linters#cpp#flawfinder#GetExecutable(a:buffer))
|
||||
\ . ' -CDQS'
|
||||
return '%e -CDQS'
|
||||
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
|
@ -25,7 +19,7 @@ endfunction
|
|||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'flawfinder',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable_callback': 'ale_linters#cpp#flawfinder#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_flawfinder_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#flawfinder#GetCommand',
|
||||
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||
\})
|
||||
|
|
|
@ -4,17 +4,12 @@
|
|||
call ale#Set('cpp_gcc_executable', 'gcc')
|
||||
call ale#Set('cpp_gcc_options', '-std=c++14 -Wall')
|
||||
|
||||
function! ale_linters#cpp#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_gcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#cpp#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c++ -fsyntax-only'
|
||||
return '%e -S -x c++ -fsyntax-only'
|
||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -'
|
||||
|
@ -24,7 +19,7 @@ call ale#linter#Define('cpp', {
|
|||
\ 'name': 'gcc',
|
||||
\ 'aliases': ['g++'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#gcc#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_gcc_executable'),
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#cpp#gcc#GetCommand'},
|
||||
|
|
|
@ -4,21 +4,16 @@ call ale#Set('css_stylelint_executable', 'stylelint')
|
|||
call ale#Set('css_stylelint_options', '')
|
||||
call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#css#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'css_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
||||
return ale_linters#css#stylelint#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'css_stylelint_options')
|
||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable_callback': 'ale_linters#css#stylelint#GetExecutable',
|
||||
\ 'executable_callback': ale#node#FindExecutableFunc('css_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ]),
|
||||
\ 'command_callback': 'ale_linters#css#stylelint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
||||
|
|
|
@ -4,20 +4,15 @@
|
|||
call ale#Set('cuda_nvcc_executable', 'nvcc')
|
||||
call ale#Set('cuda_nvcc_options', '-std=c++11')
|
||||
|
||||
function! ale_linters#cuda#nvcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cuda_nvcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
||||
" Unused: use ale#util#nul_file
|
||||
" let l:output_file = ale#util#Tempname() . '.ii'
|
||||
" call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return ale#Escape(ale_linters#cuda#nvcc#GetExecutable(a:buffer))
|
||||
\ . ' -cuda '
|
||||
\ . ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
|
||||
\ . ale#Var(a:buffer, 'cuda_nvcc_options') . ' %s'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
return '%e -cuda'
|
||||
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
|
||||
\ . ' %s -o ' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
||||
|
@ -49,7 +44,7 @@ endfunction
|
|||
call ale#linter#Define('cuda', {
|
||||
\ 'name': 'nvcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cuda#nvcc#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('cuda_nvcc_executable'),
|
||||
\ 'command_callback': 'ale_linters#cuda#nvcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -3,15 +3,10 @@
|
|||
|
||||
call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer')
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'dart_dartanalyzer_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#dart#dartanalyzer#GetExecutable(a:buffer)
|
||||
let l:path = ale#path#FindNearestFile(a:buffer, '.packages')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
return '%e'
|
||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
@ -34,7 +29,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dartanalyzer',
|
||||
\ 'executable_callback': 'ale_linters#dart#dartanalyzer#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('dart_dartanalyzer_executable'),
|
||||
\ 'command_callback': 'ale_linters#dart#dartanalyzer#GetCommand',
|
||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
|
||||
call ale#Set('dart_language_server_executable', 'dart_language_server')
|
||||
|
||||
function! ale_linters#dart#language_server#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'dart_language_server_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort
|
||||
" Note: pub only looks for pubspec.yaml, there's no point in adding
|
||||
" support for pubspec.yml
|
||||
|
@ -18,7 +14,7 @@ endfunction
|
|||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'language_server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('dart_language_server_executable'),
|
||||
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
||||
\})
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
call ale#Set('elm_make_executable', 'elm')
|
||||
call ale#Set('elm_make_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_make', [
|
||||
\ 'node_modules/.bin/elm',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:unparsed_lines = []
|
||||
|
@ -147,7 +141,6 @@ endfunction
|
|||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||
let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer)
|
||||
|
||||
if empty(l:elm_json)
|
||||
" Fallback to Elm 0.18
|
||||
|
@ -165,18 +158,15 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
|
|||
" a sort of flag to tell the compiler not to generate an output file,
|
||||
" which is why this is hard coded here.
|
||||
" Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
|
||||
let l:elm_cmd = ale#Escape(l:elm_exe)
|
||||
\ . ' make'
|
||||
\ . ' --report=json'
|
||||
\ . ' --output=/dev/null'
|
||||
|
||||
return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t'
|
||||
return l:dir_set_cmd . '%e make --report=json --output=/dev/null %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'make',
|
||||
\ 'executable_callback': 'ale_linters#elm#make#GetExecutable',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
\ 'name': 'make',
|
||||
\ 'executable_callback': ale#node#FindExecutableFunc('elm_make', [
|
||||
\ 'node_modules/.bin/elm',
|
||||
\ ]),
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
\})
|
||||
|
|
|
@ -3,24 +3,12 @@
|
|||
|
||||
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
|
||||
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_syntaxerl_executable')
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#FeatureCheck(buffer) abort
|
||||
return s:GetEscapedExecutable(a:buffer) . ' -h'
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output) abort
|
||||
let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
|
||||
|
||||
return s:GetEscapedExecutable(a:buffer) . (l:use_b_option ? ' -b %s %t' : ' %t')
|
||||
return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t')
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v\C:(\d+):( warning:)? (.+)'
|
||||
let l:loclist = []
|
||||
|
@ -36,17 +24,11 @@ function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
|||
return l:loclist
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:GetEscapedExecutable(buffer) abort
|
||||
return ale#Escape(ale_linters#erlang#syntaxerl#GetExecutable(a:buffer))
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'syntaxerl',
|
||||
\ 'executable_callback': 'ale_linters#erlang#syntaxerl#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('erlang_syntaxerl_executable'),
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#erlang#syntaxerl#FeatureCheck'},
|
||||
\ {'callback': {-> '%e -h'}},
|
||||
\ {'callback': 'ale_linters#erlang#syntaxerl#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
|
||||
|
|
|
@ -2,18 +2,10 @@
|
|||
" Description: gcc for Fortran files
|
||||
|
||||
" This option can be set to 0 to use -ffixed-form
|
||||
if !exists('g:ale_fortran_gcc_use_free_form')
|
||||
let g:ale_fortran_gcc_use_free_form = 1
|
||||
endif
|
||||
|
||||
if !exists('g:ale_fortran_gcc_executable')
|
||||
let g:ale_fortran_gcc_executable = 'gcc'
|
||||
endif
|
||||
|
||||
call ale#Set('fortran_gcc_use_free_form', 1)
|
||||
call ale#Set('fortran_gcc_executable', 'gcc')
|
||||
" Set this option to change the GCC options for warnings for Fortran.
|
||||
if !exists('g:ale_fortran_gcc_options')
|
||||
let g:ale_fortran_gcc_options = '-Wall'
|
||||
endif
|
||||
call ale#Set('fortran_gcc_options', '-Wall')
|
||||
|
||||
function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
||||
" We have to match a starting line and a later ending line together,
|
||||
|
@ -61,26 +53,20 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
|||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#fortran#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'fortran_gcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#fortran#gcc#GetCommand(buffer) abort
|
||||
let l:layout_option = ale#Var(a:buffer, 'fortran_gcc_use_free_form')
|
||||
\ ? '-ffree-form'
|
||||
\ : '-ffixed-form'
|
||||
|
||||
return ale_linters#fortran#gcc#GetExecutable(a:buffer)
|
||||
\ . ' -S -x f95 -fsyntax-only '
|
||||
\ . l:layout_option . ' '
|
||||
\ . ale#Var(a:buffer, 'fortran_gcc_options') . ' '
|
||||
\ . '-'
|
||||
return '%e -S -x f95 -fsyntax-only ' . l:layout_option
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'fortran_gcc_options'))
|
||||
\ . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('fortran', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#fortran#gcc#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('fortran_gcc_executable'),
|
||||
\ 'command_callback': 'ale_linters#fortran#gcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#fortran#gcc#Handle',
|
||||
\})
|
||||
|
|
|
@ -4,14 +4,6 @@
|
|||
call ale#Set('fortran_language_server_executable', 'fortls')
|
||||
call ale#Set('fortran_language_server_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#fortran#language_server#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'fortran_language_server_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#fortran#language_server#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#fortran#language_server#GetExecutable(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#fortran#language_server#GetProjectRoot(buffer) abort
|
||||
let l:fortls_file = ale#path#FindNearestFile(a:buffer, '.fortls')
|
||||
|
||||
|
@ -21,7 +13,7 @@ endfunction
|
|||
call ale#linter#Define('fortran', {
|
||||
\ 'name': 'language_server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#fortran#language_server#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#fortran#language_server#GetCommand',
|
||||
\ 'executable_callback': ale#VarFunc('fortran_language_server_executable'),
|
||||
\ 'command': '%e',
|
||||
\ 'project_root_callback': 'ale_linters#fortran#language_server#GetProjectRoot',
|
||||
\})
|
||||
|
|
|
@ -4,13 +4,8 @@
|
|||
call ale#Set('fuse_fusionlint_executable', 'fusion-lint')
|
||||
call ale#Set('fuse_fusionlint_options', '')
|
||||
|
||||
function! ale_linters#fuse#fusionlint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'fuse_fusionlint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#fuse#fusionlint#GetExecutable(a:buffer))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options'))
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options'))
|
||||
\ . ' --filename %s -i'
|
||||
endfunction
|
||||
|
||||
|
@ -32,7 +27,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('fuse', {
|
||||
\ 'name': 'fusionlint',
|
||||
\ 'executable_callback': 'ale_linters#fuse#fusionlint#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('fuse_fusionlint_executable'),
|
||||
\ 'command_callback': 'ale_linters#fuse#fusionlint#GetCommand',
|
||||
\ 'callback': 'ale_linters#fuse#fusionlint#Handle',
|
||||
\})
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
" Author: Nick Yamane <nick.diego@gmail.com>
|
||||
" Description: gitlint for git commit message files
|
||||
|
||||
let g:ale_gitcommit_gitlint_executable =
|
||||
\ get(g:, 'ale_gitcommit_gitlint_executable', 'gitlint')
|
||||
let g:ale_gitcommit_gitlint_options = get(g:, 'ale_gitcommit_gitlint_options', '')
|
||||
let g:ale_gitcommit_gitlint_use_global = get(g:, 'ale_gitcommit_gitlint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
call ale#Set('gitcommit_gitlint_executable', 'gitlint')
|
||||
call ale#Set('gitcommit_gitlint_options', '')
|
||||
call ale#Set('gitcommit_gitlint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#gitcommit#gitlint#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'gitcommit_gitlint', ['gitlint'])
|
||||
|
@ -13,12 +11,9 @@ endfunction
|
|||
|
||||
function! ale_linters#gitcommit#gitlint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'gitcommit_gitlint_options')
|
||||
let l:executable = ale_linters#gitcommit#gitlint#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' lint'
|
||||
endfunction
|
||||
|
||||
return '%e' . ale#Pad(l:options) . ' lint'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
|
@ -45,7 +40,6 @@ function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
|
|||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('gitcommit', {
|
||||
\ 'name': 'gitlint',
|
||||
\ 'output_stream': 'stderr',
|
||||
|
@ -53,4 +47,3 @@ call ale#linter#Define('gitcommit', {
|
|||
\ 'command_callback': 'ale_linters#gitcommit#gitlint#GetCommand',
|
||||
\ 'callback': 'ale_linters#gitcommit#gitlint#Handle',
|
||||
\})
|
||||
|
||||
|
|
|
@ -4,17 +4,11 @@
|
|||
" TODO: Once https://github.com/KhronosGroup/glslang/pull/1047 is accepted,
|
||||
" we can use stdin.
|
||||
|
||||
let g:ale_glsl_glslang_executable =
|
||||
\ get(g:, 'ale_glsl_glslang_executable', 'glslangValidator')
|
||||
|
||||
let g:ale_glsl_glslang_options = get(g:, 'ale_glsl_glslang_options', '')
|
||||
|
||||
function! ale_linters#glsl#glslang#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'glsl_glslang_executable')
|
||||
endfunction
|
||||
call ale#Set('glsl_glslang_executable', 'glslangValidator')
|
||||
call ale#Set('glsl_glslang_options', '')
|
||||
|
||||
function! ale_linters#glsl#glslang#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#glsl#glslang#GetExecutable(a:buffer))
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'glsl_glslang_options'))
|
||||
\ . ' -C %t'
|
||||
endfunction
|
||||
|
@ -40,7 +34,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('glsl', {
|
||||
\ 'name': 'glslang',
|
||||
\ 'executable_callback': 'ale_linters#glsl#glslang#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('glsl_glslang_executable'),
|
||||
\ 'command_callback': 'ale_linters#glsl#glslang#GetCommand',
|
||||
\ 'callback': 'ale_linters#glsl#glslang#Handle',
|
||||
\})
|
||||
|
|
|
@ -4,18 +4,15 @@
|
|||
call ale#Set('glsl_glslls_executable', 'glslls')
|
||||
call ale#Set('glsl_glslls_logfile', '')
|
||||
|
||||
function! ale_linters#glsl#glslls#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'glsl_glslls_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#glsl#glslls#GetExecutable(a:buffer)
|
||||
let l:logfile = ale#Var(a:buffer, 'glsl_glslls_logfile')
|
||||
let l:logfile_args = ''
|
||||
|
||||
if l:logfile isnot# ''
|
||||
let l:logfile_args = ' --verbose -l ' . l:logfile
|
||||
endif
|
||||
return ale#Escape(l:executable) . l:logfile_args . ' --stdin'
|
||||
|
||||
return '%e' . l:logfile_args . ' --stdin'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort
|
||||
|
@ -27,7 +24,7 @@ endfunction
|
|||
call ale#linter#Define('glsl', {
|
||||
\ 'name': 'glslls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#glsl#glslls#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('glsl_glslls_executable'),
|
||||
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
|
||||
\})
|
||||
|
|
|
@ -5,35 +5,11 @@
|
|||
|
||||
call ale#Set('go_gobuild_options', '')
|
||||
|
||||
function! ale_linters#go#gobuild#ResetEnv() abort
|
||||
unlet! s:go_env
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GoEnv(buffer) abort
|
||||
if exists('s:go_env')
|
||||
return ''
|
||||
endif
|
||||
|
||||
return 'go env GOPATH GOROOT'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
|
||||
function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
||||
|
||||
if !exists('s:go_env')
|
||||
let s:go_env = {
|
||||
\ 'GOPATH': a:goenv_output[0],
|
||||
\ 'GOROOT': a:goenv_output[1],
|
||||
\}
|
||||
endif
|
||||
|
||||
let l:gopath_env_command = has('win32')
|
||||
\ ? 'set GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' && '
|
||||
\ : 'GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' '
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return l:gopath_env_command
|
||||
\ . ale#path#BufferCdString(a:buffer)
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'go test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
|
@ -73,10 +49,8 @@ call ale#linter#Define('go', {
|
|||
\ 'name': 'gobuild',
|
||||
\ 'aliases': ['go build'],
|
||||
\ 'executable': 'go',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#go#gobuild#GoEnv', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#go#gobuild#GetCommand', 'output_stream': 'stderr'},
|
||||
\ ],
|
||||
\ 'command_callback': 'ale_linters#go#gobuild#GetCommand',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
|
|
@ -5,12 +5,7 @@ call ale#Set('go_gometalinter_options', '')
|
|||
call ale#Set('go_gometalinter_executable', 'gometalinter')
|
||||
call ale#Set('go_gometalinter_lint_package', 0)
|
||||
|
||||
function! ale_linters#go#gometalinter#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'go_gometalinter_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#go#gometalinter#GetExecutable(a:buffer)
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
let l:options = ale#Var(a:buffer, 'go_gometalinter_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_gometalinter_lint_package')
|
||||
|
@ -19,12 +14,12 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
|||
" be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . '%e'
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endfunction
|
||||
|
@ -55,7 +50,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gometalinter',
|
||||
\ 'executable_callback': 'ale_linters#go#gometalinter#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('go_gometalinter_executable'),
|
||||
\ 'command_callback': 'ale_linters#go#gometalinter#GetCommand',
|
||||
\ 'callback': 'ale_linters#go#gometalinter#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -4,8 +4,12 @@
|
|||
" Author: John Eikenberry <jae@zhar.net>
|
||||
" Description: updated to work with go1.10
|
||||
|
||||
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#path#BufferCdString(a:buffer) . ' go vet .'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
" Author: Fred Emmott <fe@fb.com>
|
||||
" Description: Hack support via `hack lsp`
|
||||
|
||||
call ale#Set('hack_hack_executable', 'hh_client')
|
||||
|
||||
function! ale_linters#hack#hack#GetProjectRoot(buffer) abort
|
||||
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
|
||||
|
||||
return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#hack#hack#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'hack_hack_executable')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('hack', {
|
||||
\ 'name': 'hack',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#hack#hack#GetExecutable',
|
||||
\ 'command': '%e lsp --from vim-ale',
|
||||
\ 'project_root_callback': 'ale_linters#hack#hack#GetProjectRoot',
|
||||
\})
|