Module: Dependabot::Python::NameNormaliser

Extended by:
T::Sig
Defined in:
lib/dependabot/python/name_normaliser.rb

Class Method Summary collapse

Class Method Details

.normalise(name) ⇒ Object



12
13
14
15
# File 'lib/dependabot/python/name_normaliser.rb', line 12

def self.normalise(name)
  extras_regex = /\[.+\]/
  name.downcase.gsub(/[-_.]+/, "-").gsub(extras_regex, "")
end

.normalise_including_extras(name, extras) ⇒ Object



18
19
20
21
22
23
# File 'lib/dependabot/python/name_normaliser.rb', line 18

def self.normalise_including_extras(name, extras)
  normalised_name = normalise(name)
  return normalised_name if extras.empty?

  normalised_name + "[" + extras.join(",") + "]"
end