summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Fish <james@fishcakez.com>2014-11-20 15:57:07 +0000
committerJames Fish <james@fishcakez.com>2014-11-20 16:05:03 +0000
commit16da6d2630d11a8ac9d9c75e3c344415050efac7 (patch)
treea3898305079d74a987cb6f14322bc11bf8d92221 /src
parenta96fddfcde4ab3a71aea01914bd3e7a836db46c0 (diff)
Add options to skip updating plt or success typing
* --update-plt=true|false (false skips updating plt) * --succ-typings=true|false (false skips success typing analysis)
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_dialyzer.erl23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl
index 7c13417..e21b2da 100644
--- a/src/rebar_prv_dialyzer.erl
+++ b/src/rebar_prv_dialyzer.erl
@@ -20,6 +20,8 @@
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) ->
+ Opts = [{update_plt, $u, "update-plt", boolean, "Enable updating the PLT. Default: true"},
+ {succ_typings, $s, "succ-typings", boolean, "Enable success typing analysis. Default: true"}],
State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER},
{module, ?MODULE},
{bare, false},
@@ -27,7 +29,7 @@ init(State) ->
{example, "rebar dialyzer"},
{short_desc, "Run the Dialyzer analyzer on the project."},
{desc, ""},
- {opts, []}])),
+ {opts, Opts}])),
{ok, State1}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
@@ -60,6 +62,15 @@ set_plt_location(State) ->
rebar_state:set(State, plt, Plt).
update_plt(State, Apps, Deps) ->
+ {Args, _} = rebar_state:command_parsed_args(State),
+ case proplists:get_value(update_plt, Args) of
+ false ->
+ {ok, State};
+ _ ->
+ do_update_plt(State, Apps, Deps)
+ end.
+
+do_update_plt(State, Apps, Deps) ->
?INFO("Updating plt...", []),
Files = get_plt_files(State, Apps, Deps),
case read_plt(State) of
@@ -232,6 +243,15 @@ build_plt(State, Files) ->
run_dialyzer(State, Opts).
succ_typings(State, Apps) ->
+ {Args, _} = rebar_state:command_parsed_args(State),
+ case proplists:get_value(succ_typings, Args) of
+ false ->
+ {ok, State};
+ _ ->
+ do_succ_typings(State, Apps)
+ end.
+
+do_succ_typings(State, Apps) ->
?INFO("Doing success typing analysis...", []),
Files = apps_to_files(Apps),
Plt = rebar_state:get(State, plt),
@@ -260,7 +280,6 @@ dialyzer_format_warning(Warning) ->
Warning2 ->
Warning2
end.
-
default_warnings() ->
[error_handling,
unmatched_returns,