Browse Source

Merge pull request #2187 from kpy3/add-statistics-opt-to-dialyzer

Add `--statistics` option to dialyzer command
pull/2190/head
Fred Hebert 5 years ago
committed by GitHub
parent
commit
d1af74d6b1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions
  1. +11
    -2
      src/rebar_prv_dialyzer.erl
  2. +2
    -1
      test/rebar_dialyzer_SUITE.erl

+ 11
- 2
src/rebar_prv_dialyzer.erl View File

@ -27,7 +27,8 @@ init(State) ->
{base_plt_location, undefined, "base-plt-location", string, "The location of base PLT file, defaults to $HOME/.cache/rebar3"}, {base_plt_location, undefined, "base-plt-location", string, "The location of base PLT file, defaults to $HOME/.cache/rebar3"},
{plt_location, undefined, "plt-location", string, "The location of the PLT file, defaults to the profile's base directory"}, {plt_location, undefined, "plt-location", string, "The location of the PLT file, defaults to the profile's base directory"},
{plt_prefix, undefined, "plt-prefix", string, "The prefix to the PLT file, defaults to \"rebar3\"" }, {plt_prefix, undefined, "plt-prefix", string, "The prefix to the PLT file, defaults to \"rebar3\"" },
{base_plt_prefix, undefined, "base-plt-prefix", string, "The prefix to the base PLT file, defaults to \"rebar3\"" }],
{base_plt_prefix, undefined, "base-plt-prefix", string, "The prefix to the base PLT file, defaults to \"rebar3\"" },
{statistics, undefined, "statistics", boolean, "Print information about the progress of execution. Default: false" }],
State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER}, State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER},
{module, ?MODULE}, {module, ?MODULE},
{bare, true}, {bare, true},
@ -481,12 +482,20 @@ proj_files(State) ->
get_files(State, Apps, PltApps, [], PltMods). get_files(State, Apps, PltApps, [], PltMods).
run_dialyzer(State, Opts, Output) -> run_dialyzer(State, Opts, Output) ->
{Args, _} = rebar_state:command_parsed_args(State),
%% dialyzer uses command-line option `--statistics` for enabling
%% additional info about progress of execution, but internally
%% this option has name `timing`.
%% NOTE: Option `timing` accept boolean() or 'debug', but here we support
%% only boolean().
Timing = proplists:get_bool(statistics, Args),
%% dialyzer may return callgraph warnings when get_warnings is false %% dialyzer may return callgraph warnings when get_warnings is false
case proplists:get_bool(get_warnings, Opts) of case proplists:get_bool(get_warnings, Opts) of
true -> true ->
WarningsList = get_config(State, warnings, []), WarningsList = get_config(State, warnings, []),
Opts2 = [{warnings, legacy_warnings(WarningsList)}, Opts2 = [{warnings, legacy_warnings(WarningsList)},
{check_plt, false} |
{check_plt, false},
{timing, Timing} |
Opts], Opts],
?DEBUG("Running dialyzer with options: ~p~n", [Opts2]), ?DEBUG("Running dialyzer with options: ~p~n", [Opts2]),
Warnings = format_warnings(rebar_state:opts(State), Warnings = format_warnings(rebar_state:opts(State),

+ 2
- 1
test/rebar_dialyzer_SUITE.erl View File

@ -335,7 +335,8 @@ cli_args(Config) ->
"--plt-location=" ++ Location, "--plt-location=" ++ Location,
"--base-plt-location=" ++ BasePltLocation, "--base-plt-location=" ++ BasePltLocation,
"--plt-prefix=" ++ Prefix, "--plt-prefix=" ++ Prefix,
"--base-plt-prefix=" ++ BasePrefix],
"--base-plt-prefix=" ++ BasePrefix,
"--statistics"],
{ok, [{app, Name1}, {app, Name2}]}), {ok, [{app, Name1}, {app, Name2}]}),
ErtsFiles = erts_files(), ErtsFiles = erts_files(),

Loading…
Cancel
Save