summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/c/clangtidy.vim13
-rw-r--r--ale_linters/cpp/clangtidy.vim13
-rw-r--r--ale_linters/elm/elm_ls.vim11
-rw-r--r--ale_linters/php/psalm.vim6
-rw-r--r--ale_linters/ruby/debride.vim42
-rw-r--r--ale_linters/scala/metals.vim48
-rw-r--r--ale_linters/terraform/tflint.vim78
-rw-r--r--ale_linters/verilog/vlog.vim14
-rw-r--r--autoload/ale/completion.vim4
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/nixpkgsfmt.vim12
-rw-r--r--doc/ale-elm.txt14
-rw-r--r--doc/ale-nix.txt24
-rw-r--r--doc/ale-ruby.txt26
-rw-r--r--doc/ale-scala.txt26
-rw-r--r--doc/ale-supported-languages-and-tools.txt5
-rw-r--r--doc/ale.txt8
-rw-r--r--supported-tools.md5
-rwxr-xr-xtest/command_callback/psalm-project/vendor/bin/psalm (renamed from test/command_callback/psalm-project/vendor/bin/psalm-language-server)0
-rw-r--r--test/command_callback/test_c_clang_tidy_command_callback.vader3
-rw-r--r--test/command_callback/test_c_import_paths.vader21
-rw-r--r--test/command_callback/test_clang_tidy_command_callback.vader3
-rw-r--r--test/command_callback/test_psalm_command_callbacks.vader10
-rw-r--r--test/command_callback/test_ruby_debride_command_callback.vader8
-rw-r--r--test/command_callback/test_scala_metals.vader20
-rw-r--r--test/fixers/test_nixpkgsfmt_fixer_callback.vader24
-rw-r--r--test/handler/test_debride_handler.vader27
-rw-r--r--test/handler/test_tflint_handler.vader70
-rw-r--r--test/handler/test_vlog_handler.vader21
29 files changed, 512 insertions, 49 deletions
diff --git a/ale_linters/c/clangtidy.vim b/ale_linters/c/clangtidy.vim
index f998866a..553cc23b 100644
--- a/ale_linters/c/clangtidy.vim
+++ b/ale_linters/c/clangtidy.vim
@@ -19,14 +19,17 @@ call ale#Set('c_clangtidy_options', '')
call ale#Set('c_clangtidy_extra_options', '')
call ale#Set('c_build_dir', '')
-function! ale_linters#c#clangtidy#GetCommand(buffer) abort
+function! ale_linters#c#clangtidy#GetCommand(buffer, output) abort
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
+ let l:options = ''
" Get the extra options if we couldn't find a build directory.
- let l:options = empty(l:build_dir)
- \ ? ale#Var(a:buffer, 'c_clangtidy_options')
- \ : ''
+ if empty(l:build_dir)
+ let l:options = ale#Var(a:buffer, 'c_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
" Get the options to pass directly to clang-tidy
let l:extra_options = ale#Var(a:buffer, 'c_clangtidy_extra_options')
@@ -43,7 +46,7 @@ call ale#linter#Define('c', {
\ 'name': 'clangtidy',
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'c_clangtidy_executable')},
-\ 'command': function('ale_linters#c#clangtidy#GetCommand'),
+\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clangtidy#GetCommand'))},
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\ 'lint_file': 1,
\})
diff --git a/ale_linters/cpp/clangtidy.vim b/ale_linters/cpp/clangtidy.vim
index 085bc332..191b7b07 100644
--- a/ale_linters/cpp/clangtidy.vim
+++ b/ale_linters/cpp/clangtidy.vim
@@ -13,14 +13,17 @@ call ale#Set('cpp_clangtidy_options', '')
call ale#Set('cpp_clangtidy_extra_options', '')
call ale#Set('c_build_dir', '')
-function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
+function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
+ let l:options = ''
" Get the extra options if we couldn't find a build directory.
- let l:options = empty(l:build_dir)
- \ ? ale#Var(a:buffer, 'cpp_clangtidy_options')
- \ : ''
+ if empty(l:build_dir)
+ 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
" Get the options to pass directly to clang-tidy
let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options')
@@ -37,7 +40,7 @@ call ale#linter#Define('cpp', {
\ 'name': 'clangtidy',
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'cpp_clangtidy_executable')},
-\ 'command': function('ale_linters#cpp#clangtidy#GetCommand'),
+\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clangtidy#GetCommand'))},
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\ 'lint_file': 1,
\})
diff --git a/ale_linters/elm/elm_ls.vim b/ale_linters/elm/elm_ls.vim
index 374ef8de..2fa71adb 100644
--- a/ale_linters/elm/elm_ls.vim
+++ b/ale_linters/elm/elm_ls.vim
@@ -3,9 +3,12 @@
call ale#Set('elm_ls_executable', 'elm-language-server')
call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1))
-call ale#Set('elm_ls_elm_path', 'elm')
-call ale#Set('elm_ls_elm_format_path', 'elm-format')
-call ale#Set('elm_ls_elm_test_path', 'elm-test')
+
+" elm-language-server will search for local and global binaries, if empty
+call ale#Set('elm_ls_elm_path', '')
+call ale#Set('elm_ls_elm_format_path', '')
+call ale#Set('elm_ls_elm_test_path', '')
+call ale#Set('elm_ls_elm_analyse_trigger', 'change')
function! elm_ls#GetRootDir(buffer) abort
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
@@ -15,10 +18,10 @@ endfunction
function! elm_ls#GetOptions(buffer) abort
return {
- \ 'runtime': 'node',
\ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
\ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
\ 'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'),
+ \ 'elmAnalyseTrigger': ale#Var(a:buffer, 'elm_ls_elm_analyse_trigger'),
\}
endfunction
diff --git a/ale_linters/php/psalm.vim b/ale_linters/php/psalm.vim
index 3cdb026a..834d0993 100644
--- a/ale_linters/php/psalm.vim
+++ b/ale_linters/php/psalm.vim
@@ -1,7 +1,7 @@
" Author: Matt Brown <https://github.com/muglug>
" Description: plugin for Psalm, static analyzer for PHP
-call ale#Set('psalm_langserver_executable', 'psalm-language-server')
+call ale#Set('psalm_langserver_executable', 'psalm')
call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
@@ -14,8 +14,8 @@ call ale#linter#Define('php', {
\ 'name': 'psalm',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#node#FindExecutable(b, 'psalm_langserver', [
-\ 'vendor/bin/psalm-language-server',
+\ 'vendor/bin/psalm',
\ ])},
-\ 'command': '%e',
+\ 'command': '%e --language-server',
\ 'project_root': function('ale_linters#php#psalm#GetProjectRoot'),
\})
diff --git a/ale_linters/ruby/debride.vim b/ale_linters/ruby/debride.vim
new file mode 100644
index 00000000..3b2cc443
--- /dev/null
+++ b/ale_linters/ruby/debride.vim
@@ -0,0 +1,42 @@
+" Author: Eddie Lebow https://github.com/elebow
+" Description: debride, a dead method detector for Ruby files
+
+call ale#Set('ruby_debride_executable', 'debride')
+call ale#Set('ruby_debride_options', '')
+
+function! ale_linters#ruby#debride#GetCommand(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'ruby_debride_executable')
+
+ return ale#ruby#EscapeExecutable(l:executable, 'debride')
+ \ . ale#Var(a:buffer, 'ruby_debride_options')
+ \ . ' %s'
+endfunction
+
+function! ale_linters#ruby#debride#HandleOutput(buffer, lines) abort
+ let l:output = []
+
+ for l:line in a:lines
+ if l:line !~# '^ '
+ continue
+ endif
+
+ let l:elements = split(l:line)
+ let l:method_name = l:elements[0]
+ let l:lnum = split(l:elements[1], ':')[1]
+
+ call add(l:output, {
+ \ 'lnum': 0 + l:lnum,
+ \ 'text': 'Possible unused method: ' . l:method_name,
+ \ 'type': 'W',
+ \})
+ endfor
+
+ return l:output
+endfunction
+
+call ale#linter#Define('ruby', {
+\ 'name': 'debride',
+\ 'executable': {b -> ale#Var(b, 'ruby_debride_executable')},
+\ 'command': function('ale_linters#ruby#debride#GetCommand'),
+\ 'callback': 'ale_linters#ruby#debride#HandleOutput',
+\})
diff --git a/ale_linters/scala/metals.vim b/ale_linters/scala/metals.vim
new file mode 100644
index 00000000..f78c7119
--- /dev/null
+++ b/ale_linters/scala/metals.vim
@@ -0,0 +1,48 @@
+" Author: Jeffrey Lau - https://github.com/zoonfafer
+" Description: Metals Language Server for Scala https://scalameta.org/metals/
+
+call ale#Set('scala_metals_executable', 'metals-vim')
+call ale#Set('scala_metals_project_root', '')
+
+function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
+ let l:project_root = ale#Var(a:buffer, 'scala_metals_project_root')
+
+ if !empty(l:project_root)
+ return l:project_root
+ endif
+
+ let l:potential_roots = [
+ \ 'build.sc',
+ \ 'build.sbt',
+ \ '.bloop',
+ \ '.metals',
+ \]
+
+ for l:root in l:potential_roots
+ let l:project_root = ale#path#ResolveLocalPath(
+ \ a:buffer,
+ \ l:root,
+ \ ''
+ \)
+
+ if !empty(l:project_root)
+ return fnamemodify(
+ \ l:project_root,
+ \ ':h',
+ \)
+ endif
+ endfor
+endfunction
+
+function! ale_linters#scala#metals#GetCommand(buffer) abort
+ return '%e' . ale#Pad('stdio')
+endfunction
+
+call ale#linter#Define('scala', {
+\ 'name': 'metals',
+\ 'lsp': 'stdio',
+\ 'language': 'scala',
+\ 'executable': {b -> ale#Var(b, 'scala_metals_executable')},
+\ 'command': function('ale_linters#scala#metals#GetCommand'),
+\ 'project_root': function('ale_linters#scala#metals#GetProjectRoot'),
+\})
diff --git a/ale_linters/terraform/tflint.vim b/ale_linters/terraform/tflint.vim
index 6d54a8b1..f57ee6b6 100644
--- a/ale_linters/terraform/tflint.vim
+++ b/ale_linters/terraform/tflint.vim
@@ -9,23 +9,69 @@ call ale#Set('terraform_tflint_executable', 'tflint')
function! ale_linters#terraform#tflint#Handle(buffer, lines) abort
let l:output = []
+ let l:pattern = '\v^(.*):(\d+),(\d+)-(\d+)?,?(\d+): (.{-1,}); (.+)$'
+ let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
- for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
- if l:error.type is# 'ERROR'
- let l:type = 'E'
- elseif l:error.type is# 'NOTICE'
- let l:type = 'I'
- else
- let l:type = 'W'
- endif
-
- call add(l:output, {
- \ 'lnum': l:error.line,
- \ 'text': l:error.message,
- \ 'type': l:type,
- \ 'code': l:error.detector,
- \})
- endfor
+ " This is a rough test for tflint's output format
+ " On versions prior to 0.11 it outputs all errors as a single level list
+ if type(l:json) is v:t_list
+ for l:error in l:json
+ if l:error.type is# 'ERROR'
+ let l:type = 'E'
+ elseif l:error.type is# 'NOTICE'
+ let l:type = 'I'
+ else
+ let l:type = 'W'
+ endif
+
+ call add(l:output, {
+ \ 'lnum': l:error.line,
+ \ 'text': l:error.message,
+ \ 'type': l:type,
+ \ 'code': l:error.detector,
+ \})
+ endfor
+ else
+ for l:error in get(l:json, 'errors', [])
+ for l:match in ale#util#GetMatches(l:error.message, [l:pattern])
+ if l:match[4] is# ''
+ let l:match[4] = l:match[2]
+ endif
+
+ call add(l:output, {
+ \ 'filename': l:match[1],
+ \ 'lnum': str2nr(l:match[2]),
+ \ 'col': str2nr(l:match[3]),
+ \ 'end_lnum': str2nr(l:match[4]),
+ \ 'end_col': str2nr(l:match[5]),
+ \ 'text': l:match[7],
+ \ 'code': l:match[6],
+ \ 'type': 'E',
+ \})
+ endfor
+ endfor
+
+ for l:error in get(l:json, 'issues', [])
+ if l:error.rule.severity is# 'ERROR'
+ let l:type = 'E'
+ elseif l:error.rule.severity is# 'NOTICE'
+ let l:type = 'I'
+ else
+ let l:type = 'W'
+ endif
+
+ call add(l:output, {
+ \ 'filename': l:error.range.filename,
+ \ 'lnum': l:error.range.start.line,
+ \ 'col': l:error.range.start.column,
+ \ 'end_lnum': l:error.range.end.line,
+ \ 'end_col': l:error.range.end.column,
+ \ 'text': l:error.message,
+ \ 'code': l:error.rule.name,
+ \ 'type': l:type,
+ \})
+ endfor
+ endif
return l:output
endfunction
diff --git a/ale_linters/verilog/vlog.vim b/ale_linters/verilog/vlog.vim
index 37d21c4c..951e2037 100644
--- a/ale_linters/verilog/vlog.vim
+++ b/ale_linters/verilog/vlog.vim
@@ -24,6 +24,20 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort
\})
endfor
+ "Matches patterns like the following:
+ "** 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\+\(.*\)'
+
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'lnum': l:match[3] + 0,
+ \ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
+ \ 'text': l:match[2] . ' ' . l:match[4],
+ \})
+ endfor
+
return l:output
endfunction
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 177a6acb..a15ca514 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -734,6 +734,10 @@ function! ale#completion#HandleUserData(completed_item) abort
let l:user_data = json_decode(l:user_data_json)
+ if type(l:user_data) isnot v:t_dict
+ return
+ endif
+
for l:code_action in get(l:user_data, 'codeActions', [])
call ale#code_action#HandleCodeAction(l:code_action)
endfor
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 750d2196..2a96a7d6 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -345,6 +345,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['ada'],
\ 'description': 'Format Ada files with gnatpp.',
\ },
+\ 'nixpkgs-fmt': {
+\ 'function': 'ale#fixers#nixpkgsfmt#Fix',
+\ 'suggested_filetypes': ['nix'],
+\ 'description': 'A formatter for Nix code',
+\ },
\}
" Reset the function registry to the default entries.
diff --git a/autoload/ale/fixers/nixpkgsfmt.vim b/autoload/ale/fixers/nixpkgsfmt.vim
new file mode 100644
index 00000000..403ce798
--- /dev/null
+++ b/autoload/ale/fixers/nixpkgsfmt.vim
@@ -0,0 +1,12 @@
+call ale#Set('nix_nixpkgsfmt_executable', 'nixpkgs-fmt')
+call ale#Set('nix_nixpkgsfmt_options', '')
+
+function! ale#fixers#nixpkgsfmt#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'nix_nixpkgsfmt_executable')
+ let l:options = ale#Var(a:buffer, 'nix_nixpkgsfmt_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (empty(l:options) ? '' : ' ' . l:options),
+ \}
+endfunction
diff --git a/doc/ale-elm.txt b/doc/ale-elm.txt
index 823b53e1..b1510241 100644
--- a/doc/ale-elm.txt
+++ b/doc/ale-elm.txt
@@ -50,7 +50,7 @@ g:ale_elm_ls_use_global *g:ale_elm_ls_use_global*
g:ale_elm_ls_elm_path *g:ale_elm_ls_elm_path*
*b:ale_elm_ls_elm_path*
Type: |String|
- Default: `'elm'`
+ Default: `''`
See |ale-integrations-local-executables|
@@ -58,7 +58,7 @@ g:ale_elm_ls_elm_path *g:ale_elm_ls_elm_path*
g:ale_elm_ls_elm_format_path *g:ale_elm_ls_elm_format_path*
*b:ale_elm_ls_elm_format_path*
Type: |String|
- Default: `'elm-format'`
+ Default: `''`
See |ale-integrations-local-executables|
@@ -66,10 +66,18 @@ g:ale_elm_ls_elm_format_path *g:ale_elm_ls_elm_format_path*
g:ale_elm_ls_elm_test_path *g:ale_elm_ls_elm_test_path*
*b:ale_elm_ls_elm_test_path*
Type: |String|
- Default: `'elm-test'`
+ Default: `''`
See |ale-integrations-local-executables|
+
+g:ale_elm_ls_elm_analyse_trigger *g:ale_elm_ls_elm_analyse_trigger*
+ *b:ale_elm_ls_elm_analyse_trigger*
+ Type: |String|
+ Default: `'change'`
+
+ One of 'change', 'save' or 'never'
+
===============================================================================
elm-make *ale-elm-elm-make*
diff --git a/doc/ale-nix.txt b/doc/ale-nix.txt
new file mode 100644
index 00000000..5b2bd6cb
--- /dev/null
+++ b/doc/ale-nix.txt
@@ -0,0 +1,24 @@
+===============================================================================
+ALE Nix Integration *ale-nix-options*
+
+
+===============================================================================
+nixpkgs-fmt *ale-nix-nixpkgs-fmt*
+
+g:ale_nix_nixpkgsfmt_executable *g:ale_nix_nixpkgsfmt_executable*
+ *b:ale_nix_nixpkgsfmt_executable*
+ Type: |String|
+ Default: `'nixpkgs-fmt'`
+
+ This variable sets executable used for nixpkgs-fmt.
+
+g:ale_nix_nixpkgsfmt_options *g:ale_nix_nixpkgsfmt_options*
+ *b:ale_nix_nixpkgsfmt_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be set to pass additional options to the nixpkgs-fmt fixer.
+
+
+===============================================================================
+ vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-ruby.txt b/doc/ale-ruby.txt
index e373ab8e..a27a20b2 100644
--- a/doc/ale-ruby.txt
+++ b/doc/ale-ruby.txt
@@ -21,6 +21,26 @@ g:ale_ruby_brakeman_options *g:ale_ruby_brakeman_options*
The contents of this variable will be passed through to brakeman.
+===============================================================================
+debride *ale-ruby-debride*
+
+g:ale_ruby_debride_executable *g:ale_ruby_debride_executable*
+ *b:ale_ruby_debride_executable*
+ Type: String
+ Default: `'debride'`
+
+ Override the invoked debride binary. Set this to `'bundle'` to invoke
+ `'bundle` `exec` debride'.
+
+
+g:ale_ruby_debride_options *g:ale_ruby_debride_options*
+ *b:ale_ruby_debride_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be changed to modify flags given to debride.
+
+
===============================================================================
rails_best_practices *ale-ruby-rails_best_practices*
@@ -91,7 +111,7 @@ g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options*
Type: |String|
Default: `''`
- This variable can be change to modify flags given to rubocop.
+ This variable can be changed to modify flags given to rubocop.
===============================================================================
@@ -146,7 +166,7 @@ g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options*
Type: |String|
Default: `''`
- This variable can be change to modify flags given to sorbet.
+ This variable can be changed to modify flags given to sorbet.
===============================================================================
@@ -166,7 +186,7 @@ g:ale_ruby_standardrb_options *g:ale_ruby_standardrb_options*
Type: |String|
Default: `''`
- This variable can be change to modify flags given to standardrb.
+ This variable can be changed to modify flags given to standardrb.
===============================================================================
diff --git a/doc/ale-scala.txt b/doc/ale-scala.txt
index ff43cd6c..c9638baf 100644
--- a/doc/ale-scala.txt
+++ b/doc/ale-scala.txt
@@ -3,6 +3,32 @@ ALE Scala Integration *ale-scala-options*
===============================================================================
+metals *ale-scala-metals*
+
+`metals` requires either an SBT project, a Mill project, or a running Bloop
+server.
+
+
+g:ale_scala_metals_executable *g:ale_scala_metals_executable*
+ *b:ale_scala_metals_executable*
+ Type: |String|
+ Default: `'metals-vim'`
+
+ Override the invoked `metals` binary.
+
+
+g:ale_scala_metals_project_root *g:ale_scala_metals_project_root*
+ *b:ale_scala_metals_project_root*
+ Type: |String|
+ Default: `''`
+
+ By default the project root is found by searching upwards for `build.sbt`,
+ `build.sc`, `.bloop` or `.metals`.
+ If the project root is elsewhere, you can override the project root
+ directory.
+
+
+===============================================================================
sbtserver *ale-scala-sbtserver*
`sbtserver` requires a running ^1.1.x sbt shell to connect to. It will attempt
diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt
index a29ea6a3..a5b7c35e 100644
--- a/doc/ale-supported-languages-and-tools.txt
+++ b/doc/ale-supported-languages-and-tools.txt
@@ -124,7 +124,7 @@ Notes:
* `mix`!!
* Elm
* `elm-format`
- * `elm-lsp`
+ * `elm-ls`
* `elm-make`
* Erb
* `erb`
@@ -284,6 +284,7 @@ Notes:
* `nim check`!!
* nix
* `nix-instantiate`
+ * `nixpkgs-fmt`
* nroff
* `alex`!!
* `proselint`
@@ -391,6 +392,7 @@ Notes:
* `rpmlint`
* Ruby
* `brakeman`
+ * `debride`
* `rails_best_practices`!!
* `reek`
* `rubocop`
@@ -409,6 +411,7 @@ Notes:
* `stylelint`
* Scala
* `fsc`
+ * `metals`
* `sbtserver`
* `scalac`
* `scalafmt`
diff --git a/doc/ale.txt b/doc/ale.txt
index b368afd3..01b6181d 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -172,7 +172,7 @@ address to connect to instead. >
call ale#linter#Define('filetype_here', {
\ 'name': 'any_name_you_want',
- \ 'lsp': 'stdio',
+ \ 'lsp': 'socket',
\ 'address': 'servername:1234',
\ 'project_root': '/path/to/root_of_project',
\})
@@ -1709,6 +1709,8 @@ g:ale_virtualtext_cursor *g:ale_virtualtext_cursor*
Type: |Number|
Default: `0`
+ This option only has any effect in NeoVim.
+
When this option is set to `1`, a message will be shown when a cursor is
near a warning or error. ALE will attempt to find the warning or error at a
column nearest to the cursor when the cursor is resting on a line which
@@ -2305,6 +2307,8 @@ documented in additional help files.
mmc...................................|ale-mercury-mmc|
nasm....................................|ale-nasm-options|
nasm..................................|ale-nasm-nasm|
+ nix.....................................|ale-nix-options|
+ nixpkgs-fmt...........................|ale-nix-nixpkgs-fmt|
nroff...................................|ale-nroff-options|
write-good............................|ale-nroff-write-good|
objc....................................|ale-objc-options|
@@ -2395,6 +2399,7 @@ documented in additional help files.
write-good............................|ale-restructuredtext-write-good|
ruby....................................|ale-ruby-options|
brakeman..............................|ale-ruby-brakeman|
+ debride...............................|ale-ruby-debride|
rails_best_practices..................|ale-ruby-rails_best_practices|
reek..................................|ale-ruby-reek|
rubocop...............................|ale-ruby-rubocop|
@@ -2412,6 +2417,7 @@ documented in additional help files.
sasslint..............................|ale-sass-sasslint|
stylelint.............................|ale-sass-stylelint|
scala...................................|ale-scala-options|
+ metals................................|ale-scala-metals|
sbtserver.............................|ale-scala-sbtserver|
scalafmt..............................|ale-scala-scalafmt|
scalastyle............................|ale-scala-scalastyle|
diff --git a/supported-tools.md b/supported-tools.md
index fbe1ef28..226baeaf 100644
--- a/supported-tools.md
+++ b/supported-tools.md
@@ -133,7 +133,7 @@ formatting.
* [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk:
* Elm
* [elm-format](https://github.com/avh4/elm-format)
- * [elm-lsp](https://github.com/antew/elm-lsp)
+ * [elm-ls](https://github.com/elm-tooling/elm-language-server)
* [elm-make](https://github.com/elm/compiler)
* Erb
* [erb](https://apidock.com/ruby/ERB)
@@ -293,6 +293,7 @@ formatting.
* [nim check](https://nim-lang.org/docs/nimc.html) :floppy_disk:
* nix
* [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate)
+ * [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)
* nroff
* [alex](https://github.com/wooorm/alex) :floppy_disk:
* [proselint](http://proselint.com/)
@@ -400,6 +401,7 @@ formatting.
* [rpmlint](https://github.com/rpm-software-management/rpmlint) :warning: (see `:help ale-integration-spec`)
* Ruby
* [brakeman](http://brakemanscanner.org/) :floppy_disk:
+ * [debride](https://github.com/seattlerb/debride) :floppy_disk:
* [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) :floppy_disk:
* [reek](https://github.com/troessner/reek)
* [rubocop](https://github.com/bbatsov/rubocop)
@@ -418,6 +420,7 @@ formatting.
* [stylelint](https://github.com/stylelint/stylelint)
* Scala
* [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html)
+ * [metals](https://scalameta.org/metals/)
* [sbtserver](https://www.scala-sbt.org/1.x/docs/sbt-server.html)
* [scalac](http://scala-lang.org)
* [scalafmt](https://scalameta.org/scalafmt/)
diff --git a/test/command_callback/psalm-project/vendor/bin/psalm-language-server b/test/command_callback/psalm-project/vendor/bin/psalm
index e69de29b..e69de29b 100755
--- a/test/command_callback/psalm-project/vendor/bin/psalm-language-server
+++ b/test/command_callback/psalm-project/vendor/bin/psalm
diff --git a/test/command_callback/test_c_clang_tidy_command_callback.vader b/test/command_callback/test_c_clang_tidy_command_callback.vader
index fa76c66c..5ebbbd45 100644
--- a/test/command_callback/test_c_clang_tidy_command_callback.vader
+++ b/test/command_callback/test_c_clang_tidy_command_callback.vader
@@ -1,4 +1,7 @@
Before:
+ Save g:ale_c_parse_makefile
+ let g:ale_c_parse_makefile = 0
+
call ale#assert#SetUpLinterTest('c', 'clangtidy')
call ale#test#SetFilename('test.c')
diff --git a/test/command_callback/test_c_import_paths.vader b/test/command_callback/test_c_import_paths.vader
index 6c616d89..e6102998 100644
--- a/test/command_callback/test_c_import_paths.vader
+++ b/test/command_callback/test_c_import_paths.vader
@@ -121,6 +121,16 @@ Execute(The C Clang handler should include root directories for projects with .h
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
\ . ' -'
+Execute(The C ClangTidy handler should include 'include' directories for projects with a Makefile):
+ call ale#assert#SetUpLinterTest('c', 'clangtidy')
+ call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
+ let g:ale_c_clangtidy_options = ''
+
+ AssertLinter 'clang-tidy',
+ \ ale#Escape('clang-tidy')
+ \ . ' %s '
+ \ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
+
Execute(The C++ GCC handler should include 'include' directories for projects with a Makefile):
call ale#assert#SetUpLinterTest('cpp', 'gcc')
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
@@ -225,3 +235,14 @@ Execute(The C++ ClangTidy handler should include json folders for projects with
\ ale#Escape('clang-tidy')
\ . ' %s '
\ . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/json_project/build'))
+
+Execute(The C++ ClangTidy handler should include 'include' directories for projects with a Makefile):
+ call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
+ call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
+ let g:ale_cpp_clangtidy_options = ''
+
+ AssertLinter 'clang-tidy',
+ \ ale#Escape('clang-tidy')
+ \ . ' %s '
+ \ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
+
diff --git a/test/command_callback/test_clang_tidy_command_callback.vader b/test/command_callback/test_clang_tidy_command_callback.vader
index 53ae311b..c2d18dea 100644
--- a/test/command_callback/test_clang_tidy_command_callback.vader
+++ b/test/command_callback/test_clang_tidy_command_callback.vader
@@ -1,4 +1,7 @@
Before:
+ Save g:ale_c_parse_makefile
+ let g:ale_c_parse_makefile = 0
+
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
call ale#test#SetFilename('test.cpp')
diff --git a/test/command_callback/test_psalm_command_callbacks.vader b/test/command_callback/test_psalm_command_callbacks.vader
index 33d770c2..74c68d43 100644
--- a/test/command_callback/test_psalm_command_callbacks.vader
+++ b/test/command_callback/test_psalm_command_callbacks.vader
@@ -9,18 +9,18 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
- AssertLinter 'psalm-language-server',
- \ ale#Escape('psalm-language-server')
+ AssertLinter 'psalm',
+ \ ale#Escape('psalm') . ' --language-server'
Execute(Vendor executables should be detected):
call ale#test#SetFilename('psalm-project/test.php')
AssertLinter
- \ ale#path#Simplify(g:dir . '/psalm-project/vendor/bin/psalm-language-server'),
+ \ ale#path#Simplify(g:dir . '/psalm-project/vendor/bin/psalm'),
\ ale#Escape(ale#path#Simplify(
\ g:dir
- \ . '/psalm-project/vendor/bin/psalm-language-server'
- \ ))
+ \ . '/psalm-project/vendor/bin/psalm'
+ \ )) . ' --language-server'
Execute(The project path should be correct for .git directories):
call ale#test#SetFilename('psalm-project/test.php')
diff --git a/test/command_callback/test_ruby_debride_command_callback.vader b/test/command_callback/test_ruby_debride_command_callback.vader
new file mode 100644
index 00000000..f7628432
--- /dev/null
+++ b/test/command_callback/test_ruby_debride_command_callback.vader
@@ -0,0 +1,8 @@
+Before:
+ call ale#assert#SetUpLinterTest('ruby', 'debride')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'debride', ale#Escape('debride') . ' %s'
diff --git a/test/command_callback/test_scala_metals.vader b/test/command_callback/test_scala_metals.vader
new file mode 100644
index 00000000..70e14c1a
--- /dev/null
+++ b/test/command_callback/test_scala_metals.vader
@@ -0,0 +1,20 @@
+" Author: Jeffrey Lau https://github.com/zoonfafer
+" Description: Tests for the Scala Metals linter
+
+Before:
+ call ale#assert#SetUpLinterTest('scala', 'metals')
+
+After:
+ call ale#assert#TearDownLinterTest()
+Execute(should set metals for sbt project with build.sbt):
+ call ale#test#SetFilename('../scala_fixtures/valid_sbt_project/Main.scala')
+ AssertLSPLanguage 'scala'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../scala_fixtures/valid_sbt_project')
+Execute(should not set metals for sbt project without build.sbt):
+ call ale#test#SetFilename('../scala_fixtures/invalid_sbt_project/Main.scala')
+ AssertLSPLanguage 'scala'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ''
diff --git a/test/fixers/test_nixpkgsfmt_fixer_callback.vader b/test/fixers/test_nixpkgsfmt_fixer_callback.vader
new file mode 100644
index 00000000..0065f77b
--- /dev/null
+++ b/test/fixers/test_nixpkgsfmt_fixer_callback.vader
@@ -0,0 +1,24 @@
+Before:
+ Save g:ale_nix_nixpkgsfmt_executable
+ Save g:ale_nix_nixpkgsfmt_options
+
+After:
+ Restore
+
+Execute(The nixpkgs-fmt callback should return the correct default values):
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('nixpkgs-fmt')
+ \ },
+ \ ale#fixers#nixpkgsfmt#Fix(bufnr(''))
+
+Execute(The nixpkgs-fmt executable and options should be configurable):
+ let g:ale_nix_nixpkgsfmt_executable = '/path/to/nixpkgs-fmt'
+ let g:ale_nix_nixpkgsfmt_options = '-h'
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('/path/to/nixpkgs-fmt')
+ \ . ' -h',
+ \ },
+ \ ale#fixers#nixpkgsfmt#Fix(bufnr(''))
diff --git a/test/handler/test_debride_handler.vader b/test/handler/test_debride_handler.vader
new file mode 100644
index 00000000..62851468
--- /dev/null
+++ b/test/handler/test_debride_handler.vader
@@ -0,0 +1,27 @@
+Before:
+ runtime ale_linters/ruby/debride.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The debride linter parses output correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 2,
+ \ 'text': 'Possible unused method: image_tags',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 7,
+ \ 'text': 'Possible unused method: not_deleted',
+ \ 'type': 'W',
+ \ }
+ \ ],
+ \ ale_linters#ruby#debride#HandleOutput(0, [
+ \ 'These methods MIGHT not be called:',
+ \ '',
+ \ 'Image',
+ \ ' image_tags app/models/image.rb:2',
+ \ ' not_deleted app/models/image.rb:7'
+ \])
diff --git a/test/handler/test_tflint_handler.vader b/test/handler/test_tflint_handler.vader
index 099d0926..6b8173af 100644
--- a/test/handler/test_tflint_handler.vader
+++ b/test/handler/test_tflint_handler.vader
@@ -4,7 +4,7 @@ Before:
After:
call ale#linter#Reset()
-Execute(The tflint handler should parse items correctly):
+Execute(The tflint handler should parse items correctly for pre 0.11):
AssertEqual
\ [
\ {
@@ -29,3 +29,71 @@ Execute(The tflint handler should parse items correctly):
\ ale_linters#terraform#tflint#Handle(123, [
\ '[ { "detector": "aws_db_instance_readable_password", "type": "WARNING", "message": "be warned, traveller", "line": 12, "file": "github.com/wata727/example-module/aws_db_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_db_instance_readable_password.md" }, { "detector": "aws_elasticache_cluster_invalid_type", "type": "ERROR", "message": "error message", "line": 9, "file": "github.com/wata727/example-module/aws_elasticache_cluster.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_elasticache_cluster_invalid_type.md" }, { "detector": "aws_instance_not_specified_iam_profile", "type": "NOTICE", "message": "just so ya know", "line": 5, "file": "github.com/wata727/example-module/aws_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_instance_not_specified_iam_profile.md" } ]'
\ ])
+
+Execute(The tflint handler should parse items correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_instance.tf',
+ \ 'lnum': 1,
+ \ 'col': 30,
+ \ 'end_lnum': 2,
+ \ 'end_col': 1,
+ \ 'text': 'A block definition must have block content delimited by "{" and "}", starting on the same line as the block header.',
+ \ 'code': 'Invalid block definition',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_instance.tf',
+ \ 'lnum': 2,
+ \ 'col': 3,
+ \ 'end_lnum': 2,
+ \ 'end_col': 6,
+ \ 'text': 'An argument named "ami" is not expected here.',
+ \ 'code': 'Unsupported argument',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_instance.tf',
+ \ 'lnum': 3,
+ \ 'col': 3,
+ \ 'end_lnum': 1,
+ \ 'end_col': 6,
+ \ 'text': 'An argument named "instance_type" is not expected here.',
+ \ 'code': 'Unsupported argument',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_db_instance.tf',
+ \ 'lnum': 12,
+ \ 'col': 11,
+ \ 'end_lnum': 12,
+ \ 'end_col': 21,
+ \ 'text': 'be warned, traveller',
+ \ 'code': 'aws_db_instance_readable_password',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_elasticache_cluster.tf',
+ \ 'lnum': 9,
+ \ 'col': 29,
+ \ 'end_lnum': 9,
+ \ 'end_col': 29,
+ \ 'text': 'error message',
+ \ 'code': 'aws_elasticache_cluster_invalid_type',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_instance.tf',
+ \ 'lnum': 5,
+ \ 'col': 15,
+ \ 'end_lnum': 5,
+ \ 'end_col': 25,
+ \ 'text': 'just so ya know',
+ \ 'code': 'aws_instance_not_specified_iam_profile',
+ \ 'type': 'I',
+ \ },
+ \ ],
+ \ ale_linters#terraform#tflint#Handle(123, [
+ \ '{"issues":[{"rule":{"name":"aws_db_instance_readable_password","severity":"WARNING","link":"https://github.com/wata727/tflint/blob/master/docs/aws_db_instance_readable_password.md"},"message":"be warned, traveller","range":{"filename":"github.com/wata727/example-module/aws_db_instance.tf","start":{"line":12,"column":11},"end":{"line":12,"column":21},"callers":[]}},{"rule":{"name":"aws_elasticache_cluster_invalid_type","severity":"ERROR","link":"https://github.com/wata727/tflint/blob/master/docs/aws_elasticache_cluster_invalid_type.md"},"message":"error message","range":{"filename":"github.com/wata727/example-module/aws_elasticache_cluster.tf","start":{"line":9,"column":29},"end":{"line":9,"column":29},"callers":[]}},{"rule":{"name":"aws_instance_not_specified_iam_profile","severity":"NOTICE","link":"https://github.com/wata727/tflint/blob/master/docs/aws_instance_not_specified_iam_profile.md"},"message":"just so ya know","range":{"filename":"github.com/wata727/example-module/aws_instance.tf","start":{"line":5,"column":15},"end":{"line":5,"column":25},"callers":[]}}],"errors":[{"message":"github.com/wata727/example-module/aws_instance.tf:1,30-2,1: Invalid block definition; A block definition must have block content delimited by \"{\" and \"}\", starting on the same line as the block header."},{"message":"github.com/wata727/example-module/aws_instance.tf:2,3-6: Unsupported argument; An argument named \"ami\" is not expected here."},{"message":"github.com/wata727/example-module/aws_instance.tf:3,3-16: Unsupported argument; An argument named \"instance_type\" is not expected here."}]}'
+ \ ])
diff --git a/test/handler/test_vlog_handler.vader b/test/handler/test_vlog_handler.vader
index a70665db..daf3cdcf 100644
--- a/test/handler/test_vlog_handler.vader
+++ b/test/handler/test_vlog_handler.vader
@@ -4,7 +4,7 @@ Before:
After:
call ale#linter#Reset()
-Execute(The vlog handler should parse lines correctly):
+Execute(The vlog handler should parse old-style lines correctly):
AssertEqual
\ [
\ {
@@ -22,3 +22,22 @@ Execute(The vlog handler should parse lines correctly):
\ '** Warning: add.v(7): (vlog-2623) Undefined variable: C.',
\ '** Error: file.v(1): (vlog-13294) Identifier must be declared with a port mode: C.',
\ ])
+
+Execute(The vlog handler should parse new-style lines correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 7,
+ \ 'type': 'W',
+ \ 'text': '(vlog-2623) Undefined variable: C.'
+ \ },
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.'
+ \ },
+ \ ],
+ \ ale_linters#verilog#vlog#Handle(bufnr(''), [
+ \ '** Warning: (vlog-2623) add.v(7): Undefined variable: C.',
+ \ '** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C.',
+ \ ])