aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMike McQuaid2017-06-12 16:47:28 +0100
committerGitHub2017-06-12 16:47:28 +0100
commited9942fbd1ec4243f0a92ab8f9b2411c8b1fb091 (patch)
treeda996e44297436c16df99318b70ea08b80a3461d /Library/Homebrew/cmd
parent22c431d221ca25413f3b63374d75173bedbe9e66 (diff)
parent7a0aff1080ba475f495353cf8686fbe928b6ebde (diff)
downloadbrew-1.2.3.tar.bz2
Merge pull request #2769 from MikeMcQuaid/rubocop-no-perl-backrefs1.2.3
rubocop: don’t allow Perl regex backrefs.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/info.rb2
-rw-r--r--Library/Homebrew/cmd/install.rb2
-rw-r--r--Library/Homebrew/cmd/search.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 826f31bbd..98200a0b4 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -79,7 +79,7 @@ module Homebrew
def github_remote_path(remote, path)
if remote =~ %r{^(?:https?://|git(?:@|://))github\.com[:/](.+)/(.+?)(?:\.git)?$}
- "https://github.com/#{$1}/#{$2}/blob/master/#{path}"
+ "https://github.com/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}/blob/master/#{path}"
else
"#{remote}/#{path}"
end
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 423b47884..e413bac6f 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -80,7 +80,7 @@ module Homebrew
if name !~ HOMEBREW_TAP_FORMULA_REGEX && name !~ HOMEBREW_CASK_TAP_CASK_REGEX
next
end
- tap = Tap.fetch($1, $2)
+ tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2))
tap.install unless tap.installed?
end
end
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 2b35dfc36..b2d069744 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -93,7 +93,7 @@ module Homebrew
def query_regexp(query)
case query
- when %r{^/(.*)/$} then Regexp.new($1)
+ when %r{^/(.*)/$} then Regexp.new(Regexp.last_match(1))
else /.*#{Regexp.escape(query)}.*/i
end
rescue RegexpError