summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_prv_dialyzer.erl32
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].