lib/rubocop/cop/mixin/target_solidus_version.rb in rubocop-solidus-0.1.1 vs lib/rubocop/cop/mixin/target_solidus_version.rb in rubocop-solidus-0.1.2
- old
+ new
@@ -20,11 +20,11 @@
def minimum_solidus_version(version)
@minimum_solidus_version = version
end
def targeted_solidus_version?(version)
- @minimum_solidus_version <= version
+ Gem::Version.new(@minimum_solidus_version) <= Gem::Version.new(version)
end
end
# This method overrides the one in RuboCop::Cop::Base.
# Since this method is called for every offense, we can use it to check
@@ -45,11 +45,11 @@
self.class.targeted_solidus_version?(target_solidus_version)
end
def target_solidus_version
@target_solidus_version ||=
- config.for_all_cops['TargetSolidusVersion']&.to_f || solidus_version_from_lock_file || DEFAULT_SOLIDUS_VERSION
+ config.for_all_cops['TargetSolidusVersion'] || solidus_version_from_lock_file || DEFAULT_SOLIDUS_VERSION
end
def solidus_version_from_lock_file
@solidus_version_from_lock_file ||= read_solidus_version_from_lock_file
end
@@ -60,10 +60,10 @@
File.foreach(lock_file_path) do |line|
# If Solidus (or one of its frameworks) is in Gemfile.lock, there should be a line like:
# solidus_core (X.X.X)
result = line.match(/^\s+solidus_core\s+\((\d+\.\d+)/)
- return result.captures.first.to_f if result
+ return result.captures.first if result
end
end
end
end
end