From cede33a8f9d37de8c5a2617ffc1c680e46333eef Mon Sep 17 00:00:00 2001 From: James Fish Date: Sat, 14 Feb 2015 18:09:30 +0000 Subject: Fix {dialyzer_plt_warnings, false} returning warnings When dialyzer_plt_warnings is false no warnings should be returned when updating a PLT. Previously any callgraph warnings would be returned when updating a PLT regardless of the get_warnings option. --- src/rebar_prv_dialyzer.erl | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl index 1707535..be38d98 100644 --- a/src/rebar_prv_dialyzer.erl +++ b/src/rebar_prv_dialyzer.erl @@ -377,12 +377,20 @@ app_to_files(App) -> Files. run_dialyzer(State, Opts) -> - WarningsList = rebar_state:get(State, dialyzer_warnings, default_warnings()), - Opts2 = [{warnings, WarningsList} | Opts], - {Unknowns, Warnings} = format_warnings(dialyzer:run(Opts2)), - _ = [?CONSOLE("~s", [Unknown]) || Unknown <- Unknowns], - _ = [?CONSOLE("~s", [Warning]) || Warning <- Warnings], - {length(Warnings), State}. + %% dialyzer may return callgraph warnings when get_warnings is false + case proplists:get_bool(get_warnings, Opts) of + true -> + WarningsList = rebar_state:get(State, dialyzer_warnings, + default_warnings()), + Opts2 = [{warnings, WarningsList} | Opts], + {Unknowns, Warnings} = format_warnings(dialyzer:run(Opts2)), + _ = [?CONSOLE("~s", [Unknown]) || Unknown <- Unknowns], + _ = [?CONSOLE("~s", [Warning]) || Warning <- Warnings], + {length(Warnings), State}; + false -> + _ = dialyzer:run([{warnings, no_warnings()} | Opts]), + {0, State} + end. format_warnings(Warnings) -> format_warnings(Warnings, [], []). @@ -404,3 +412,15 @@ default_warnings() -> [error_handling, unmatched_returns, underspecs]. + +no_warnings() -> + [no_return, + no_unused, + no_improper_lists, + no_fun_app, + no_match, + no_opaque, + no_fail_call, + no_contracts, + no_behaviours, + no_undefined_callbacks]. -- cgit v1.1