Skip to content

Commit

Permalink
improve rtl progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Dec 20, 2024
1 parent 3f4ee71 commit 34bbc28
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions lib/tasks/coverage.rake
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ end

def print_lib_progress
counts = {
"file" => { "enzyme" => 0, "rtl" => 0 },
"line" => { "enzyme" => 0, "rtl" => 0 },
"file" => { "enzyme" => 0, "rtl" => 0, "both" => 0 },
"line" => { "enzyme" => 0, "rtl" => 0, "both" => 0 },
}
Find.find("frontend") do |path|
next unless File.file?(path)
Expand All @@ -203,20 +203,28 @@ def print_lib_progress
includesRTL = true
end
end
if includesEnzyme
if includesEnzyme && includesRTL
counts["file"]["both"] += 1
elsif includesEnzyme
counts["file"]["enzyme"] += 1
end
if includesRTL
elsif includesRTL
counts["file"]["rtl"] += 1
end
end
puts
puts "enzyme -> RTL progress:"
counts.each do |text, counts|
total = counts["enzyme"] + counts["rtl"]
percent = (counts["rtl"] / total.to_f * 100).round(2)
puts "#{text}s: #{counts["rtl"]} / #{total} (#{percent}%)"
puts "█" * percent.round + "░" * (100 - percent.round)
total = counts["enzyme"] + counts["rtl"] + counts["both"]
rtl_both_count = counts["rtl"] + counts["both"]
rtl_both_percent = (rtl_both_count / total.to_f * 100).round(2)
rtl_percent = (counts["rtl"] / total.to_f * 100).round(2)
both_percent = (counts["both"] / total.to_f * 100).round(2)
puts "#{text}s: #{rtl_both_count} / #{total} (#{rtl_both_percent}%)"
length = 50
rtl = (rtl_percent * (length.to_f / 100)).ceil
both = (both_percent * (length.to_f / 100)).ceil
remain = length - rtl - both
puts "█" * rtl + "▓" * both + "░" * remain
end
puts
end
Expand Down

0 comments on commit 34bbc28

Please sign in to comment.