Skip to content

Commit

Permalink
tidy up pattern override based off PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
declan-fitzpatrick committed Sep 3, 2021
1 parent 7353b4c commit 99a4d42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions terraform/lib/dependabot/terraform/requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class Requirement < Gem::Requirement
# Override regex PATTERN from Gem::Requirement to add support for the
# optional 'v' prefix to release tag names, which Terraform supports.
# https://www.terraform.io/docs/registry/modules/publish.html#requirements
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
PATTERN_RAW = "\\s*(#{quoted})?\\s*v?(#{Gem::Version::VERSION_PATTERN})\\s*"
OPERATORS = OPS.keys.map { |key| Regexp.quote(key) }.join("|").freeze
PATTERN_RAW = "\\s*(#{OPERATORS})?\\s*v?(#{Gem::Version::VERSION_PATTERN})\\s*"
PATTERN = /\A#{PATTERN_RAW}\z/.freeze

def self.parse(obj)
Expand Down

0 comments on commit 99a4d42

Please sign in to comment.