summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/ada/gcc.vim2
-rw-r--r--ale_linters/asciidoc/languagetool.vim5
-rw-r--r--ale_linters/asm/gcc.vim2
-rw-r--r--ale_linters/bats/shellcheck.vim4
-rw-r--r--ale_linters/c/cc.vim53
-rw-r--r--ale_linters/c/ccls.vim3
-rw-r--r--ale_linters/c/clang.vim24
-rw-r--r--ale_linters/c/cppcheck.vim2
-rw-r--r--ale_linters/c/gcc.vim28
-rw-r--r--ale_linters/clojure/clj_kondo.vim2
-rw-r--r--ale_linters/cpp/cc.vim53
-rw-r--r--ale_linters/cpp/ccls.vim3
-rw-r--r--ale_linters/cpp/clang.vim24
-rw-r--r--ale_linters/cpp/clangtidy.vim5
-rw-r--r--ale_linters/cpp/cppcheck.vim2
-rw-r--r--ale_linters/cpp/gcc.vim29
-rw-r--r--ale_linters/cuda/nvcc.vim3
-rw-r--r--ale_linters/dockerfile/dockerfile_lint.vim17
-rw-r--r--ale_linters/elixir/credo.vim2
-rw-r--r--ale_linters/eruby/ruumba.vim2
-rw-r--r--ale_linters/go/gofmt.vim1
-rw-r--r--ale_linters/go/revive.vim21
-rw-r--r--ale_linters/handlebars/embertemplatelint.vim31
-rw-r--r--ale_linters/java/checkstyle.vim2
-rw-r--r--ale_linters/java/eclipselsp.vim48
-rw-r--r--ale_linters/java/javac.vim35
-rw-r--r--ale_linters/kotlin/kotlinc.vim1
-rw-r--r--ale_linters/kotlin/ktlint.vim2
-rw-r--r--ale_linters/markdown/markdownlint.vim13
-rw-r--r--ale_linters/nasm/nasm.vim3
-rw-r--r--ale_linters/objc/ccls.vim3
-rw-r--r--ale_linters/objc/clang.vim2
-rw-r--r--ale_linters/objcpp/clang.vim2
-rw-r--r--ale_linters/ocaml/ols.vim2
-rw-r--r--ale_linters/php/psalm.vim10
-rw-r--r--ale_linters/puppet/puppet.vim8
-rw-r--r--ale_linters/pyrex/cython.vim4
-rw-r--r--ale_linters/python/flake8.vim28
-rw-r--r--ale_linters/python/pydocstyle.vim8
-rw-r--r--ale_linters/python/pyright.vim43
-rw-r--r--ale_linters/reason/ols.vim2
-rw-r--r--ale_linters/ruby/rubocop.vim2
-rw-r--r--ale_linters/ruby/standardrb.vim2
-rw-r--r--ale_linters/rust/analyzer.vim24
-rw-r--r--ale_linters/rust/cargo.vim5
-rw-r--r--ale_linters/scala/metals.vim2
-rw-r--r--ale_linters/sh/bashate.vim43
-rw-r--r--ale_linters/sh/shell.vim2
-rw-r--r--ale_linters/sh/shellcheck.vim107
-rw-r--r--ale_linters/sql/sqllint.vim33
-rw-r--r--ale_linters/swift/swiftformat.vim62
-rw-r--r--ale_linters/terraform/terraform_lsp.vim25
-rw-r--r--ale_linters/verilog/hdl_checker.vim5
-rw-r--r--ale_linters/verilog/verilator.vim27
-rw-r--r--ale_linters/verilog/vlog.vim14
-rw-r--r--ale_linters/vhdl/hdl_checker.vim5
-rw-r--r--ale_linters/vim/vimls.vim61
-rw-r--r--ale_linters/vim/vint.vim2
-rw-r--r--ale_linters/zig/zls.vim20
59 files changed, 688 insertions, 287 deletions
diff --git a/ale_linters/ada/gcc.vim b/ale_linters/ada/gcc.vim
index 87496b81..5afc9ae3 100644
--- a/ale_linters/ada/gcc.vim
+++ b/ale_linters/ada/gcc.vim
@@ -18,7 +18,7 @@ function! ale_linters#ada#gcc#GetCommand(buffer) abort
" -gnatc: Check syntax and semantics only (no code generation attempted)
return '%e -x ada -c -gnatc'
\ . ' -o ' . ale#Escape(l:out_file)
- \ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
+ \ . ' -I %s:h'
\ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options'))
\ . ' %t'
endfunction
diff --git a/ale_linters/asciidoc/languagetool.vim b/ale_linters/asciidoc/languagetool.vim
new file mode 100644
index 00000000..8e8de7f3
--- /dev/null
+++ b/ale_linters/asciidoc/languagetool.vim
@@ -0,0 +1,5 @@
+" Author: Horacio Sanson (hsanson [ät] gmail.com)
+" Description: languagetool for asciidoc files, copied from markdown.
+
+
+call ale#handlers#languagetool#DefineLinter('asciidoc')
diff --git a/ale_linters/asm/gcc.vim b/ale_linters/asm/gcc.vim
index eecab6ef..cda38923 100644
--- a/ale_linters/asm/gcc.vim
+++ b/ale_linters/asm/gcc.vim
@@ -9,7 +9,7 @@ function! ale_linters#asm#gcc#GetCommand(buffer) abort
" -fsyntax-only doesn't catch everything.
return '%e -x assembler'
\ . ' -o ' . g:ale#util#nul_file
- \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
+ \ . '-iquote %s:h'
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
endfunction
diff --git a/ale_linters/bats/shellcheck.vim b/ale_linters/bats/shellcheck.vim
new file mode 100644
index 00000000..5c2a0ea9
--- /dev/null
+++ b/ale_linters/bats/shellcheck.vim
@@ -0,0 +1,4 @@
+" Author: Ian2020 <https://github.com/Ian2020>
+" Description: shellcheck linter for bats scripts.
+
+call ale#handlers#shellcheck#DefineLinter('bats')
diff --git a/ale_linters/c/cc.vim b/ale_linters/c/cc.vim
new file mode 100644
index 00000000..5655fbf7
--- /dev/null
+++ b/ale_linters/c/cc.vim
@@ -0,0 +1,53 @@
+" Author: w0rp <devw0rp@gmail.com>
+" Description: A C compiler linter for C files with gcc/clang, etc.
+
+call ale#Set('c_cc_executable', '<auto>')
+call ale#Set('c_cc_options', '-std=c11 -Wall')
+
+function! ale_linters#c#cc#GetExecutable(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'c_cc_executable')
+
+ " Default to either clang or gcc.
+ if l:executable is# '<auto>'
+ if ale#engine#IsExecutable(a:buffer, 'clang')
+ let l:executable = 'clang'
+ else
+ let l:executable = 'gcc'
+ endif
+ endif
+
+ return l:executable
+endfunction
+
+function! ale_linters#c#cc#GetCommand(buffer, output) abort
+ let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
+ let l:ale_flags = ale#Var(a:buffer, 'c_cc_options')
+
+ if l:cflags =~# '-std='
+ let l:ale_flags = substitute(
+ \ l:ale_flags,
+ \ '-std=\(c\|gnu\)[0-9]\{2\}',
+ \ '',
+ \ 'g')
+ endif
+
+ " -iquote with the directory the file is in makes #include work for
+ " headers in the same directory.
+ "
+ " `-o /dev/null` or `-o null` is needed to catch all errors,
+ " -fsyntax-only doesn't catch everything.
+ return '%e -S -x c'
+ \ . ' -o ' . g:ale#util#nul_file
+ \ . ' -iquote %s:h'
+ \ . ale#Pad(l:cflags)
+ \ . ale#Pad(l:ale_flags) . ' -'
+endfunction
+
+call ale#linter#Define('c', {
+\ 'name': 'cc',
+\ 'aliases': ['gcc', 'clang'],
+\ 'output_stream': 'stderr',
+\ 'executable': function('ale_linters#c#cc#GetExecutable'),
+\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#cc#GetCommand'))},
+\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
+\})
diff --git a/ale_linters/c/ccls.vim b/ale_linters/c/ccls.vim
index 9e3dafe9..9f105712 100644
--- a/ale_linters/c/ccls.vim
+++ b/ale_linters/c/ccls.vim
@@ -3,6 +3,7 @@
call ale#Set('c_ccls_executable', 'ccls')
call ale#Set('c_ccls_init_options', {})
+call ale#Set('c_build_dir', '')
call ale#linter#Define('c', {
\ 'name': 'ccls',
@@ -10,5 +11,5 @@ call ale#linter#Define('c', {
\ 'executable': {b -> ale#Var(b, 'c_ccls_executable')},
\ 'command': '%e',
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
-\ 'initialization_options': {b -> ale#Var(b, 'c_ccls_init_options')},
+\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'c_ccls_init_options')},
\})
diff --git a/ale_linters/c/clang.vim b/ale_linters/c/clang.vim
deleted file mode 100644
index 681101fc..00000000
--- a/ale_linters/c/clang.vim
+++ /dev/null
@@ -1,24 +0,0 @@
-" Author: Masahiro H https://github.com/mshr-h
-" Description: clang linter for c files
-
-call ale#Set('c_clang_executable', 'clang')
-call ale#Set('c_clang_options', '-std=c11 -Wall')
-
-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 '%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')) . ' -'
-endfunction
-
-call ale#linter#Define('c', {
-\ 'name': 'clang',
-\ 'output_stream': 'stderr',
-\ 'executable': {b -> ale#Var(b, 'c_clang_executable')},
-\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clang#GetCommand'))},
-\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
-\})
diff --git a/ale_linters/c/cppcheck.vim b/ale_linters/c/cppcheck.vim
index 309b2851..b671fc8b 100644
--- a/ale_linters/c/cppcheck.vim
+++ b/ale_linters/c/cppcheck.vim
@@ -10,9 +10,11 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort
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}'''
return l:cd_command
\ . '%e -q --language=c'
+ \ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
\ . l:buffer_path_include
diff --git a/ale_linters/c/gcc.vim b/ale_linters/c/gcc.vim
deleted file mode 100644
index 1df1018e..00000000
--- a/ale_linters/c/gcc.vim
+++ /dev/null
@@ -1,28 +0,0 @@
-" Author: w0rp <devw0rp@gmail.com>
-" Description: gcc linter for c files
-
-call ale#Set('c_gcc_executable', 'gcc')
-call ale#Set('c_gcc_options', '-std=c11 -Wall')
-
-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.
- "
- " `-o /dev/null` or `-o null` is needed to catch all errors,
- " -fsyntax-only doesn't catch everything.
- return '%e -S -x c'
- \ . ' -o ' . g:ale#util#nul_file
- \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
- \ . ale#Pad(l:cflags)
- \ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -'
-endfunction
-
-call ale#linter#Define('c', {
-\ 'name': 'gcc',
-\ 'output_stream': 'stderr',
-\ 'executable': {b -> ale#Var(b, 'c_gcc_executable')},
-\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#gcc#GetCommand'))},
-\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
-\})
diff --git a/ale_linters/clojure/clj_kondo.vim b/ale_linters/clojure/clj_kondo.vim
index 5dd11c12..eb60ce77 100644
--- a/ale_linters/clojure/clj_kondo.vim
+++ b/ale_linters/clojure/clj_kondo.vim
@@ -29,6 +29,6 @@ call ale#linter#Define('clojure', {
\ 'name': 'clj-kondo',
\ 'output_stream': 'stdout',
\ 'executable': 'clj-kondo',
-\ 'command': 'clj-kondo --lint %t',
+\ 'command': 'clj-kondo --cache --lint %t',
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
\})
diff --git a/ale_linters/cpp/cc.vim b/ale_linters/cpp/cc.vim
new file mode 100644
index 00000000..ffb8f068
--- /dev/null
+++ b/ale_linters/cpp/cc.vim
@@ -0,0 +1,53 @@
+" Author: w0rp <devw0rp@gmail.com>
+" Description: A C++ compiler linter for C++ files with gcc/clang, etc.
+
+call ale#Set('cpp_cc_executable', '<auto>')
+call ale#Set('cpp_cc_options', '-std=c++14 -Wall')
+
+function! ale_linters#cpp#cc#GetExecutable(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'cpp_cc_executable')
+
+ " Default to either clang++ or gcc.
+ if l:executable is# '<auto>'
+ if ale#engine#IsExecutable(a:buffer, 'clang++')
+ let l:executable = 'clang++'
+ else
+ let l:executable = 'gcc'
+ endif
+ endif
+
+ return l:executable
+endfunction
+
+function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
+ let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
+ let l:ale_flags = ale#Var(a:buffer, 'cpp_cc_options')
+
+ if l:cflags =~# '-std='
+ let l:ale_flags = substitute(
+ \ l:ale_flags,
+ \ '-std=\(c\|gnu\)++[0-9]\{2\}',
+ \ '',
+ \ 'g')
+ endif
+
+ " -iquote with the directory the file is in makes #include work for
+ " headers in the same directory.
+ "
+ " `-o /dev/null` or `-o null` is needed to catch all errors,
+ " -fsyntax-only doesn't catch everything.
+ return '%e -S -x c++'
+ \ . ' -o ' . g:ale#util#nul_file
+ \ . ' -iquote %s:h'
+ \ . ale#Pad(l:cflags)
+ \ . ale#Pad(l:ale_flags) . ' -'
+endfunction
+
+call ale#linter#Define('cpp', {
+\ 'name': 'cc',
+\ 'aliases': ['gcc', 'clang', 'g++', 'clang++'],
+\ 'output_stream': 'stderr',
+\ 'executable': function('ale_linters#cpp#cc#GetExecutable'),
+\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#cc#GetCommand'))},
+\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
+\})
diff --git a/ale_linters/cpp/ccls.vim b/ale_linters/cpp/ccls.vim
index b265ff70..38f8df9c 100644
--- a/ale_linters/cpp/ccls.vim
+++ b/ale_linters/cpp/ccls.vim
@@ -3,6 +3,7 @@
call ale#Set('cpp_ccls_executable', 'ccls')
call ale#Set('cpp_ccls_init_options', {})
+call ale#Set('c_build_dir', '')
call ale#linter#Define('cpp', {
\ 'name': 'ccls',
@@ -10,5 +11,5 @@ call ale#linter#Define('cpp', {
\ 'executable': {b -> ale#Var(b, 'cpp_ccls_executable')},
\ 'command': '%e',
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
-\ 'initialization_options': {b -> ale#Var(b, 'cpp_ccls_init_options')},
+\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'cpp_ccls_init_options')},
\})
diff --git a/ale_linters/cpp/clang.vim b/ale_linters/cpp/clang.vim
deleted file mode 100644
index e48291eb..00000000
--- a/ale_linters/cpp/clang.vim
+++ /dev/null
@@ -1,24 +0,0 @@
-" Author: Tomota Nakamura <https://github.com/tomotanakamura>
-" Description: clang linter for cpp files
-
-call ale#Set('cpp_clang_executable', 'clang++')
-call ale#Set('cpp_clang_options', '-std=c++14 -Wall')
-
-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 '%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')) . ' -'
-endfunction
-
-call ale#linter#Define('cpp', {
-\ 'name': 'clang',
-\ 'output_stream': 'stderr',
-\ 'executable': {b -> ale#Var(b, 'cpp_clang_executable')},
-\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clang#GetCommand'))},
-\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
-\})
diff --git a/ale_linters/cpp/clangtidy.vim b/ale_linters/cpp/clangtidy.vim
index 191b7b07..5e062d86 100644
--- a/ale_linters/cpp/clangtidy.vim
+++ b/ale_linters/cpp/clangtidy.vim
@@ -25,6 +25,11 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
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++'
+ endif
+
" Get the options to pass directly to clang-tidy
let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options')
diff --git a/ale_linters/cpp/cppcheck.vim b/ale_linters/cpp/cppcheck.vim
index 7cd80dbc..2c832246 100644
--- a/ale_linters/cpp/cppcheck.vim
+++ b/ale_linters/cpp/cppcheck.vim
@@ -10,9 +10,11 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
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}'''
return l:cd_command
\ . '%e -q --language=c++'
+ \ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
\ . l:buffer_path_include
diff --git a/ale_linters/cpp/gcc.vim b/ale_linters/cpp/gcc.vim
deleted file mode 100644
index 108d6d70..00000000
--- a/ale_linters/cpp/gcc.vim
+++ /dev/null
@@ -1,29 +0,0 @@
-" Author: geam <mdelage@student.42.fr>
-" Description: gcc linter for cpp files
-"
-call ale#Set('cpp_gcc_executable', 'gcc')
-call ale#Set('cpp_gcc_options', '-std=c++14 -Wall')
-
-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.
- "
- " `-o /dev/null` or `-o null` is needed to catch all errors,
- " -fsyntax-only doesn't catch everything.
- return '%e -S -x c++'
- \ . ' -o ' . g:ale#util#nul_file
- \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
- \ . ale#Pad(l:cflags)
- \ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -'
-endfunction
-
-call ale#linter#Define('cpp', {
-\ 'name': 'gcc',
-\ 'aliases': ['g++'],
-\ 'output_stream': 'stderr',
-\ 'executable': {b -> ale#Var(b, 'cpp_gcc_executable')},
-\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#gcc#GetCommand'))},
-\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
-\})
diff --git a/ale_linters/cuda/nvcc.vim b/ale_linters/cuda/nvcc.vim
index f3af07b6..2734f6ec 100644
--- a/ale_linters/cuda/nvcc.vim
+++ b/ale_linters/cuda/nvcc.vim
@@ -5,9 +5,6 @@ call ale#Set('cuda_nvcc_executable', 'nvcc')
call ale#Set('cuda_nvcc_options', '-std=c++11')
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
- " Unused: use ale#util#nul_file
- " let l:output_file = ale#util#Tempname() . '.ii'
- " call ale#command#ManageFile(a:buffer, l:output_file)
return '%e -cuda'
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
diff --git a/ale_linters/dockerfile/dockerfile_lint.vim b/ale_linters/dockerfile/dockerfile_lint.vim
index 95768b12..0c0ad533 100644
--- a/ale_linters/dockerfile/dockerfile_lint.vim
+++ b/ale_linters/dockerfile/dockerfile_lint.vim
@@ -32,14 +32,29 @@ function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
let l:line = get(l:object, 'line', -1)
let l:message = l:object['message']
+ let l:link = get(l:object, 'reference_url', '')
+
+ if type(l:link) == v:t_list
+ " Somehow, reference_url is returned as two-part list.
+ " Anchor markers in that list are sometimes duplicated.
+ " See https://github.com/projectatomic/dockerfile_lint/issues/134
+ let l:link = join(l:link, '')
+ let l:link = substitute(l:link, '##', '#', '')
+ endif
+
+ let l:detail = l:message
+
if get(l:object, 'description', 'None') isnot# 'None'
- let l:message = l:message . '. ' . l:object['description']
+ let l:detail .= "\n\n" . l:object['description']
endif
+ let l:detail .= "\n\n" . l:link
+
call add(l:messages, {
\ 'lnum': l:line,
\ 'text': l:message,
\ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type),
+ \ 'detail': l:detail,
\})
endfor
endfor
diff --git a/ale_linters/elixir/credo.vim b/ale_linters/elixir/credo.vim
index 317ecab3..7c298502 100644
--- a/ale_linters/elixir/credo.vim
+++ b/ale_linters/elixir/credo.vim
@@ -46,7 +46,7 @@ function! ale_linters#elixir#credo#GetMode() abort
endfunction
function! ale_linters#elixir#credo#GetCommand(buffer) abort
- let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
+ let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
let l:mode = ale_linters#elixir#credo#GetMode()
return ale#path#CdString(l:project_root)
diff --git a/ale_linters/eruby/ruumba.vim b/ale_linters/eruby/ruumba.vim
index 2e84acf7..f415f1ab 100644
--- a/ale_linters/eruby/ruumba.vim
+++ b/ale_linters/eruby/ruumba.vim
@@ -11,7 +11,7 @@ function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'ruumba')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'eruby_ruumba_options')
- \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
+ \ . ' --stdin %s'
endfunction
function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort
diff --git a/ale_linters/go/gofmt.vim b/ale_linters/go/gofmt.vim
index a233b422..b313f9ca 100644
--- a/ale_linters/go/gofmt.vim
+++ b/ale_linters/go/gofmt.vim
@@ -6,7 +6,6 @@ function! ale_linters#go#gofmt#GetCommand(buffer) abort
\ . '%e -e %t'
endfunction
-
call ale#linter#Define('go', {
\ 'name': 'gofmt',
\ 'output_stream': 'stderr',
diff --git a/ale_linters/go/revive.vim b/ale_linters/go/revive.vim
new file mode 100644
index 00000000..b14b5ab9
--- /dev/null
+++ b/ale_linters/go/revive.vim
@@ -0,0 +1,21 @@
+" Author: Penghui Liao <liaoishere@gmail.com>
+" Description: Adds support for revive
+
+call ale#Set('go_revive_executable', 'revive')
+call ale#Set('go_revive_options', '')
+
+function! ale_linters#go#revive#GetCommand(buffer) abort
+ let l:options = ale#Var(a:buffer, 'go_revive_options')
+
+ return ale#go#EnvString(a:buffer) . '%e'
+ \ . (!empty(l:options) ? ' ' . l:options : '')
+ \ . ' %t'
+endfunction
+
+call ale#linter#Define('go', {
+\ 'name': 'revive',
+\ 'output_stream': 'both',
+\ 'executable': {b -> ale#Var(b, 'go_revive_executable')},
+\ 'command': function('ale_linters#go#revive#GetCommand'),
+\ 'callback': 'ale#handlers#unix#HandleAsWarning',
+\})
diff --git a/ale_linters/handlebars/embertemplatelint.vim b/ale_linters/handlebars/embertemplatelint.vim
index 74bd6a99..bd4d1d31 100644
--- a/ale_linters/handlebars/embertemplatelint.vim
+++ b/ale_linters/handlebars/embertemplatelint.vim
@@ -4,6 +4,28 @@
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
+function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
+ return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
+ \ 'node_modules/.bin/ember-template-lint',
+ \])
+endfunction
+
+function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort
+ " Reading from stdin was introduced in ember-template-lint@1.6.0
+ return ale#semver#GTE(a:version, [1, 6, 0])
+ \ ? '%e --json --filename %s'
+ \ : '%e --json %t'
+endfunction
+
+function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
+ return ale#semver#RunWithVersionCheck(
+ \ a:buffer,
+ \ ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer),
+ \ '%e --version',
+ \ function('ale_linters#handlebars#embertemplatelint#GetCommand'),
+ \)
+endfunction
+
function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
let l:output = []
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
@@ -30,10 +52,9 @@ function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
endfunction
call ale#linter#Define('handlebars', {
-\ 'name': 'ember-template-lint',
-\ 'executable': {b -> ale#node#FindExecutable(b, 'handlebars_embertemplatelint', [
-\ 'node_modules/.bin/ember-template-lint',
-\ ])},
-\ 'command': '%e --json %t',
+\ 'name': 'embertemplatelint',
+\ 'aliases': ['ember-template-lint'],
+\ 'executable': function('ale_linters#handlebars#embertemplatelint#GetExecutable'),
+\ 'command': function('ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck'),
\ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle',
\})
diff --git a/ale_linters/java/checkstyle.vim b/ale_linters/java/checkstyle.vim
index 7901ff7e..ec7339d1 100644
--- a/ale_linters/java/checkstyle.vim
+++ b/ale_linters/java/checkstyle.vim
@@ -52,7 +52,7 @@ endfunction
function! ale_linters#java#checkstyle#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'java_checkstyle_options')
let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config')
- let l:config = l:options !~# '\v(^| )-c' && !empty(l:config_option)
+ let l:config = l:options !~# '\v(^| )-c ' && !empty(l:config_option)
\ ? s:GetConfig(a:buffer, l:config_option)
\ : ''
diff --git a/ale_linters/java/eclipselsp.vim b/ale_linters/java/eclipselsp.vim
index 2648893b..8bc09039 100644
--- a/ale_linters/java/eclipselsp.vim
+++ b/ale_linters/java/eclipselsp.vim
@@ -7,6 +7,7 @@ call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls'
call ale#Set('java_eclipselsp_config_path', '')
call ale#Set('java_eclipselsp_workspace_path', '')
call ale#Set('java_eclipselsp_executable', 'java')
+call ale#Set('java_eclipselsp_javaagent', '')
function! ale_linters#java#eclipselsp#Executable(buffer) abort
return ale#Var(a:buffer, 'java_eclipselsp_executable')
@@ -19,25 +20,39 @@ endfunction
function! ale_linters#java#eclipselsp#JarPath(buffer) abort
let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer)
+ if has('win32')
+ let l:platform = 'win32'
+ elseif has('macunix')
+ let l:platform = 'macosx'
+ else
+ let l:platform = 'linux'
+ endif
+
" Search jar file within repository path when manually built using mvn
- let l:repo_path = l:path . '/org.eclipse.jdt.ls.product/target/repository'
- let l:files = globpath(l:repo_path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
+ let l:files = globpath(l:path, '**/'.l:platform.'/**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
- if len(l:files) == 1
+ if len(l:files) >= 1
return l:files[0]
endif
" Search jar file within VSCode extensions folder.
- let l:files = globpath(l:path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
+ let l:files = globpath(l:path, '**/'.l:platform.'/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
+
+ if len(l:files) >= 1
+ return l:files[0]
+ endif
+
+ " Search jar file within unzipped tar.gz file
+ let l:files = globpath(l:path, 'plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
- if len(l:files) == 1
+ if len(l:files) >= 1
return l:files[0]
endif
" Search jar file within system package path
let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
- if len(l:files) == 1
+ if len(l:files) >= 1
return l:files[0]
endif
@@ -100,12 +115,30 @@ function! ale_linters#java#eclipselsp#WorkspacePath(buffer) abort
return ale#path#Dirname(ale#java#FindProjectRoot(a:buffer))
endfunction
+function! ale_linters#java#eclipselsp#Javaagent(buffer) abort
+ let l:rets = []
+ let l:raw = ale#Var(a:buffer, 'java_eclipselsp_javaagent')
+
+ if empty(l:raw)
+ return ''
+ endif
+
+ let l:jars = split(l:raw)
+
+ for l:jar in l:jars
+ call add(l:rets, ale#Escape('-javaagent:' . l:jar))
+ endfor
+
+ return join(l:rets, ' ')
+endfunction
+
function! ale_linters#java#eclipselsp#Command(buffer, version) abort
let l:path = ale#Var(a:buffer, 'java_eclipselsp_path')
let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer)
let l:cmd = [ ale#Escape(l:executable),
+ \ ale_linters#java#eclipselsp#Javaagent(a:buffer),
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
\ '-Dosgi.bundles.defaultStartLevel=4',
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
@@ -147,7 +180,8 @@ function! ale_linters#java#eclipselsp#RunWithVersionCheck(buffer) abort
return ale#command#Run(
\ a:buffer,
\ l:command,
- \ function('ale_linters#java#eclipselsp#CommandWithVersion')
+ \ function('ale_linters#java#eclipselsp#CommandWithVersion'),
+ \ { 'output_stream': 'both' }
\)
endfunction
diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim
index 8bb52c0b..f866eb09 100644
--- a/ale_linters/java/javac.vim
+++ b/ale_linters/java/javac.vim
@@ -6,6 +6,7 @@ let s:classpath_sep = has('unix') ? ':' : ';'
call ale#Set('java_javac_executable', 'javac')
call ale#Set('java_javac_options', '')
call ale#Set('java_javac_classpath', '')
+call ale#Set('java_javac_sourcepath', '')
function! ale_linters#java#javac#RunWithImportPaths(buffer) abort
let l:command = ''
@@ -40,10 +41,15 @@ endfunction
function! s:BuildClassPathOption(buffer, import_paths) abort
" Filter out lines like [INFO], etc.
let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''')
- call extend(
- \ l:class_paths,
- \ split(ale#Var(a:buffer, 'java_javac_classpath'), s:classpath_sep),
- \)
+ let l:cls_path = ale#Var(a:buffer, 'java_javac_classpath')
+
+ if !empty(l:cls_path) && type(l:cls_path) is v:t_string
+ call extend(l:class_paths, split(l:cls_path, s:classpath_sep))
+ endif
+
+ if !empty(l:cls_path) && type(l:cls_path) is v:t_list
+ call extend(l:class_paths, l:cls_path)
+ endif
return !empty(l:class_paths)
\ ? '-cp ' . ale#Escape(join(l:class_paths, s:classpath_sep))
@@ -79,6 +85,27 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort
endif
endif
+ let l:source_paths = []
+ let l:source_path = ale#Var(a:buffer, 'java_javac_sourcepath')
+
+ if !empty(l:source_path) && type(l:source_path) is v:t_string
+ let l:source_paths = split(l:source_path, s:classpath_sep)
+ endif
+
+ if !empty(l:source_path) && type(l:source_path) is v:t_list
+ let l:source_paths = l:source_path
+ endif
+
+ if !empty(l:source_paths)
+ for l:path in l:source_paths
+ let l:sp_path = ale#path#FindNearestDirectory(a:buffer, l:path)
+
+ if !empty(l:sp_path)
+ call add(l:sp_dirs, l:sp_path)
+ endif
+ endfor
+ endif
+
if !empty(l:sp_dirs)
let l:sp_option = '-sourcepath '
\ . ale#Escape(join(l:sp_dirs, s:classpath_sep))
diff --git a/ale_linters/kotlin/kotlinc.vim b/ale_linters/kotlin/kotlinc.vim
index 3c6854fa..66c075be 100644
--- a/ale_linters/kotlin/kotlinc.vim
+++ b/ale_linters/kotlin/kotlinc.vim
@@ -174,6 +174,7 @@ endfunction
call ale#linter#Define('kotlin', {
\ 'name': 'kotlinc',
\ 'executable': 'kotlinc',
+\ 'output_stream': 'stderr',
\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'),
\ 'callback': 'ale_linters#kotlin#kotlinc#Handle',
\ 'lint_file': 1,
diff --git a/ale_linters/kotlin/ktlint.vim b/ale_linters/kotlin/ktlint.vim
index f0384005..0bb64b19 100644
--- a/ale_linters/kotlin/ktlint.vim
+++ b/ale_linters/kotlin/ktlint.vim
@@ -6,5 +6,5 @@ call ale#linter#Define('kotlin', {
\ 'executable': 'ktlint',
\ 'command': function('ale#handlers#ktlint#GetCommand'),
\ 'callback': 'ale#handlers#ktlint#Handle',
-\ 'lint_file': 1
+\ 'output_stream': 'stderr'
\})
diff --git a/ale_linters/markdown/markdownlint.vim b/ale_linters/markdown/markdownlint.vim
index e935cbfe..7a293938 100644
--- a/ale_linters/markdown/markdownlint.vim
+++ b/ale_linters/markdown/markdownlint.vim
@@ -1,11 +1,22 @@
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
" Description: Adds support for markdownlint
+call ale#Set('markdown_markdownlint_options', '')
+
+function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
+ let l:executable = 'markdownlint'
+
+ let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
+
+ return ale#Escape(l:executable)
+ \ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
+endfunction
+
call ale#linter#Define('markdown', {
\ 'name': 'markdownlint',
\ 'executable': 'markdownlint',
\ 'lint_file': 1,
\ 'output_stream': 'both',
-\ 'command': 'markdownlint %s',
+\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'),
\ 'callback': 'ale#handlers#markdownlint#Handle'
\})
diff --git a/ale_linters/nasm/nasm.vim b/ale_linters/nasm/nasm.vim
index 347abc1b..c4f53629 100644
--- a/ale_linters/nasm/nasm.vim
+++ b/ale_linters/nasm/nasm.vim
@@ -7,10 +7,9 @@ call ale#Set('nasm_nasm_options', '')
function! ale_linters#nasm#nasm#GetCommand(buffer) abort
" Note that NASM requires a trailing slash for the -I option.
let l:separator = has('win32') ? '\' : '/'
- let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator
let l:output_null = has('win32') ? 'NUL' : '/dev/null'
- return '%e -X gnu -I ' . ale#Escape(l:path)
+ return '%e -X gnu -I %s:h' . l:separator
\ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
\ . ' %s'
\ . ' -o ' . l:output_null
diff --git a/ale_linters/objc/ccls.vim b/ale_linters/objc/ccls.vim
index 51ecf056..7aef5325 100644
--- a/ale_linters/objc/ccls.vim
+++ b/ale_linters/objc/ccls.vim
@@ -3,6 +3,7 @@
call ale#Set('objc_ccls_executable', 'ccls')
call ale#Set('objc_ccls_init_options', {})
+call ale#Set('c_build_dir', '')
call ale#linter#Define('objc', {
\ 'name': 'ccls',
@@ -10,5 +11,5 @@ call ale#linter#Define('objc', {
\ 'executable': {b -> ale#Var(b, 'objc_ccls_executable')},
\ 'command': '%e',
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
-\ 'initialization_options': {b -> ale#Var(b, 'objc_ccls_init_options')},
+\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'objc_ccls_init_options')},
\})
diff --git a/ale_linters/objc/clang.vim b/ale_linters/objc/clang.vim
index 7873dccd..cafb97db 100644
--- a/ale_linters/objc/clang.vim
+++ b/ale_linters/objc/clang.vim
@@ -10,7 +10,7 @@ function! ale_linters#objc#clang#GetCommand(buffer) abort
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
return 'clang -S -x objective-c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
+ \ . '-iquote %s:h'
\ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -'
endfunction
diff --git a/ale_linters/objcpp/clang.vim b/ale_linters/objcpp/clang.vim
index 4dbe55b3..35a40c6f 100644
--- a/ale_linters/objcpp/clang.vim
+++ b/ale_linters/objcpp/clang.vim
@@ -10,7 +10,7 @@ function! ale_linters#objcpp#clang#GetCommand(buffer) abort
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
return 'clang++ -S -x objective-c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
+ \ . '-iquote %s:h'
\ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -'
endfunction
diff --git a/ale_linters/ocaml/ols.vim b/ale_linters/ocaml/ols.vim
index d8208c52..ec71bdb4 100644
--- a/ale_linters/ocaml/ols.vim
+++ b/ale_linters/ocaml/ols.vim
@@ -9,6 +9,6 @@ call ale#linter#Define('ocaml', {
\ 'lsp': 'stdio',
\ 'executable': function('ale#handlers#ols#GetExecutable'),
\ 'command': function('ale#handlers#ols#GetCommand'),
-\ 'language_callback': 'ale#handlers#ols#GetLanguage',
+\ 'language': function('ale#handlers#ols#GetLanguage'),
\ 'project_root': function('ale#handlers#ols#GetProjectRoot'),
\})
diff --git a/ale_linters/php/psalm.vim b/ale_linters/php/psalm.vim
index ab4dbbc9..286c8a96 100644
--- a/ale_linters/php/psalm.vim
+++ b/ale_linters/php/psalm.vim
@@ -1,9 +1,9 @@
" Author: Matt Brown <https://github.com/muglug>
" Description: plugin for Psalm, static analyzer for PHP
-call ale#Set('psalm_langserver_executable', 'psalm')
-call ale#Set('psalm_langserver_options', '')
-call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('php_psalm_executable', 'psalm')
+call ale#Set('php_psalm_options', '')
+call ale#Set('php_psalm_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
@@ -12,13 +12,13 @@ function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
endfunction
function! ale_linters#php#psalm#GetCommand(buffer) abort
- return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'psalm_langserver_options'))
+ return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'php_psalm_options'))
endfunction
call ale#linter#Define('php', {
\ 'name': 'psalm',
\ 'lsp': 'stdio',
-\ 'executable': {b -> ale#node#FindExecutable(b, 'psalm_langserver', [
+\ 'executable': {b -> ale#node#FindExecutable(b, 'php_psalm', [
\ 'vendor/bin/psalm',
\ ])},
\ 'command': function('ale_linters#php#psalm#GetCommand'),
diff --git a/ale_linters/puppet/puppet.vim b/ale_linters/puppet/puppet.vim
index ae648615..59228dc8 100644
--- a/ale_linters/puppet/puppet.vim
+++ b/ale_linters/puppet/puppet.vim
@@ -8,13 +8,15 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
" Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12
" Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5"
" Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5)
- let l:pattern = '^Error: .*: \(.\+\) \((file:\|at\) .\+\.pp\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)'
+ " Error: Illegal attempt to assign to 'a Name'. Not an assignable reference (file: /tmp/modules/waffles/manifests/syrup.pp, line: 5, column: 11)
+ " Error: Could not parse for environment production: Syntax error at end of input (file: /tmp/modules/bob/manifests/init.pp)
+ let l:pattern = '^Error:\%(.*:\)\? \(.\+\) \((file:\|at\) .\+\.pp\(\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)\|)$\)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
- \ 'lnum': l:match[4] + 0,
- \ 'col': l:match[6] + 0,
+ \ 'lnum': l:match[5] + 0,
+ \ 'col': l:match[7] + 0,
\ 'text': l:match[1],
\})
endfor
diff --git a/ale_linters/pyrex/cython.vim b/ale_linters/pyrex/cython.vim
index 84382ba1..247c3060 100644
--- a/ale_linters/pyrex/cython.vim
+++ b/ale_linters/pyrex/cython.vim
@@ -6,9 +6,7 @@ call ale#Set('pyrex_cython_executable', 'cython')
call ale#Set('pyrex_cython_options', '--warning-extra')
function! ale_linters#pyrex#cython#GetCommand(buffer) abort
- let l:local_dir = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
-
- return '%e --working ' . l:local_dir . ' --include-dir ' . l:local_dir
+ return '%e --working %s:h --include-dir %s:h'
\ . ale#Pad(ale#Var(a:buffer, 'pyrex_cython_options'))
\ . ' --output-file ' . g:ale#util#nul_file . ' %t'
endfunction
diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim
index e2e7b743..fc4ab692 100644
--- a/ale_linters/python/flake8.vim
+++ b/ale_linters/python/flake8.vim
@@ -4,7 +4,7 @@
call ale#Set('python_flake8_executable', 'flake8')
call ale#Set('python_flake8_options', '')
call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0))
-call ale#Set('python_flake8_change_directory', 1)
+call ale#Set('python_flake8_change_directory', 'project')
call ale#Set('python_flake8_auto_pipenv', 0)
function! s:UsingModule(buffer) abort
@@ -38,10 +38,30 @@ function! ale_linters#python#flake8#RunWithVersionCheck(buffer) abort
\)
endfunction
+function! ale_linters#python#flake8#GetCdString(buffer) abort
+ let l:change_directory = ale#Var(a:buffer, 'python_flake8_change_directory')
+ let l:cd_string = ''
+
+ if l:change_directory is# 'project'
+ let l:project_root = ale#python#FindProjectRootIni(a:buffer)
+
+ if !empty(l:project_root)
+ let l:cd_string = ale#path#CdString(l:project_root)
+ endif
+ endif
+
+ if (l:change_directory is# 'project' && empty(l:cd_string))
+ \|| l:change_directory is# 1
+ \|| l:change_directory is# 'file'
+ let l:cd_string = ale#path#BufferCdString(a:buffer)
+ endif
+
+ return l:cd_string
+endfunction
+
function! ale_linters#python#flake8#GetCommand(buffer, version) abort
- let l:cd_string = ale#Var(a:buffer, 'python_flake8_change_directory')
- \ ? ale#path#BufferCdString(a:buffer)
- \ : ''
+ let l:cd_string = ale_linters#python#flake8#GetCdString(a:buffer)
+
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv$'
diff --git a/ale_linters/python/pydocstyle.vim b/ale_linters/python/pydocstyle.vim
index 3901db4d..69ae3807 100644
--- a/ale_linters/python/pydocstyle.vim
+++ b/ale_linters/python/pydocstyle.vim
@@ -16,17 +16,15 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
endfunction
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
- let l:dir = fnamemodify(bufname(a:buffer), ':p:h')
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
-
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run pydocstyle'
\ : ''
- return ale#path#CdString(l:dir)
+ return ale#path#BufferCdString(a:buffer)
\ . ale#Escape(l:executable) . l:exec_args
- \ . ' ' . ale#Var(a:buffer, 'python_pydocstyle_options')
- \ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:t'))
+ \ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options'))
+ \ . ' %s:t'
endfunction
function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort
diff --git a/ale_linters/python/pyright.vim b/ale_linters/python/pyright.vim
new file mode 100644
index 00000000..422ecd61
--- /dev/null
+++ b/ale_linters/python/pyright.vim
@@ -0,0 +1,43 @@
+call ale#Set('python_pyright_executable', 'pyright-langserver')
+call ale#Set('python_pyright_config', {})
+
+function! ale_linters#python#pyright#GetConfig(buffer) abort
+ let l:config = deepcopy(ale#Var(a:buffer, 'python_pyright_config'))
+
+ if !has_key(l:config, 'python')
+ let l:config.python = {}
+ endif
+
+ if type(l:config.python) is v:t_dict
+ " Automatically detect the virtualenv path and use it.
+ if !has_key(l:config.python, 'venvPath')
+ let l:venv = ale#python#FindVirtualenv(a:buffer)
+
+ if !empty(l:venv)
+ let l:config.python.venvPath = l:venv
+ endif
+ endif
+
+ " Automatically use the version of Python in virtualenv.
+ if type(get(l:config.python, 'venvPath')) is v:t_string
+ \&& !empty(l:config.python.venvPath)
+ \&& !has_key(l:config.python, 'pythonPath')
+ let l:config.python.pythonPath = ale#path#Simplify(
+ \ l:config.python.venvPath
+ \ . (has('win32') ? '/Scripts/python' : '/bin/python')
+ \)
+ endif
+ endif
+
+ return l:config
+endfunction
+
+call ale#linter#Define('python', {
+\ 'name': 'pyright',
+\ 'lsp': 'stdio',
+\ 'executable': {b -> ale#Var(b, 'python_pyright_executable')},
+\ 'command': '%e --stdio',
+\ 'project_root': function('ale#python#FindProjectRoot'),
+\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
+\ 'lsp_config': function('ale_linters#python#pyright#GetConfig'),
+\})
diff --git a/ale_linters/reason/ols.vim b/ale_linters/reason/ols.vim
index 66137e1b..9fbd9b4f 100644
--- a/ale_linters/reason/ols.vim
+++ b/ale_linters/reason/ols.vim
@@ -9,6 +9,6 @@ call ale#linter#Define('reason', {
\ 'lsp': 'stdio',
\ 'executable': function('ale#handlers#ols#GetExecutable'),
\ 'command': function('ale#handlers#ols#GetCommand'),
-\ 'language_callback': 'ale#handlers#ols#GetLanguage',
+\ 'language': function('ale#handlers#ols#GetLanguage'),
\ 'project_root': function('ale#handlers#ols#GetProjectRoot'),
\})
diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim
index 410ed0ea..483806a6 100644
--- a/ale_linters/ruby/rubocop.vim
+++ b/ale_linters/ruby/rubocop.vim
@@ -10,7 +10,7 @@ function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
- \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
+ \ . ' --stdin %s'
endfunction
function! ale_linters#ruby#rubocop#GetType(severity) abort
diff --git a/ale_linters/ruby/standardrb.vim b/ale_linters/ruby/standardrb.vim
index f751e803..6ccfd2d6 100644
--- a/ale_linters/ruby/standardrb.vim
+++ b/ale_linters/ruby/standardrb.vim
@@ -11,7 +11,7 @@ function! ale_linters#ruby#standardrb#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'standardrb')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'ruby_standardrb_options')
- \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
+ \ . ' --stdin %s'
endfunction
" standardrb is based on RuboCop so the callback is the same
diff --git a/ale_linters/rust/analyzer.vim b/ale_linters/rust/analyzer.vim
new file mode 100644
index 00000000..3666ec03
--- /dev/null
+++ b/ale_linters/rust/analyzer.vim
@@ -0,0 +1,24 @@
+" Author: Jon Gjengset <jon@thesquareplanet.com>
+" Description: The next generation language server for Rust
+
+call ale#Set('rust_analyzer_executable', 'rust-analyzer')
+call ale#Set('rust_analyzer_config', {})
+
+function! ale_linters#rust#analyzer#GetCommand(buffer) abort
+ return '%e'
+endfunction
+
+function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort
+ let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
+
+ return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : ''
+endfunction
+
+call ale#linter#Define('rust', {
+\ 'name': 'analyzer',
+\ 'lsp': 'stdio',
+\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')},
+\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')},
+\ 'command': function('ale_linters#rust#analyzer#GetCommand'),
+\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'),
+\})
diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim
index 99178585..3407abed 100644
--- a/ale_linters/rust/cargo.vim
+++ b/ale_linters/rust/cargo.vim
@@ -11,6 +11,7 @@ call ale#Set('rust_cargo_default_feature_behavior', 'default')
call ale#Set('rust_cargo_include_features', '')
call ale#Set('rust_cargo_use_clippy', 0)
call ale#Set('rust_cargo_clippy_options', '')
+call ale#Set('rust_cargo_target_dir', '')
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
@@ -31,6 +32,9 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort
\ && ale#semver#GTE(a:version, [0, 22, 0])
let l:use_tests = ale#Var(a:buffer, 'rust_cargo_check_tests')
\ && ale#semver#GTE(a:version, [0, 22, 0])
+ let l:target_dir = ale#Var(a:buffer, 'rust_cargo_target_dir')
+ let l:use_target_dir = !empty(l:target_dir)
+ \ && ale#semver#GTE(a:version, [0, 17, 0])
let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features')
@@ -82,6 +86,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort
\ . (l:use_all_targets ? ' --all-targets' : '')
\ . (l:use_examples ? ' --examples' : '')
\ . (l:use_tests ? ' --tests' : '')
+ \ . (l:use_target_dir ? (' --target-dir ' . ale#Escape(l:target_dir)) : '')
\ . ' --frozen --message-format=json -q'
\ . l:default_feature
\ . l:include_features
diff --git a/ale_linters/scala/metals.vim b/ale_linters/scala/metals.vim
index f78c7119..da9e855d 100644
--- a/ale_linters/scala/metals.vim
+++ b/ale_linters/scala/metals.vim
@@ -32,6 +32,8 @@ function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
\)
endif
endfor
+
+ return ''
endfunction
function! ale_linters#scala#metals#GetCommand(buffer) abort
diff --git a/ale_linters/sh/bashate.vim b/ale_linters/sh/bashate.vim
new file mode 100644
index 00000000..3cd84245
--- /dev/null
+++ b/ale_linters/sh/bashate.vim
@@ -0,0 +1,43 @@
+" Author: hsanson <hsanson@gmail.com>
+" Description: Lints sh files using bashate
+" URL: https://github.com/openstack/bashate
+
+call ale#Set('sh_bashate_executable', 'bashate')
+call ale#Set('sh_bashate_options', '')
+
+function! ale_linters#sh#bashate#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'sh_bashate_executable')
+endfunction
+
+function! ale_linters#sh#bashate#GetCommand(buffer) abort
+ let l:options = ale#Var(a:buffer, 'sh_bashate_options')
+ let l:executable = ale_linters#sh#bashate#GetExecutable(a:buffer)
+
+ return ale#Escape(l:executable) . ' ' . l:options . ' ' . '%t'
+endfunction
+
+function! ale_linters#sh#bashate#Handle(buffer, lines) abort
+ " Matches patterns line the following:
+ "
+ " /path/to/script/file:694:1: E003 Indent not multiple of 4
+ let l:pattern = ':\(\d\+\):\(\d\+\): \(.*\)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': str2nr(l:match[1]),
+ \ 'col': str2nr(l:match[2]),
+ \ 'text': l:match[3],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('sh', {
+\ 'name': 'bashate',
+\ 'output_stream': 'stdout',
+\ 'executable': function('ale_linters#sh#bashate#GetExecutable'),
+\ 'command': function('ale_linters#sh#bashate#GetCommand'),
+\ 'callback': 'ale_linters#sh#bashate#Handle',
+\})
diff --git a/ale_linters/sh/shell.vim b/ale_linters/sh/shell.vim
index 171fe64e..73ab3608 100644
--- a/ale_linters/sh/shell.vim
+++ b/ale_linters/sh/shell.vim
@@ -1,5 +1,5 @@
" Author: w0rp <devw0rp@gmail.com>
-" Description: Lints sh files using bash -n
+" Description: Lints shell files by invoking the shell with -n
" Backwards compatibility
if exists('g:ale_linters_sh_shell_default_shell')
diff --git a/ale_linters/sh/shellcheck.vim b/ale_linters/sh/shellcheck.vim
index 1d8b6096..d9945126 100644
--- a/ale_linters/sh/shellcheck.vim
+++ b/ale_linters/sh/shellcheck.vim
@@ -1,107 +1,4 @@
" Author: w0rp <devw0rp@gmail.com>
-" Description: This file adds support for using the shellcheck linter with
-" shell scripts.
+" Description: shellcheck linter for shell scripts.
-" This global variable can be set with a string of comma-separated error
-" codes to exclude from shellcheck. For example:
-"
-" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
-call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', ''))
-call ale#Set('sh_shellcheck_executable', 'shellcheck')
-call ale#Set('sh_shellcheck_dialect', 'auto')
-call ale#Set('sh_shellcheck_options', '')
-call ale#Set('sh_shellcheck_change_directory', 1)
-
-function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort
- let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
-
- if !empty(l:shell_type)
- " Use the dash dialect for /bin/ash, etc.
- if l:shell_type is# 'ash'
- return 'dash'
- endif
-
- return l:shell_type
- endif
-
- " If there's no hashbang, try using Vim's buffer variables.
- if getbufvar(a:buffer, 'is_bash', 0)
- return 'bash'
- elseif getbufvar(a:buffer, 'is_sh', 0)
- return 'sh'
- elseif getbufvar(a:buffer, 'is_kornshell', 0)
- return 'ksh'
- endif
-
- return ''
-endfunction
-
-function! ale_linters#sh#shellcheck#GetCommand(buffer, version) abort
- let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
- let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
- let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
- let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : ''
- let l:cd_string = ale#Var(a:buffer, 'sh_shellcheck_change_directory')
- \ ? ale#path#BufferCdString(a:buffer)
- \ : ''
-
- if l:dialect is# 'auto'
- let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
- endif
-
- return l:cd_string
- \ . '%e'
- \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
- \ . (!empty(l:options) ? ' ' . l:options : '')
- \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
- \ . l:external_option
- \ . ' -f gcc -'
-endfunction
-
-function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
- let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
- let l:output = []
-
- for l:match in ale#util#GetMatches(a:lines, l:pattern)
- if l:match[4] is# 'error'
- let l:type = 'E'
- elseif l:match[4] is# 'note'
- let l:type = 'I'
- else
- let l:type = 'W'
- endif
-
- let l:item = {
- \ 'lnum': str2nr(l:match[2]),
- \ 'type': l:type,
- \ 'text': l:match[5],
- \ 'code': l:match[6],
- \}
-
- if !empty(l:match[3])
- let l:item.col = str2nr(l:match[3])
- endif
-
- " If the filename is something like <stdin>, <nofile> or -, then
- " this is an error for the file we checked.
- if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
- let l:item['filename'] = l:match[1]
- endif
-
- call add(l:output, l:item)
- endfor
-
- return l:output
-endfunction
-
-call ale#linter#Define('sh', {
-\ 'name': 'shellcheck',
-\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')},
-\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
-\ buffer,
-\ ale#Var(buffer, 'sh_shellcheck_executable'),
-\ '%e --version',
-\ function('ale_linters#sh#shellcheck#GetCommand'),
-\ )},
-\ 'callback': 'ale_linters#sh#shellcheck#Handle',
-\})
+call ale#handlers#shellcheck#DefineLinter('sh')
diff --git a/ale_linters/sql/sqllint.vim b/ale_linters/sql/sqllint.vim
new file mode 100644
index 00000000..78396fe9
--- /dev/null
+++ b/ale_linters/sql/sqllint.vim
@@ -0,0 +1,33 @@
+" ale_linters/sql/sqllint.vim
+" Author: Joe Reynolds <joereynolds952@gmail.co>
+" Description: sql-lint for SQL files.
+" sql-lint can be found at
+" https://www.npmjs.com/package/sql-lint
+" https://github.com/joereynolds/sql-lint
+
+function! ale_linters#sql#sqllint#Handle(buffer, lines) abort
+ " Matches patterns like the following:
+ "
+ " stdin:1 [ER_NO_DB_ERROR] No database selected
+ let l:pattern = '\v^[^:]+:(\d+) (.*)'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col': l:match[2] + 0,
+ \ 'type': l:match[3][0],
+ \ 'text': l:match[0],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('sql', {
+\ 'name': 'sqllint',
+\ 'aliases': ['sql-lint'],
+\ 'executable': 'sql-lint',
+\ 'command': 'sql-lint',
+\ 'callback': 'ale_linters#sql#sqllint#Handle',
+\})
diff --git a/ale_linters/swift/swiftformat.vim b/ale_linters/swift/swiftformat.vim
new file mode 100644
index 00000000..2504511a
--- /dev/null
+++ b/ale_linters/swift/swiftformat.vim
@@ -0,0 +1,62 @@
+" Author: Klaas Pieter Annema <https://github.com/klaaspieter>
+" Description: Support for swift-format https://github.com/apple/swift-format
+
+let s:default_executable = 'swift-format'
+call ale#Set('swift_swiftformat_executable', s:default_executable)
+
+function! ale_linters#swift#swiftformat#UseSwift(buffer) abort
+ let l:swift_config = ale#path#FindNearestFile(a:buffer, 'Package.swift')
+ let l:executable = ale#Var(a:buffer, 'swift_swiftformat_executable')
+
+ return !empty(l:swift_config) && l:executable is# s:default_executable
+endfunction
+
+function! ale_linters#swift#swiftformat#GetExecutable(buffer) abort
+ if ale_linters#swift#swiftformat#UseSwift(a:buffer)
+ return 'swift'
+ endif
+
+ return ale#Var(a:buffer, 'swift_swiftformat_executable')
+endfunction
+
+function! ale_linters#swift#swiftformat#GetCommand(buffer) abort
+ let l:executable = ale_linters#swift#swiftformat#GetExecutable(a:buffer)
+ let l:args = '--mode lint %t'
+
+ if ale_linters#swift#swiftformat#UseSwift(a:buffer)
+ let l:args = 'run swift-format' . ' ' . l:args
+ endif
+
+ return ale#Escape(l:executable) . ' ' . l:args
+endfunction
+
+function! ale_linters#swift#swiftformat#Handle(buffer, lines) abort
+ " Matches lines of the following pattern:
+ "
+ " Sources/main.swift:4:21: warning: [DoNotUseSemicolons]: remove ';' and move the next statement to the new line
+ " Sources/main.swift:3:12: warning: [Spacing]: remove 1 space
+ let l:pattern = '\v^.*:(\d+):(\d+): (\S+) \[(\S+)\]: (.*)$'
+ let l:output = []
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[1] + 0,
+ \ 'col': l:match[2] + 0,
+ \ 'type': l:match[3] is# 'error' ? 'E' : 'W',
+ \ 'code': l:match[4],
+ \ 'text': l:match[5],
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+
+call ale#linter#Define('swift', {
+\ 'name': 'swift-format',
+\ 'executable': function('ale_linters#swift#swiftformat#GetExecutable'),
+\ 'command': function('ale_linters#swift#swiftformat#GetCommand'),
+\ 'output_stream': 'stderr',
+\ 'language': 'swift',
+\ 'callback': 'ale_linters#swift#swiftformat#Handle'
+\})
diff --git a/ale_linters/terraform/terraform_lsp.vim b/ale_linters/terraform/terraform_lsp.vim
new file mode 100644
index 00000000..e2408c15
--- /dev/null
+++ b/ale_linters/terraform/terraform_lsp.vim
@@ -0,0 +1,25 @@
+" Author: OJFord <dev@ojford.com>
+" Description: terraform-lsp integration for ALE (cf. https://github.com/juliosueiras/terraform-lsp)
+
+call ale#Set('terraform_langserver_executable', 'terraform-lsp')
+call ale#Set('terraform_langserver_options', '')
+
+function! ale_linters#terraform#terraform_lsp#GetCommand(buffer) abort
+ return '%e'
+ \ . ale#Pad(ale#Var(a:buffer, 'terraform_langserver_options'))
+endfunction
+
+function! ale_linters#terraform#terraform_lsp#GetProjectRoot(buffer) abort
+ let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
+
+ return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
+endfunction
+
+call ale#linter#Define('terraform', {
+\ 'name': 'terraform_lsp',
+\ 'lsp': 'stdio',
+\ 'executable': {b -> ale#Var(b, 'terraform_langserver_executable')},
+\ 'command': function('ale_linters#terraform#terraform_lsp#GetCommand'),
+\ 'project_root': function('ale_linters#terraform#terraform_lsp#GetProjectRoot'),
+\ 'language': 'terraform',
+\})
diff --git a/ale_linters/verilog/hdl_checker.vim b/ale_linters/verilog/hdl_checker.vim
new file mode 100644
index 00000000..b05d8565
--- /dev/null
+++ b/ale_linters/verilog/hdl_checker.vim
@@ -0,0 +1,5 @@
+" Author: suoto <andre820@gmail.com>
+" Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl
+" or xvhdl. More info on https://github.com/suoto/hdl_checker
+
+call ale#handlers#hdl_checker#DefineLinter('verilog')
diff --git a/ale_linters/verilog/verilator.vim b/ale_linters/verilog/verilator.vim
index 64bb6e41..029dd4c9 100644
--- a/ale_linters/verilog/verilator.vim
+++ b/ale_linters/verilog/verilator.vim
@@ -28,21 +28,30 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort
" %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk
" %Warning-UNUSED: test.v:4: Signal is not used: dout
" %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).
- let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$'
+ " Since version 4.032 (04/2020) verilator linter messages also contain the column number,
+ " and look like:
+ " %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';'
+ "
+ " to stay compatible with old versions of the tool, the column number is
+ " optional in the researched pattern
+ let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
- let l:line = l:match[3] + 0
- let l:type = l:match[1] is# 'Error' ? 'E' : 'W'
- let l:text = l:match[4]
+ let l:item = {
+ \ 'lnum': str2nr(l:match[3]),
+ \ 'text': l:match[5],
+ \ 'type': l:match[1] is# 'Error' ? 'E' : 'W',
+ \}
+
+ if !empty(l:match[4])
+ let l:item.col = str2nr(l:match[4])
+ endif
+
let l:file = l:match[2]
if l:file =~# '_verilator_linted.v'
- call add(l:output, {
- \ 'lnum': l:line,
- \ 'text': l:text,
- \ 'type': l:type,
- \})
+ call add(l:output, l:item)
endif
endfor
diff --git a/ale_linters/verilog/vlog.vim b/ale_linters/verilog/vlog.vim
index 951e2037..45e1977c 100644
--- a/ale_linters/verilog/vlog.vim
+++ b/ale_linters/verilog/vlog.vim
@@ -13,14 +13,15 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort
"Matches patterns like the following:
"** Warning: add.v(7): (vlog-2623) Undefined variable: C.
"** Error: file.v(1): (vlog-13294) Identifier must be declared with a port mode: C.
- let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)'
+ let l:pattern = '^**\s\(\w*\): \([a-zA-Z0-9\-\.\_\/ ]\+\)(\(\d\+\)):\s\+\(.*\)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
- \ 'lnum': l:match[2] + 0,
+ \ 'lnum': l:match[3] + 0,
\ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
- \ 'text': l:match[3],
+ \ 'text': l:match[4],
+ \ 'filename': l:match[2],
\})
endfor
@@ -28,13 +29,14 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort
"** Warning: (vlog-2623) add.v(7): Undefined variable: C.
"** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C.
" let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)'
- let l:pattern = '^**\s\(\w*\):\s\([^)]*)\)[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)'
+ let l:pattern = '^**\s\(\w*\):\s\([^)]*)\) \([a-zA-Z0-9\-\.\_\/ ]\+\)(\(\d\+\)):\s\+\(.*\)'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
- \ 'lnum': l:match[3] + 0,
+ \ 'lnum': l:match[4] + 0,
\ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
- \ 'text': l:match[2] . ' ' . l:match[4],
+ \ 'text': l:match[2] . ' ' . l:match[5],
+ \ 'filename': l:match[3],
\})
endfor
diff --git a/ale_linters/vhdl/hdl_checker.vim b/ale_linters/vhdl/hdl_checker.vim
new file mode 100644
index 00000000..c9d306b3
--- /dev/null
+++ b/ale_linters/vhdl/hdl_checker.vim
@@ -0,0 +1,5 @@
+" Author: suoto <andre820@gmail.com>
+" Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl
+" or xvhdl. More info on https://github.com/suoto/hdl_checker
+
+call ale#handlers#hdl_checker#DefineLinter('vhdl')
diff --git a/ale_linters/vim/vimls.vim b/ale_linters/vim/vimls.vim
new file mode 100644
index 00000000..26014d66
--- /dev/null
+++ b/ale_linters/vim/vimls.vim
@@ -0,0 +1,61 @@
+" Author: Jeffrey Lau - https://github.com/zoonfafer
+" Description: Vim Language Server integration for ALE
+
+call ale#Set('vim_vimls_executable', 'vim-language-server')
+call ale#Set('vim_vimls_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('vim_vimls_config', {})
+
+function! ale_linters#vim#vimls#GetProjectRoot(buffer) abort
+ let l:trigger_file_candidates = [
+ \ '.vimrc',
+ \ 'init.vim',
+ \]
+
+ for l:candidate in l:trigger_file_candidates
+ let l:trigger_file = fnamemodify(bufname(a:buffer), ':t')
+
+ if l:trigger_file is# l:candidate
+ return fnamemodify(
+ \ bufname(a:buffer),
+ \ ':h',
+ \)
+ endif
+ endfor
+
+ let l:trigger_dir_candidates = [
+ \ 'autoload',
+ \ 'plugin',
+ \ '.git',
+ \]
+
+ let l:path_upwards = ale#path#Upwards(fnamemodify(bufname(a:buffer), ':p:h'))
+
+ for l:path in l:path_upwards
+ for l:candidate in l:trigger_dir_candidates
+ let l:trigger_dir = ale#path#Simplify(
+ \ l:path . '/' . l:candidate,
+ \)
+
+ if isdirectory(l:trigger_dir)
+ return fnamemodify(
+ \ l:trigger_dir,
+ \ ':p:h:h',
+ \)
+ endif
+ endfor
+ endfor
+
+ return ''
+endfunction
+
+call ale#linter#Define('vim', {
+\ 'name': 'vimls',
+\ 'lsp': 'stdio',
+\ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')},
+\ 'executable': {b -> ale#node#FindExecutable(b, 'vim_vimls', [
+\ 'node_modules/.bin/vim-language-server',
+\ ])},
+\ 'command': '%e --stdio',
+\ 'language': 'vim',
+\ 'project_root': function('ale_linters#vim#vimls#GetProjectRoot'),
+\})
diff --git a/ale_linters/vim/vint.vim b/ale_linters/vim/vint.vim
index 6b996fa4..f7054ffb 100644
--- a/ale_linters/vim/vint.vim
+++ b/ale_linters/vim/vint.vim
@@ -5,7 +5,7 @@
call ale#Set('vim_vint_show_style_issues', 1)
call ale#Set('vim_vint_executable', 'vint')
let s:enable_neovim = has('nvim') ? ' --enable-neovim' : ''
-let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
+let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})"'
function! ale_linters#vim#vint#GetCommand(buffer, version) abort
let l:can_use_no_color_flag = empty(a:version)
diff --git a/ale_linters/zig/zls.vim b/ale_linters/zig/zls.vim
new file mode 100644
index 00000000..1390f6b1
--- /dev/null
+++ b/ale_linters/zig/zls.vim
@@ -0,0 +1,20 @@
+" Author: CherryMan <skipper308@hotmail.ca>
+" Description: A language server for Zig
+
+call ale#Set('zig_zls_executable', 'zls')
+call ale#Set('zig_zls_config', {})
+
+function! ale_linters#zig#zls#GetProjectRoot(buffer) abort
+ let l:build_rs = ale#path#FindNearestFile(a:buffer, 'build.zig')
+
+ return !empty(l:build_rs) ? fnamemodify(l:build_rs, ':h') : ''
+endfunction
+
+call ale#linter#Define('zig', {
+\ 'name': 'zls',
+\ 'lsp': 'stdio',
+\ 'lsp_config': {b -> ale#Var(b, 'zig_zls_config')},
+\ 'executable': {b -> ale#Var(b, 'zig_zls_executable')},
+\ 'command': '%e',
+\ 'project_root': function('ale_linters#zig#zls#GetProjectRoot'),
+\})