summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Sloughter <tristan.sloughter@gmail.com>2015-02-15 21:30:53 -0600
committerTristan Sloughter <tristan.sloughter@gmail.com>2015-02-15 21:30:53 -0600
commit63a765f1b0533b8ca036c29abfed29239b5d52f3 (patch)
tree9448eef0b47cde1a72a5b9e2909068e1c02d9670
parentdcab8baca0d6e2baad6c42d758571e4da619894a (diff)
parent4b8e9db4cae9971a27a6e042a43c61db1db60f18 (diff)
Merge pull request #152 from fishcakez/dialyzer_plt_warnings
Fix {dialyzer_plt_warnings, false}
-rw-r--r--src/rebar_prv_dialyzer.erl34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/rebar_prv_dialyzer.erl b/src/rebar_prv_dialyzer.erl
index 1707535..bcba36a 100644
--- a/src/rebar_prv_dialyzer.erl
+++ b/src/rebar_prv_dialyzer.erl
@@ -352,7 +352,7 @@ succ_typings(State, Plt, Apps) ->
{Args, _} = rebar_state:command_parsed_args(State),
case proplists:get_value(succ_typings, Args) of
false ->
- {ok, State};
+ {0, State};
_ ->
do_succ_typings(State, Plt, Apps)
end.
@@ -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].