diff options
author | James Fish <james@fishcakez.com> | 2015-02-14 18:09:30 +0000 |
---|---|---|
committer | James Fish <james@fishcakez.com> | 2015-02-14 18:12:49 +0000 |
commit | cede33a8f9d37de8c5a2617ffc1c680e46333eef (patch) | |
tree | a2be5d523be333a660756e949227417b80d3512f | |
parent | dcab8baca0d6e2baad6c42d758571e4da619894a (diff) |
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.
-rw-r--r-- | src/rebar_prv_dialyzer.erl | 32 |
1 files changed, 26 insertions, 6 deletions
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]. |