Skip to content

Commit

Permalink
update methods
Browse files Browse the repository at this point in the history
  • Loading branch information
chiefpansancolt committed Oct 10, 2020
1 parent 8067bd7 commit 59217a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
28 changes: 17 additions & 11 deletions lib/simplecov-tailwindcss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require "cgi"
require "fileutils"
require "digest/sha1"
require "pry"

# Ensure we are using a compatible version of SimpleCov
major, minor, patch = SimpleCov::VERSION.scan(/\d+/).first(3).map(&:to_i)
Expand Down Expand Up @@ -37,9 +38,6 @@ def output_message(result)
end

def branchable_result?
# cached in initialize because we truly look it up a whole bunch of times
# and it's easier to cache here then in SimpleCov because there we might
# still enable/disable branch coverage criterion
@branchable_result
end

Expand Down Expand Up @@ -87,6 +85,14 @@ def generate_dialog(file)
"can't handle non ASCII characters in filenames. Error: " \
"#{e.message}."
end

def generate_stat_card(title, stat, color)
template("stat_card").result(binding)
end

def generate_table_column_head(name)
template("table_column_head").result(binding)
end

# rubocop:disable Lint/SelfAssignment, Style/RedundantRegexpEscape
def generate_group_page(title, files)
Expand All @@ -109,21 +115,21 @@ def format_number(number)

def coverage_class(covered_percent)
if covered_percent > 90
"green"
"text-green-500"
elsif covered_percent > 80
"yellow"
"text-yellow-500"
else
"red"
"text-red-500"
end
end

def strength_class(covered_strength)
if covered_strength > 1
"green"
"text-green-500"
elsif covered_strength == 1
"yellow"
"text-yellow-500"
else
"red"
"text-red-500"
end
end

Expand All @@ -137,9 +143,9 @@ def shortened_filename(file)

def hide_show(title)
if title == "AllFiles"
"display: '';"
""
else
"display: none;"
"hidden"
end
end
end
Expand Down
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
SimpleCov.start do
enable_coverage :branch
add_filter "/test/"
add_group "Library", "/lib"
end

SimpleCov.formatters = [
Expand Down

0 comments on commit 59217a0

Please sign in to comment.