Skip to content

Commit

Permalink
Do not create link that goes nowhere
Browse files Browse the repository at this point in the history
Use row_no_link if html eport is not written for the module
  • Loading branch information
arcusfelis committed Dec 19, 2024
1 parent 1e5a514 commit 67e84f1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion big_tests/run_common_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,14 @@ make_html(CoverNode, Modules) ->
%% We assume that import_code_paths/1 was called earlier
case cover_analyse(CoverNode, Module) of
{ok, {Module, {C, NC}}} ->
file:write(File, row(atom_to_list(Module), C, NC, percent(C,NC),"coverage/"++FileName)),
FilePathC = filename:join([Root, CoverageDir, FileName]),
case cover_analyse_to_html_file(CoverNode, Module, FilePathC) of
{ok, _} ->
file:write(File, row(atom_to_list(Module), C, NC, percent(C,NC),"coverage/"++FileName)),
{CAcc + C, NCAcc + NC, Skipped, Failed, OK + 1};
Other ->
%% Do not report link, if the destination file is not written
file:write(File, row_no_link(atom_to_list(Module), C, NC, percent(C,NC))),
error_logger:error_msg("issue=cover_analyse_to_html_file_failed module=~p reason=~p",
[Module, Other]),
{CAcc + C, NCAcc + NC, Skipped, Failed + 1, OK}
Expand Down Expand Up @@ -493,6 +495,17 @@ row(Row, C, NC, Percent, Path) ->
"</tr>\n"
].

row_no_link(Row, C, NC, Percent) ->
[
"<tr>",
"<td>", Row, "</td>",
"<td>", integer_to_list(Percent), "%</td>",
"<td>", integer_to_list(C), "</td>",
"<td>", integer_to_list(NC), "</td>",
"<td>", integer_to_list(C+NC), "</td>",
"</tr>\n"
].

get_cover_header() ->
"<html>\n<head></head>\n<body bgcolor=\"white\" text=\"black\" link=\"blue\" vlink=\"purple\" alink=\"red\">\n"
"<head><script src='sorttable.js'></script></head>"
Expand Down

0 comments on commit 67e84f1

Please sign in to comment.