simplecov-ruby/simplecov

Interesting behavior with specific group names.

MyklClason opened this issue · 0 comments

Using ruby 3.1.2p20, simplecov (0.21.2). I have this setup I'm using:

require "simplecov"
require "simplecov-lcov"
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
   SimpleCov::Formatter::LcovFormatter,
   SimpleCov::Formatter::HTMLFormatter
 ])
SimpleCov.start do
  add_filter(%r{^/spec/}) # For RSpec
  add_filter(%r{^/test/}) # For Minitest

  add_filter "config" # Exclude /config files

  enable_coverage(:branch) # Report branch coverage to trigger branch-level undercover warnings

  %w[Components Controllers Helpers Mailers Models Mutations Views].each do |app_group|
    add_group app_group, "app/#{app_group.downcase}" # Add app folder groups
  end

  big = 100
  add_group ">#{big}LOC" do |src_file|
    src_file.lines.count >= big
  end

  tiny = 10
  add_group "<#{tiny}LOC" do |src_file|
    src_file.lines.count <= tiny
  end
end

The interesting thing is that the big and tiny groups appear in the same group for the HTML output (big then tiny below it). It still creates the two groups, but they contain the same information.