From 67e84f110a3e0abe8f4ba0dd976970b5bd9fe72f Mon Sep 17 00:00:00 2001 From: Mikhail Uvarov Date: Thu, 19 Dec 2024 12:16:11 +0100 Subject: [PATCH] Do not create link that goes nowhere Use row_no_link if html eport is not written for the module --- big_tests/run_common_test.erl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/big_tests/run_common_test.erl b/big_tests/run_common_test.erl index c1b3ee80b6..017175b750 100644 --- a/big_tests/run_common_test.erl +++ b/big_tests/run_common_test.erl @@ -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} @@ -493,6 +495,17 @@ row(Row, C, NC, Percent, Path) -> "\n" ]. +row_no_link(Row, C, NC, Percent) -> + [ + "", + "", Row, "", + "", integer_to_list(Percent), "%", + "", integer_to_list(C), "", + "", integer_to_list(NC), "", + "", integer_to_list(C+NC), "", + "\n" + ]. + get_cover_header() -> "\n\n\n" ""