summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-01-27 20:24:26 +0900
committerGitHub <noreply@github.com>2021-01-27 20:24:26 +0900
commitc9f4005820092c7824a35f1d62ae0dc93e474815 (patch)
tree5b7ed8ea60e630d787353921bc47a5f64a201de0
parentcab4280d02f0297ae10ab0611778389c7a5766ae (diff)
parent105bc5569550925af3b5f679145e1a13e0840344 (diff)
downloadale-c9f4005820092c7824a35f1d62ae0dc93e474815.zip
Merge pull request #3425 from pinicarus/custom-dialyzer-options
Custom erlang/dialyzer options
-rw-r--r--ale_linters/erlang/dialyzer.vim12
-rw-r--r--doc/ale-erlang.txt8
-rw-r--r--test/command_callback/test_erlang_dialyzer_command_callback.vader8
3 files changed, 24 insertions, 4 deletions
diff --git a/ale_linters/erlang/dialyzer.vim b/ale_linters/erlang/dialyzer.vim
index 395647a0..a97c9520 100644
--- a/ale_linters/erlang/dialyzer.vim
+++ b/ale_linters/erlang/dialyzer.vim
@@ -3,6 +3,11 @@
let g:ale_erlang_dialyzer_executable =
\ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer')
+let g:ale_erlang_dialyzer_options =
+\ get(g:, 'ale_erlang_dialyzer_options', '-Wunmatched_returns'
+\ . ' -Werror_handling'
+\ . ' -Wrace_conditions'
+\ . ' -Wunderspecs')
let g:ale_erlang_dialyzer_plt_file =
\ get(g:, 'ale_erlang_dialyzer_plt_file', '')
let g:ale_erlang_dialyzer_rebar3_profile =
@@ -47,13 +52,12 @@ function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort
endfunction
function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort
+ let l:options = ale#Var(a:buffer, 'erlang_dialyzer_options')
+
let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer))
\ . ' -n'
\ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer))
- \ . ' -Wunmatched_returns'
- \ . ' -Werror_handling'
- \ . ' -Wrace_conditions'
- \ . ' -Wunderspecs'
+ \ . ' ' . l:options
\ . ' %s'
return l:command
diff --git a/doc/ale-erlang.txt b/doc/ale-erlang.txt
index 9ee9a51d..93ac7915 100644
--- a/doc/ale-erlang.txt
+++ b/doc/ale-erlang.txt
@@ -13,6 +13,14 @@ g:ale_erlang_dialyzer_executable *g:ale_erlang_dialyzer_executable*
This variable can be changed to specify the dialyzer executable.
+g:ale_erlang_dialyzer_options *g:ale_erlang_dialyzer_options*
+ *b:ale_erlang_dialyzer_options*
+ Type: |String|
+ Default: `'-Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspec'`
+
+ This variable can be changed to specify the options to pass to the dialyzer
+ executable.
+
g:ale_erlang_dialyzer_plt_file *g:ale_erlang_dialyzer_plt_file*
*b:ale_erlang_dialyzer_plt_file*
Type: |String|
diff --git a/test/command_callback/test_erlang_dialyzer_command_callback.vader b/test/command_callback/test_erlang_dialyzer_command_callback.vader
index 5e21c053..5e818d7f 100644
--- a/test/command_callback/test_erlang_dialyzer_command_callback.vader
+++ b/test/command_callback/test_erlang_dialyzer_command_callback.vader
@@ -25,6 +25,14 @@ Execute(The command should accept configured executable.):
\ . ' -Wunderspecs'
\ . ' %s'
+Execute(The command should accept configured options.):
+ let b:ale_erlang_dialyzer_options = '-r ' . expand('$HOME')
+ AssertLinter 'dialyzer',
+ \ ale#Escape('dialyzer')
+ \ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt'))
+ \ . ' -r ' . expand('$HOME')
+ \ . ' %s'
+
Execute(The command should accept configured PLT file.):
let b:ale_erlang_dialyzer_plt_file = 'custom-plt'
AssertLinter 'dialyzer',