From 5250df30af8af247ffa1b001c7c59b5dc01c8be6 Mon Sep 17 00:00:00 2001
From: Paulo Fidalgo
Date: Sun, 15 Oct 2023 21:14:57 +0200
Subject: [PATCH] Add red badges for uncovered branches
Finding branches without cover, in the current file details
implementation, is hard, due the badges having the same colour.
With this commit, we implement red badges for the uncovered branches,
allowing to easily spot them.
---
views/dialog.erb | 3 ++-
views/file_detail.erb | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/views/dialog.erb b/views/dialog.erb
index 12bed7a..1b71b22 100644
--- a/views/dialog.erb
+++ b/views/dialog.erb
@@ -38,7 +38,8 @@
<% end %>
<% if branchable_result? %>
<% file.branches_for_line(line.number).each do |branch_type, hit_count| %>
-
+ <% color = hit_count > 0 ? "bg-blue-700 text-white" : "bg-red-500 text-slate-100" %>
+
<%= branch_type %>: <%= hit_count %>
<% end %>
diff --git a/views/file_detail.erb b/views/file_detail.erb
index 40e3f80..1a1d447 100644
--- a/views/file_detail.erb
+++ b/views/file_detail.erb
@@ -19,7 +19,7 @@
<%= format_number(file.lines.count) %>
- Relevent Lines:
+ Relevant Lines:
<%= format_number(file.covered_lines.count + file.missed_lines.count) %>