mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 11:06:20 +00:00
Abort if dialyze emits warnings
This commit is contained in:
parent
8e8c540347
commit
d7f5016920
1 changed files with 10 additions and 6 deletions
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
-include("rebar.hrl").
|
-include("rebar.hrl").
|
||||||
|
|
||||||
-type(warning() :: {atom(), {string(), integer()}, any()}).
|
-type warning() :: {atom(), {string(), integer()}, any()}.
|
||||||
|
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
%% Public API
|
%% Public API
|
||||||
|
@ -84,7 +84,10 @@ dialyze(Config, File) ->
|
||||||
end,
|
end,
|
||||||
?DEBUG("DialyzerOpts: ~p~n", [DialyzerOpts]),
|
?DEBUG("DialyzerOpts: ~p~n", [DialyzerOpts]),
|
||||||
try dialyzer:run(DialyzerOpts) of
|
try dialyzer:run(DialyzerOpts) of
|
||||||
Warnings -> output_warnings(Warnings)
|
[] ->
|
||||||
|
ok;
|
||||||
|
Warnings ->
|
||||||
|
print_warnings(Warnings)
|
||||||
catch
|
catch
|
||||||
throw:{dialyzer_error, Reason} ->
|
throw:{dialyzer_error, Reason} ->
|
||||||
?ABORT("~s~n", [Reason])
|
?ABORT("~s~n", [Reason])
|
||||||
|
@ -116,7 +119,7 @@ dialyze(Config, File) ->
|
||||||
[] ->
|
[] ->
|
||||||
?INFO("The built PLT can be found in ~s~n", [Plt]);
|
?INFO("The built PLT can be found in ~s~n", [Plt]);
|
||||||
_ ->
|
_ ->
|
||||||
output_warnings(Warnings)
|
print_warnings(Warnings)
|
||||||
end,
|
end,
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
@ -147,11 +150,12 @@ app_dirs(Apps) ->
|
||||||
|| Path <- [code:lib_dir(App) || App <- Apps], erlang:is_list(Path)].
|
|| Path <- [code:lib_dir(App) || App <- Apps], erlang:is_list(Path)].
|
||||||
|
|
||||||
%% @doc Render the warnings on the console.
|
%% @doc Render the warnings on the console.
|
||||||
-spec output_warnings(Warnings::[warning()]) -> 'ok'.
|
-spec print_warnings(Warnings::[warning(), ...]) -> no_return().
|
||||||
output_warnings(Warnings) ->
|
print_warnings(Warnings) ->
|
||||||
lists:foreach(fun(Warning) ->
|
lists:foreach(fun(Warning) ->
|
||||||
?CONSOLE("~s", [dialyzer:format_warning(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,
|
%% @doc If the plt option is present in rebar.config return its value,
|
||||||
%% otherwise return $HOME/.dialyzer_plt or $REBAR_PLT_DIR/.dialyzer_plt.
|
%% otherwise return $HOME/.dialyzer_plt or $REBAR_PLT_DIR/.dialyzer_plt.
|
||||||
|
|
Loading…
Reference in a new issue