From 9c9f1eaaab0bdebfe9e0ef3df8f4974f929d2984 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:25:29 +0200 Subject: [PATCH] Fix version check load order issue Checking the version causes an error when `simplecov-html` is loaded before `simplecov`: ``` require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "simplecov-html" gem "simplecov" end ``` ``` /home/user/code/simplecov-html/lib/simplecov-html.rb:10:in '': uninitialized constant SimpleCov::VERSION (NameError) major, minor, patch = SimpleCov::VERSION.scan(/\d+/).first(3).map(&:to_i) ^^^^^^^^^ from :37:in 'Kernel#require' ``` I don't think this check is even needed anymore but I'd just leave it in --- lib/simplecov-html.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/simplecov-html.rb b/lib/simplecov-html.rb index cd07425..dcac581 100644 --- a/lib/simplecov-html.rb +++ b/lib/simplecov-html.rb @@ -6,6 +6,7 @@ require "time" # Ensure we are using a compatible version of SimpleCov +require "simplecov/version" major, minor, patch = SimpleCov::VERSION.scan(/\d+/).first(3).map(&:to_i) if major < 0 || minor < 9 || patch < 0 raise "The version of SimpleCov you are using is too old. " \