Browse Source

Don't error when analyzing empty app

pull/1262/head
James Fish 8 years ago
parent
commit
0fa2b501f0
2 changed files with 22 additions and 5 deletions
  1. +7
    -4
      src/rebar_prv_dialyzer.erl
  2. +15
    -1
      test/rebar_dialyzer_SUITE.erl

+ 7
- 4
src/rebar_prv_dialyzer.erl View File

@ -380,12 +380,15 @@ succ_typings(State, Plt, Output) ->
{0, State};
_ ->
Apps = rebar_state:project_apps(State),
succ_typings(State, Plt, Output, Apps)
?INFO("Doing success typing analysis...", []),
Files = apps_to_files(Apps),
succ_typings(State, Plt, Output, Files)
end.
succ_typings(State, Plt, Output, Apps) ->
?INFO("Doing success typing analysis...", []),
Files = apps_to_files(Apps),
succ_typings(State, Plt, _, []) ->
?INFO("Analyzing no files with ~p...", [Plt]),
{0, State};
succ_typings(State, Plt, Output, Files) ->
?INFO("Analyzing ~b files with ~p...", [length(Files), Plt]),
Opts = [{analysis_type, succ_typings},
{get_warnings, true},

+ 15
- 1
test/rebar_dialyzer_SUITE.erl View File

@ -10,6 +10,7 @@
groups/0,
empty_base_plt/1,
empty_app_plt/1,
empty_app_succ_typings/1,
update_base_plt/1,
update_app_plt/1,
build_release_plt/1,
@ -55,7 +56,7 @@ all() ->
[{group, empty}, {group, build_and_check}, {group, update}].
groups() ->
[{empty, [empty_base_plt, empty_app_plt]},
[{empty, [empty_base_plt, empty_app_plt, empty_app_succ_typings]},
{build_and_check, [build_release_plt, plt_apps_option]},
{update, [update_base_plt, update_app_plt]}].
@ -102,6 +103,19 @@ empty_app_plt(Config) ->
ok.
empty_app_succ_typings(Config) ->
AppDir = ?config(apps, Config),
RebarConfig = ?config(rebar_config, Config),
Name = rebar_test_utils:create_random_name("app1_"),
Vsn = rebar_test_utils:create_random_vsn(),
rebar_test_utils:create_empty_app(AppDir, Name, Vsn, []),
rebar_test_utils:run_and_check(Config, RebarConfig, ["dialyzer"],
{ok, [{app, Name}]}),
ok.
update_base_plt(Config) ->
AppDir = ?config(apps, Config),
RebarConfig = ?config(rebar_config, Config),

Loading…
Cancel
Save