Updated plugins
This commit is contained in:
parent
8e54cbc92e
commit
a7a471a207
|
@ -0,0 +1,26 @@
|
|||
" Author: Bartek Jasicki http://github.com/thindil
|
||||
" Description: Support for Ada Language Server
|
||||
|
||||
call ale#Set('ada_adals_executable', 'ada_language_server')
|
||||
call ale#Set('ada_adals_project', 'default.gpr')
|
||||
call ale#Set('ada_adals_encoding', 'utf-8')
|
||||
|
||||
function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort
|
||||
return {
|
||||
\ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'),
|
||||
\ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding')
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ada#adals#GetRootDirectory(buffer) abort
|
||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ada', {
|
||||
\ 'name': 'adals',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'),
|
||||
\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig')
|
||||
\})
|
|
@ -1,4 +1,4 @@
|
|||
" Author: Bjorn Neergaard <bjorn@neersighted.com>
|
||||
" Authors: Bjorn Neergaard <bjorn@neersighted.com>, Vytautas Macionis <vytautas.macionis@manomail.de>
|
||||
" Description: ansible-lint for ansible-yaml files
|
||||
|
||||
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
|
||||
|
@ -7,7 +7,7 @@ function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
|
|||
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
||||
function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
for l:line in a:lines[:10]
|
||||
if match(l:line, '^Traceback') >= 0
|
||||
return [{
|
||||
|
@ -18,39 +18,86 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
|||
endif
|
||||
endfor
|
||||
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" test.yml:35: [EANSIBLE0002] Trailing whitespace
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
|
||||
let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[4]
|
||||
if '>=5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
|
||||
" roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest
|
||||
" D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest
|
||||
let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$'
|
||||
let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' }
|
||||
|
||||
if l:code is# 'EANSIBLE0002'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[6],
|
||||
\ 'code': l:match[4],
|
||||
\ 'type': l:error_codes[l:match[5]],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
if '<5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:35: [EANSIBLE0002] Trailing whitespace
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[4]
|
||||
|
||||
if l:code is# 'EANSIBLE0002'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
|
||||
let l:commands = {
|
||||
\ '>=5.0.0': '%e --parseable-severity -x yaml',
|
||||
\ '<5.0.0': '%e -p %t'
|
||||
\}
|
||||
let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0']
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'ansible_lint',
|
||||
\ 'aliases': ['ansible', 'ansible-lint'],
|
||||
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
|
||||
\ 'command': '%e -p %t',
|
||||
\ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ {buffer, version -> ale_linters#ansible#ansible_lint#Handle(
|
||||
\ buffer,
|
||||
\ l:version,
|
||||
\ lines)},
|
||||
\ )},
|
||||
\})
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
" Author: Leo <thinkabit.ukim@gmail.com>
|
||||
" Description: apkbuild-lint from atools linter for APKBUILDs
|
||||
|
||||
call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint')
|
||||
|
||||
call ale#linter#Define('apkbuild', {
|
||||
\ 'name': 'apkbuild_lint',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')},
|
||||
\ 'command': '%e %t',
|
||||
\ 'callback': 'ale#handlers#atools#Handle',
|
||||
\})
|
|
@ -0,0 +1,12 @@
|
|||
" Author: Leo <thinkabit.ukim@gmail.com>
|
||||
" Description: secfixes-check from atools linter for APKBUILDs
|
||||
|
||||
call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check')
|
||||
|
||||
call ale#linter#Define('apkbuild', {
|
||||
\ 'name': 'secfixes_check',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')},
|
||||
\ 'command': '%e %t',
|
||||
\ 'callback': 'ale#handlers#atools#Handle',
|
||||
\})
|
|
@ -5,15 +5,13 @@ call ale#Set('c_cppcheck_executable', 'cppcheck')
|
|||
call ale#Set('c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
let l:template = ' --template=''{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}'''
|
||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
|
||||
return l:cd_command
|
||||
\ . '%e -q --language=c'
|
||||
return '%e -q --language=c'
|
||||
\ . l:template
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
|
||||
|
@ -25,6 +23,7 @@ call ale#linter#Define('c', {
|
|||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')},
|
||||
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
|
||||
\ 'command': function('ale_linters#c#cppcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
|
|
|
@ -29,6 +29,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('cloudformation', {
|
||||
\ 'name': 'cloudformation',
|
||||
\ 'aliases': ['cfn-lint'],
|
||||
\ 'executable': 'cfn-lint',
|
||||
\ 'command': 'cfn-lint --template %t --format parseable',
|
||||
\ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle',
|
||||
|
|
|
@ -23,11 +23,13 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
|
|||
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
||||
endif
|
||||
|
||||
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file.
|
||||
if expand('#' . a:buffer) =~# '\.h$'
|
||||
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
|
||||
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file
|
||||
" only when compile-commands.json file is not there. Adding these
|
||||
" flags makes clang-tidy completely ignore compile commmands.
|
||||
if expand('#' . a:buffer) =~# '\.h$'
|
||||
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
|
||||
endif
|
||||
endif
|
||||
|
||||
" Get the options to pass directly to clang-tidy
|
||||
|
|
|
@ -5,15 +5,13 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
|||
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
let l:template = ' --template=''{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}'''
|
||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
|
||||
return l:cd_command
|
||||
\ . '%e -q --language=c++'
|
||||
return '%e -q --language=c++'
|
||||
\ . l:template
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
|
||||
|
@ -25,6 +23,7 @@ call ale#linter#Define('cpp', {
|
|||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')},
|
||||
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
|
||||
\ 'command': function('ale_linters#cpp#cppcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
|
|
|
@ -3,14 +3,10 @@ call ale#Set('cs_csc_source', '')
|
|||
call ale#Set('cs_csc_assembly_path', [])
|
||||
call ale#Set('cs_csc_assemblies', [])
|
||||
|
||||
function! s:GetWorkingDirectory(buffer) abort
|
||||
let l:working_directory = ale#Var(a:buffer, 'cs_csc_source')
|
||||
function! ale_linters#cs#csc#GetCwd(buffer) abort
|
||||
let l:cwd = ale#Var(a:buffer, 'cs_csc_source')
|
||||
|
||||
if !empty(l:working_directory)
|
||||
return l:working_directory
|
||||
endif
|
||||
|
||||
return expand('#' . a:buffer . ':p:h')
|
||||
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#csc#GetCommand(buffer) abort
|
||||
|
@ -34,8 +30,7 @@ function! ale_linters#cs#csc#GetCommand(buffer) abort
|
|||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||
\ . 'csc /unsafe'
|
||||
return 'csc /unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
|
@ -57,8 +52,7 @@ function! ale_linters#cs#csc#Handle(buffer, lines) abort
|
|||
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
let l:dir = ale_linters#cs#csc#GetCwd(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
|
@ -89,6 +83,7 @@ call ale#linter#Define('cs',{
|
|||
\ 'name': 'csc',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'csc',
|
||||
\ 'cwd': function('ale_linters#cs#csc#GetCwd'),
|
||||
\ 'command': function('ale_linters#cs#csc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#csc#Handle',
|
||||
\ 'lint_file': 1
|
||||
|
|
|
@ -3,14 +3,10 @@ call ale#Set('cs_mcsc_source', '')
|
|||
call ale#Set('cs_mcsc_assembly_path', [])
|
||||
call ale#Set('cs_mcsc_assemblies', [])
|
||||
|
||||
function! s:GetWorkingDirectory(buffer) abort
|
||||
let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
function! ale_linters#cs#mcsc#GetCwd(buffer) abort
|
||||
let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
|
||||
if !empty(l:working_directory)
|
||||
return l:working_directory
|
||||
endif
|
||||
|
||||
return expand('#' . a:buffer . ':p:h')
|
||||
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||
|
@ -34,8 +30,7 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
|||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||
\ . 'mcs -unsafe'
|
||||
return 'mcs -unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
|
@ -58,7 +53,7 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
|||
\]
|
||||
let l:output = []
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
|
@ -89,6 +84,7 @@ call ale#linter#Define('cs',{
|
|||
\ 'name': 'mcsc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'cwd': function('ale_linters#cs#mcsc#GetCwd'),
|
||||
\ 'command': function('ale_linters#cs#mcsc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#mcsc#Handle',
|
||||
\ 'lint_file': 1
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
" Author: Tommy Chiang <ty1208chiang@gmail.com>
|
||||
" Description: Clangd language server for CUDA (modified from Andrey
|
||||
" Melentyev's implementation for C++)
|
||||
|
||||
call ale#Set('cuda_clangd_executable', 'clangd')
|
||||
call ale#Set('cuda_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cuda#clangd#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cuda', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')},
|
||||
\ 'command': function('ale_linters#cuda#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
|
@ -1,64 +1,106 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: "dmd for D files"
|
||||
|
||||
function! ale_linters#d#dmd#GetDUBCommand(buffer) abort
|
||||
function! s:GetDUBCommand(buffer) abort
|
||||
" If we can't run dub, then skip this command.
|
||||
if !executable('dub')
|
||||
if executable('dub')
|
||||
" Returning an empty string skips to the DMD command.
|
||||
return ''
|
||||
let l:config = ale#d#FindDUBConfig(a:buffer)
|
||||
|
||||
" To support older dub versions, we just change the directory to the
|
||||
" directory where we found the dub config, and then run `dub describe`
|
||||
" from that directory.
|
||||
if !empty(l:config)
|
||||
return [fnamemodify(l:config, ':h'), 'dub describe --data-list
|
||||
\ --data=import-paths
|
||||
\ --data=string-import-paths
|
||||
\ --data=versions
|
||||
\ --data=debug-versions
|
||||
\']
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:dub_file = ale#d#FindDUBConfig(a:buffer)
|
||||
|
||||
if empty(l:dub_file)
|
||||
return ''
|
||||
endif
|
||||
|
||||
" To support older dub versions, we just change the directory to
|
||||
" the directory where we found the dub config, and then run `dub describe`
|
||||
" from that directory.
|
||||
return 'cd ' . ale#Escape(fnamemodify(l:dub_file, ':h'))
|
||||
\ . ' && dub describe --import-paths'
|
||||
return ['', '']
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#RunDUBCommand(buffer) abort
|
||||
let l:command = ale_linters#d#dmd#GetDUBCommand(a:buffer)
|
||||
let [l:cwd, l:command] = s:GetDUBCommand(a:buffer)
|
||||
|
||||
if empty(l:command)
|
||||
" If we can't run DUB, just run DMD.
|
||||
return ale_linters#d#dmd#DMDCommand(a:buffer, [], {})
|
||||
endif
|
||||
|
||||
return ale#command#Run(a:buffer, l:command, function('ale_linters#d#dmd#DMDCommand'))
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ l:command,
|
||||
\ function('ale_linters#d#dmd#DMDCommand'),
|
||||
\ {'cwd': l:cwd},
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort
|
||||
let l:import_list = []
|
||||
let l:str_import_list = []
|
||||
let l:versions_list = []
|
||||
let l:deb_versions_list = []
|
||||
let l:list_ind = 1
|
||||
let l:seen_line = 0
|
||||
|
||||
" Build a list of import paths generated from DUB, if available.
|
||||
" Build a list of options generated from DUB, if available.
|
||||
" DUB output each path or version on a single line.
|
||||
" Each list is separated by a blank line.
|
||||
" Empty list are represented by a blank line (followed and/or
|
||||
" preceded by a separation blank line)
|
||||
for l:line in a:dub_output
|
||||
" line still has end of line char on windows
|
||||
let l:line = substitute(l:line, '[\r\n]*$', '', '')
|
||||
|
||||
if !empty(l:line)
|
||||
" The arguments must be '-Ifilename', not '-I filename'
|
||||
call add(l:import_list, '-I' . ale#Escape(l:line))
|
||||
if l:list_ind == 1
|
||||
call add(l:import_list, '-I' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 2
|
||||
call add(l:str_import_list, '-J' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 3
|
||||
call add(l:versions_list, '-version=' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 4
|
||||
call add(l:deb_versions_list, '-debug=' . ale#Escape(l:line))
|
||||
endif
|
||||
|
||||
let l:seen_line = 1
|
||||
elseif !l:seen_line
|
||||
" if list is empty must skip one empty line
|
||||
let l:seen_line = 1
|
||||
else
|
||||
let l:seen_line = 0
|
||||
let l:list_ind += 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t'
|
||||
return 'dmd ' . join(l:import_list) . ' ' .
|
||||
\ join(l:str_import_list) . ' ' .
|
||||
\ join(l:versions_list) . ' ' .
|
||||
\ join(l:deb_versions_list) . ' -o- -wi -vcolumns -c %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
||||
" Matches patterns lines like the following:
|
||||
" /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this')
|
||||
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
||||
let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)'
|
||||
let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$'
|
||||
let l:output = []
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
" If dmd was invoked with relative path, match[1] is relative, otherwise it is absolute.
|
||||
" As we invoke dmd with the buffer path (in /tmp), this will generally be absolute already
|
||||
let l:fname = ale#path#GetAbsPath(l:dir, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1],
|
||||
\ 'col': l:match[2],
|
||||
\ 'type': l:match[3] is# 'Warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[4],
|
||||
\ 'filename': l:fname,
|
||||
\ 'lnum': l:match[2],
|
||||
\ 'col': l:match[4],
|
||||
\ 'type': l:match[5] is# 'Warning' || l:match[5] is# 'Deprecation' ? 'W' : 'E',
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
|||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'filename': l:match[1],
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[5],
|
||||
|
@ -14,13 +14,28 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
|||
\ })
|
||||
endfor
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, '\v(.*)\((\d+),(\d+)\): (Verification of .{-} timed out after \d+ seconds)')
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[1],
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': 'E',
|
||||
\ })
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dafny#dafny#GetCommand(buffer) abort
|
||||
return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit'))
|
||||
endfunction
|
||||
|
||||
call ale#Set('dafny_dafny_timelimit', 10)
|
||||
call ale#linter#Define('dafny', {
|
||||
\ 'name': 'dafny',
|
||||
\ 'executable': 'dafny',
|
||||
\ 'command': 'dafny %s /compile:0',
|
||||
\ 'command': function('ale_linters#dafny#dafny#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dafny#dafny#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\ })
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
" Author: Nelson Yeung <nelsyeung@gmail.com>
|
||||
" Description: Check Dart files with dart analysis server LSP
|
||||
|
||||
call ale#Set('dart_analysis_server_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
|
||||
" Note: pub only looks for pubspec.yaml, there's no point in adding
|
||||
" support for pubspec.yml
|
||||
let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml')
|
||||
|
||||
return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : '.'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#analysis_server#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable')
|
||||
let l:dart = resolve(exepath(l:executable))
|
||||
|
||||
return '%e '
|
||||
\ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot'
|
||||
\ . ' --lsp'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'analysis_server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_analysis_server_executable')},
|
||||
\ 'command': function('ale_linters#dart#analysis_server#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#dart#analysis_server#GetProjectRoot'),
|
||||
\})
|
|
@ -0,0 +1,31 @@
|
|||
call ale#Set('desktop_desktop_file_validate_options', '')
|
||||
|
||||
" Example matches for pattern:
|
||||
"
|
||||
" foo.desktop: warning: key "TerminalOptions" in group ...
|
||||
" foo.desktop: error: action "new-private-window" is defined, ...
|
||||
let s:pattern = '\v^(.+): ([a-z]+): (.+)$'
|
||||
|
||||
function! ale_linters#desktop#desktop_file_validate#Handle(buffer, lines) abort
|
||||
" The error format doesn't specify lines, so we can just put all of the
|
||||
" errors on line 1.
|
||||
return ale#util#MapMatches(a:lines, s:pattern, {match -> {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'type': match[2] is? 'error' ? 'E' : 'W',
|
||||
\ 'text': match[3],
|
||||
\}})
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('desktop', {
|
||||
\ 'name': 'desktop_file_validate',
|
||||
\ 'aliases': ['desktop-file-validate'],
|
||||
\ 'executable': 'desktop-file-validate',
|
||||
\ 'command': {b ->
|
||||
\ '%e'
|
||||
\ . ale#Pad(ale#Var(b, 'desktop_desktop_file_validate_options'))
|
||||
\ . ' %t'
|
||||
\ },
|
||||
\ 'callback': 'ale_linters#desktop#desktop_file_validate#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\})
|
|
@ -9,7 +9,7 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
|||
"
|
||||
" /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
|
||||
" /dev/stdin:19:3 unexpected thing
|
||||
let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$'
|
||||
let l:pattern = '\v^%(/dev/stdin|-):(\d+):?(\d+)? ((DL|SC)(\d+) )?((.+)?: )?(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
@ -24,9 +24,19 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
|||
let l:colnum = l:match[2] + 0
|
||||
endif
|
||||
|
||||
let l:type = 'W'
|
||||
let l:text = l:match[6]
|
||||
let l:detail = l:match[6]
|
||||
" Shellcheck knows a 'style' severity - pin it to info level as well.
|
||||
if l:match[7] is# 'style'
|
||||
let l:type = 'I'
|
||||
elseif l:match[7] is# 'info'
|
||||
let l:type = 'I'
|
||||
elseif l:match[7] is# 'warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'E'
|
||||
endif
|
||||
|
||||
let l:text = l:match[8]
|
||||
let l:detail = l:match[8]
|
||||
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
|
||||
|
||||
if l:match[4] is# 'SC'
|
||||
|
@ -82,12 +92,15 @@ endfunction
|
|||
|
||||
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
||||
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
||||
let l:opts = '--no-color -'
|
||||
|
||||
if l:command is# 'docker'
|
||||
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
|
||||
return printf('docker run --rm -i %s hadolint %s',
|
||||
\ ale#Var(a:buffer, 'dockerfile_hadolint_docker_image'),
|
||||
\ l:opts)
|
||||
endif
|
||||
|
||||
return 'hadolint -'
|
||||
return 'hadolint ' . l:opts
|
||||
endfunction
|
||||
|
||||
|
||||
|
|
|
@ -45,19 +45,27 @@ function! ale_linters#elixir#credo#GetMode() abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
|
||||
let l:mode = ale_linters#elixir#credo#GetMode()
|
||||
function! ale_linters#elixir#credo#GetConfigFile() abort
|
||||
let l:config_file = get(g:, 'ale_elixir_credo_config_file', '')
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . 'mix help credo && '
|
||||
if empty(l:config_file)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ' --config-file ' . l:config_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
||||
return 'mix help credo && '
|
||||
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
|
||||
\ . ale_linters#elixir#credo#GetConfigFile()
|
||||
\ . ' --format=flycheck --read-from-stdin %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'credo',
|
||||
\ 'executable': 'mix',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||
\ 'command': function('ale_linters#elixir#credo#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||
\})
|
||||
|
|
|
@ -25,17 +25,10 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
|||
return l:output
|
||||
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', {
|
||||
\ 'name': 'dialyxir',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': function('ale_linters#elixir#dialyxir#GetCommand'),
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': 'mix help dialyzer && mix dialyzer',
|
||||
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||
\})
|
||||
|
||||
|
|
|
@ -29,17 +29,11 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
|
|||
return l:output
|
||||
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', {
|
||||
\ 'name': 'dogma',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': function('ale_linters#elixir#dogma#GetCommand'),
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||
\})
|
||||
|
|
|
@ -30,22 +30,15 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
let l:temp_dir = ale#command#CreateDirectory(a:buffer)
|
||||
|
||||
let l:mix_build_path = has('win32')
|
||||
\ ? 'set MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) . ' &&'
|
||||
\ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir)
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . l:mix_build_path
|
||||
\ . ' mix compile %s'
|
||||
return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'mix',
|
||||
\ 'executable': 'mix',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': function('ale_linters#elixir#mix#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elixir#mix#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -186,20 +186,19 @@ function! ale_linters#elm#make#IsTest(buffer) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetCwd(buffer) abort
|
||||
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||
|
||||
return !empty(l:root_dir) ? l:root_dir : ''
|
||||
endfunction
|
||||
|
||||
" Return the command to execute the linter in the projects directory.
|
||||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#elm#make#GetExecutable(a:buffer)
|
||||
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
|
||||
let l:is_using_elm_test = l:executable =~# 'elm-test$'
|
||||
|
||||
if empty(l:root_dir)
|
||||
let l:dir_set_cmd = ''
|
||||
else
|
||||
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
|
||||
endif
|
||||
|
||||
" elm-test needs to know the path of elm-make if elm isn't installed globally.
|
||||
" https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler
|
||||
if l:is_v19 && l:is_using_elm_test
|
||||
|
@ -213,7 +212,9 @@ 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
|
||||
return l:dir_set_cmd . '%e make --report=json --output=/dev/null' . l:elm_test_compiler_flag . '%t'
|
||||
return '%e make --report=json --output=/dev/null'
|
||||
\ . l:elm_test_compiler_flag
|
||||
\ . '%t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||
|
@ -235,6 +236,7 @@ call ale#linter#Define('elm', {
|
|||
\ 'name': 'make',
|
||||
\ 'executable': function('ale_linters#elm#make#GetExecutable'),
|
||||
\ 'output_stream': 'both',
|
||||
\ 'cwd': function('ale_linters#elm#make#GetCwd'),
|
||||
\ 'command': function('ale_linters#elm#make#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
\})
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
let g:ale_erlang_dialyzer_executable =
|
||||
\ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer')
|
||||
let g:ale_erlang_dialyzer_options =
|
||||
\ get(g:, 'ale_erlang_dialyzer_options', '-Wunmatched_returns'
|
||||
\ . ' -Werror_handling'
|
||||
\ . ' -Wrace_conditions'
|
||||
\ . ' -Wunderspecs')
|
||||
let g:ale_erlang_dialyzer_plt_file =
|
||||
\ get(g:, 'ale_erlang_dialyzer_plt_file', '')
|
||||
let g:ale_erlang_dialyzer_rebar3_profile =
|
||||
|
@ -47,13 +52,12 @@ function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'erlang_dialyzer_options')
|
||||
|
||||
let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer))
|
||||
\ . ' -n'
|
||||
\ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer))
|
||||
\ . ' -Wunmatched_returns'
|
||||
\ . ' -Werror_handling'
|
||||
\ . ' -Wrace_conditions'
|
||||
\ . ' -Wunderspecs'
|
||||
\ . ' ' . l:options
|
||||
\ . ' %s'
|
||||
|
||||
return l:command
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
" Author: Magnus Ottenklinger - https://github.com/evnu
|
||||
|
||||
let g:ale_erlang_erlc_executable = get(g:, 'ale_erlang_erlc_executable', 'erlc')
|
||||
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
||||
|
||||
function! ale_linters#erlang#erlc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_erlc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
||||
let l:output_file = ale#util#Tempname()
|
||||
call ale#command#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return 'erlc -o ' . ale#Escape(l:output_file)
|
||||
\ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
|
||||
\ . ' %t'
|
||||
let l:command = ale#Escape(ale_linters#erlang#erlc#GetExecutable(a:buffer))
|
||||
\ . ' -o ' . ale#Escape(l:output_file)
|
||||
\ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
|
||||
\ . ' %t'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
||||
|
@ -90,7 +98,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'erlc',
|
||||
\ 'executable': 'erlc',
|
||||
\ 'executable': function('ale_linters#erlang#erlc#GetExecutable'),
|
||||
\ 'command': function('ale_linters#erlang#erlc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#erlang#erlc#Handle',
|
||||
\})
|
||||
|
|
|
@ -10,8 +10,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
|||
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
|
@ -50,6 +49,7 @@ call ale#linter#Define('go', {
|
|||
\ 'name': 'gobuild',
|
||||
\ 'aliases': ['go build'],
|
||||
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gobuild#GetCommand'),
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||
|
|
|
@ -12,14 +12,12 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
|||
|
||||
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . l:options
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . ale#Escape(l:filename)
|
||||
\ . ' ' . l:options
|
||||
|
@ -53,6 +51,7 @@ endfunction
|
|||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golangci-lint',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#golangci_lint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#go#golangci_lint#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -13,14 +13,12 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
|||
" BufferCdString is used so that we can be sure the paths output from gometalinter can
|
||||
" be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
|
@ -53,6 +51,7 @@ endfunction
|
|||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gometalinter',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_gometalinter_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gometalinter#GetCommand'),
|
||||
\ 'callback': 'ale_linters#go#gometalinter#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
call ale#Set('go_gopls_executable', 'gopls')
|
||||
call ale#Set('go_gopls_options', '--mode stdio')
|
||||
call ale#Set('go_gopls_init_options', {})
|
||||
|
||||
function! ale_linters#go#gopls#GetCommand(buffer) abort
|
||||
return ale#go#EnvString(a:buffer)
|
||||
|
@ -31,4 +32,5 @@ call ale#linter#Define('go', {
|
|||
\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')},
|
||||
\ 'command': function('ale_linters#go#gopls#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'),
|
||||
\ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')},
|
||||
\})
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" Description: gosimple for Go files
|
||||
|
||||
function! ale_linters#go#gosimple#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer) . 'gosimple .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gosimple',
|
||||
\ 'executable': 'gosimple',
|
||||
\ 'command': function('ale_linters#go#gosimple#GetCommand'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': {b -> ale#go#EnvString(b) . 'gosimple .'},
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
" Author: Jelte Fennema <github-public@jeltef.nl>
|
||||
" Description: gotype for Go files
|
||||
|
||||
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
function! ale_linters#go#gotype#GetExecutable(buffer) abort
|
||||
if expand('#' . a:buffer . ':p') =~# '_test\.go$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer) . 'gotype -e .'
|
||||
return 'gotype'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
return ale#go#EnvString(a:buffer) . 'gotype -e .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gotype',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gotype',
|
||||
\ 'executable': function('ale_linters#go#gotype#GetExecutable'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gotype#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -10,8 +10,7 @@ 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) . ' '
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' .'
|
||||
|
@ -22,6 +21,7 @@ call ale#linter#Define('go', {
|
|||
\ 'aliases': ['go vet'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#govet#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -5,28 +5,24 @@ call ale#Set('go_staticcheck_options', '')
|
|||
call ale#Set('go_staticcheck_lint_package', 0)
|
||||
|
||||
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
|
||||
let l:env = ale#go#EnvString(a:buffer)
|
||||
|
||||
" BufferCdString is used so that we can be sure the paths output from
|
||||
" staticcheck can be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . l:env . 'staticcheck'
|
||||
return l:env . 'staticcheck'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . l:env . 'staticcheck'
|
||||
return l:env . 'staticcheck'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' ' . ale#Escape(l:filename)
|
||||
\ . ' %s:t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'staticcheck',
|
||||
\ 'executable': 'staticcheck',
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#staticcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'output_stream': 'both',
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
call ale#linter#Define('graphql', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
" Author: Michiel Westerbeek <happylinks@gmail.com>
|
||||
" Description: Linter for GraphQL Schemas
|
||||
|
||||
function! ale_linters#graphql#gqlint#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'gqlint'
|
||||
\ . ' --reporter=simple %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('graphql', {
|
||||
\ 'name': 'gqlint',
|
||||
\ 'executable': 'gqlint',
|
||||
\ 'command': function('ale_linters#graphql#gqlint#GetCommand'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': 'gqlint --reporter=simple %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'cabal exec -- ghc '
|
||||
return 'cabal exec -- ghc '
|
||||
\ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
@ -15,6 +14,7 @@ call ale#linter#Define('haskell', {
|
|||
\ 'aliases': ['cabal-ghc'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'cabal',
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
" Author: Yen3 <yen3rc@gmail.com>
|
||||
" Description: A language server for haskell
|
||||
" The file is based on hie.vim (author: Luxed
|
||||
" <devildead13@gmail.com>). It search more project root files.
|
||||
"
|
||||
call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper')
|
||||
|
||||
function! ale_linters#haskell#hls#FindRootFile(buffer) abort
|
||||
let l:serach_root_files = [
|
||||
\ 'stack.yaml',
|
||||
\ 'cabal.project',
|
||||
\ 'package.yaml',
|
||||
\ 'hie.yaml'
|
||||
\ ]
|
||||
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
for l:root_file in l:serach_root_files
|
||||
if filereadable(l:path . l:root_file)
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haskell#hls#GetProjectRoot(buffer) abort
|
||||
" Search for the project file first
|
||||
let l:project_file = ale_linters#haskell#hls#FindRootFile(a:buffer)
|
||||
|
||||
" If it's empty, search for the cabal file
|
||||
if empty(l:project_file)
|
||||
" Search all of the paths except for the root filesystem path.
|
||||
let l:paths = join(
|
||||
\ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2],
|
||||
\ ','
|
||||
\)
|
||||
let l:project_file = globpath(l:paths, '*.cabal')
|
||||
endif
|
||||
|
||||
" If we still can't find one, use the current file.
|
||||
if empty(l:project_file)
|
||||
let l:project_file = expand('#' . a:buffer . ':p')
|
||||
endif
|
||||
|
||||
return fnamemodify(l:project_file, ':h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haskell#hls#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_hls_executable')
|
||||
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable,
|
||||
\ 'haskell-language-server-wrapper')
|
||||
\ . ' --lsp'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'command': function('ale_linters#haskell#hls#GetCommand'),
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')},
|
||||
\ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'),
|
||||
\})
|
|
@ -4,8 +4,7 @@
|
|||
call ale#Set('haskell_stack_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#handlers#haskell#GetStackExecutable(a:buffer)
|
||||
return ale#handlers#haskell#GetStackExecutable(a:buffer)
|
||||
\ . ' ghc -- '
|
||||
\ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
|
||||
\ . ' %t'
|
||||
|
@ -16,6 +15,7 @@ call ale#linter#Define('haskell', {
|
|||
\ 'aliases': ['stack-ghc'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale#handlers#haskell#GetStackExecutable'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: tsserver integration for ALE
|
||||
|
||||
call ale#Set('html_angular_executable', 'ngserver')
|
||||
call ale#Set('html_angular_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#html#angular#GetProjectRoot(buffer) abort
|
||||
return ale#path#Dirname(
|
||||
\ ale#path#FindNearestDirectory(a:buffer, 'node_modules')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#angular#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'html_angular', [
|
||||
\ 'node_modules/@angular/language-server/bin/ngserver',
|
||||
\ 'node_modules/@angular/language-server/index.js',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#angular#GetCommand(buffer) abort
|
||||
let l:language_service_dir = ale#path#Simplify(
|
||||
\ ale#path#FindNearestDirectory(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/@angular/language-service'
|
||||
\ )
|
||||
\)
|
||||
|
||||
if empty(l:language_service_dir)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:language_service_dir = fnamemodify(l:language_service_dir, ':h')
|
||||
let l:typescript_dir = ale#path#Simplify(
|
||||
\ fnamemodify(l:language_service_dir, ':h:h')
|
||||
\ . '/typescript'
|
||||
\)
|
||||