summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2011-05-25 12:08:55 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2011-05-25 19:34:10 +0200
commitd7f50169203c21e31f342581683d16c1ae92a498 (patch)
treede3b549406fe7281205ba91d706e0ec11153b377 /src
parent8e8c540347c63d17fc8b292053f91f96c4b538cd (diff)
Abort if dialyze emits warnings
Diffstat (limited to 'src')
-rw-r--r--src/rebar_dialyzer.erl16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/rebar_dialyzer.erl b/src/rebar_dialyzer.erl
index 58fbf23..b624a44 100644
--- a/src/rebar_dialyzer.erl
+++ b/src/rebar_dialyzer.erl
@@ -55,7 +55,7 @@
-include("rebar.hrl").
--type(warning() :: {atom(), {string(), integer()}, any()}).
+-type warning() :: {atom(), {string(), integer()}, any()}.
%% ===================================================================
%% Public API
@@ -84,7 +84,10 @@ dialyze(Config, File) ->
end,
?DEBUG("DialyzerOpts: ~p~n", [DialyzerOpts]),
try dialyzer:run(DialyzerOpts) of
- Warnings -> output_warnings(Warnings)
+ [] ->
+ ok;
+ Warnings ->
+ print_warnings(Warnings)
catch
throw:{dialyzer_error, Reason} ->
?ABORT("~s~n", [Reason])
@@ -116,7 +119,7 @@ dialyze(Config, File) ->
[] ->
?INFO("The built PLT can be found in ~s~n", [Plt]);
_ ->
- output_warnings(Warnings)
+ print_warnings(Warnings)
end,
ok.
@@ -147,11 +150,12 @@ app_dirs(Apps) ->
|| Path <- [code:lib_dir(App) || App <- Apps], erlang:is_list(Path)].
%% @doc Render the warnings on the console.
--spec output_warnings(Warnings::[warning()]) -> 'ok'.
-output_warnings(Warnings) ->
+-spec print_warnings(Warnings::[warning(), ...]) -> no_return().
+print_warnings(Warnings) ->
lists:foreach(fun(Warning) ->
?CONSOLE("~s", [dialyzer:format_warning(Warning)])
- end, Warnings).
+ end, Warnings),
+ ?FAIL.
%% @doc If the plt option is present in rebar.config return its value,
%% otherwise return $HOME/.dialyzer_plt or $REBAR_PLT_DIR/.dialyzer_plt.