Browse Source

print warning if cover can't annotate source and skip file

pull/202/head
alisdair sullivan 10 years ago
parent
commit
0e606138c5
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/rebar_prv_cover.erl

+ 9
- 1
src/rebar_prv_cover.erl View File

@ -150,12 +150,20 @@ analyze_to_file(Mod, State, Task) ->
ok = filelib:ensure_dir(filename:join([TaskDir, "dummy.html"])),
case code:ensure_loaded(Mod) of
{module, _} ->
cover:analyze_to_file(Mod, mod_to_filename(TaskDir, Mod), [html]);
write_file(Mod, mod_to_filename(TaskDir, Mod));
{error, _} ->
?WARN("Can't load module ~ts.", [Mod]),
{ok, []}
end.
write_file(Mod, FileName) ->
case cover:analyze_to_file(Mod, FileName, [html]) of
{ok, File} -> {ok, File};
{error, Reason} ->
?WARN("Couldn't write annotated file for module ~p for reason ~p", [Mod, Reason]),
{ok, []}
end.
mod_to_filename(TaskDir, M) ->
filename:join([TaskDir, atom_to_list(M) ++ ".html"]).

Loading…
Cancel
Save