From 08dc727ee26ec81767236ccbdcc78dba5a04cec6 Mon Sep 17 00:00:00 2001 From: Matheus Richard Date: Fri, 17 Apr 2020 01:18:21 -0300 Subject: [PATCH 1/7] Update odd rows color on summary template --- template/summary.html.ecr | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/template/summary.html.ecr b/template/summary.html.ecr index f3bac36..2acb876 100644 --- a/template/summary.html.ecr +++ b/template/summary.html.ecr @@ -24,6 +24,10 @@ border-bottom: solid 1px black; } + tr.odd { + background-color: #efefef; + } + @@ -37,8 +41,9 @@ Percentage covered - <%- @covered_files.each do |file| -%> - + <%- @covered_files.each_with_index do |file, index| -%> + <%- a = index.odd? ? "odd" : "even" -%> + <%=file.filename%> <%=file.relevant_lines%> <%=file.covered_lines%> From 643964a643149934faee6a7c7866abc448c98cb6 Mon Sep 17 00:00:00 2001 From: Matheus Richard Date: Fri, 17 Apr 2020 01:51:51 -0300 Subject: [PATCH 2/7] Restyle summary table --- template/summary.html.ecr | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/template/summary.html.ecr b/template/summary.html.ecr index 2acb876..184f095 100644 --- a/template/summary.html.ecr +++ b/template/summary.html.ecr @@ -9,8 +9,18 @@ font-family: 'Helvetica Neue', 'Arial', sans-serif; } + body { + padding: 20px; + } + table { margin: auto; + border: 1px solid #AAA; + width: 100%; + } + + thead, tfoot { + background-color: #ddd; } th { @@ -18,7 +28,7 @@ } th,td { - padding: 0.2em, 1em; + padding: 5px 20px; } tr { border-bottom: solid 1px black; @@ -42,8 +52,8 @@ <%- @covered_files.each_with_index do |file, index| -%> - <%- a = index.odd? ? "odd" : "even" -%> - + <%- row_color = index.odd? ? "odd" : "even" -%> + <%=file.filename%> <%=file.relevant_lines%> <%=file.covered_lines%> From 5d2f644ea296d3d3db9e774a8117cb9fc43dc59f Mon Sep 17 00:00:00 2001 From: Matheus Richard Date: Fri, 17 Apr 2020 02:19:37 -0300 Subject: [PATCH 3/7] Restyle links --- template/summary.html.ecr | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/template/summary.html.ecr b/template/summary.html.ecr index 184f095..74b19d6 100644 --- a/template/summary.html.ecr +++ b/template/summary.html.ecr @@ -38,6 +38,16 @@ background-color: #efefef; } + a { + font-weight: bold; + color: #222; + text-decoration: none; + } + + a:hover { + text-decoration: underline; + } + From b749e65b7852ee240d0af2000dd77674e7334d38 Mon Sep 17 00:00:00 2001 From: Matheus Richard Date: Fri, 17 Apr 2020 19:49:41 -0300 Subject: [PATCH 4/7] Restyle file index --- template/index.html.ecr | 31 +++++++++++++++++++++++++------ template/summary.html.ecr | 3 +-- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/template/index.html.ecr b/template/index.html.ecr index 18b68ec..ce6aafb 100644 --- a/template/index.html.ecr +++ b/template/index.html.ecr @@ -9,7 +9,7 @@ font-family: 'Helvetica Neue', 'Arial', sans-serif; } iframe { - width: calc(100% - 200px); + width: calc(100% - 350px); height: 100vh; margin: 0; border: none; @@ -20,25 +20,44 @@ box-sizing: border-box; float: left; height: 100vh; - width: 200px; + width: 350px; display: block; overflow: auto; + border-right: 1px solid #AAA; } - ul { margin: 0; list-style: none; padding: 0; } + li { + padding: 5px; + word-break: break-word; + } + li.odd { + background-color: #efefef; + } + a { + font-weight: bold; + color: #333; + text-decoration: none; + } + a:hover { + text-decoration: underline; + } + h3 { + border-bottom: 1px solid #aaa; + } diff --git a/template/summary.html.ecr b/template/summary.html.ecr index 74b19d6..a53a18e 100644 --- a/template/summary.html.ecr +++ b/template/summary.html.ecr @@ -40,10 +40,9 @@ a { font-weight: bold; - color: #222; + color: #333; text-decoration: none; } - a:hover { text-decoration: underline; } From a630c23dc8cd536b0f9f846289d65130fec88d61 Mon Sep 17 00:00:00 2001 From: Matheus Richard Date: Fri, 17 Apr 2020 20:27:10 -0300 Subject: [PATCH 5/7] Remove cellspacing --- template/summary.html.ecr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/summary.html.ecr b/template/summary.html.ecr index a53a18e..6802b1a 100644 --- a/template/summary.html.ecr +++ b/template/summary.html.ecr @@ -52,7 +52,7 @@

Covering report


- +
From 7c3852dd656506885ade3d106b7245cf30887753 Mon Sep 17 00:00:00 2001 From: Matheus Richard Date: Fri, 17 Apr 2020 20:39:53 -0300 Subject: [PATCH 6/7] Add coverage colors --- src/coverage/runtime/outputters/html_report.cr | 17 ++++++++++++++--- template/summary.html.ecr | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/coverage/runtime/outputters/html_report.cr b/src/coverage/runtime/outputters/html_report.cr index a90fc2d..66e1196 100644 --- a/src/coverage/runtime/outputters/html_report.cr +++ b/src/coverage/runtime/outputters/html_report.cr @@ -22,7 +22,7 @@ class Coverage::Outputter::HtmlReport < Coverage::Outputter end def percent_coverage_str - "#{(100*percent_coverage).round(2)}%" + "#{(100*percent_coverage).round(2)} %" end end @@ -42,9 +42,20 @@ class Coverage::Outputter::HtmlReport < Coverage::Outputter def total_percentage if total_relevant == 0 - "100%" + 100.0 else - (100.0*(total_covered / total_relevant.to_f)).round(2).to_s + "%" + (100.0*(total_covered / total_relevant.to_f)).round(2) + end + end + + def percentage_covered_color(cov) + case cov + when 90.0..100.0 + "green" + when 80.0..89.99 + "yellow" + else + "red" end end diff --git a/template/summary.html.ecr b/template/summary.html.ecr index 6802b1a..c3d0381 100644 --- a/template/summary.html.ecr +++ b/template/summary.html.ecr @@ -46,6 +46,18 @@ a:hover { text-decoration: underline; } + .bold { + font-weight: bold; + } + .green { + color: #090; + } + .yellow { + color: #ddaa00; + } + .red { + color: #900; + } @@ -66,14 +78,14 @@ - + <%- end -%> - +
File Relevant lines<%=file.filename%> <%=file.relevant_lines%> <%=file.covered_lines%><%=file.percent_coverage_str%><%=file.percent_coverage_str%>
TOTAL: <%= total_relevant %> <%= total_covered %><%= total_percentage %><%= total_percentage.to_s %> %
From 8b5a31a7ee1d95349567cb4cc31262a53384b220 Mon Sep 17 00:00:00 2001 From: Matheus Richard Date: Fri, 17 Apr 2020 22:30:50 -0300 Subject: [PATCH 7/7] Update odd column markup --- template/index.html.ecr | 3 +-- template/summary.html.ecr | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/template/index.html.ecr b/template/index.html.ecr index ce6aafb..dc693ff 100644 --- a/template/index.html.ecr +++ b/template/index.html.ecr @@ -56,8 +56,7 @@

Files

diff --git a/template/summary.html.ecr b/template/summary.html.ecr index c3d0381..012e23d 100644 --- a/template/summary.html.ecr +++ b/template/summary.html.ecr @@ -73,8 +73,7 @@ <%- @covered_files.each_with_index do |file, index| -%> - <%- row_color = index.odd? ? "odd" : "even" -%> - + "> <%=file.filename%> <%=file.relevant_lines%> <%=file.covered_lines%>