Fix Style/RegexpLiteral.

This commit is contained in:
Markus Reiter 2016-09-21 14:44:22 +02:00
parent 4861ee6c2d
commit b5f8de8bf4
4 changed files with 7 additions and 17 deletions

View File

@ -271,16 +271,6 @@ Style/OpMethod:
- 'Homebrew/install_renamed.rb' - 'Homebrew/install_renamed.rb'
- 'Homebrew/options.rb' - 'Homebrew/options.rb'
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'Homebrew/diagnostic.rb'
- 'Homebrew/keg.rb'
- 'Homebrew/version.rb'
# Offense count: 2 # Offense count: 2
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: SupportedStyles. # Configuration parameters: SupportedStyles.

View File

@ -754,7 +754,7 @@ module Homebrew
cd #{HOMEBREW_REPOSITORY} cd #{HOMEBREW_REPOSITORY}
git remote add origin https://github.com/Homebrew/brew.git git remote add origin https://github.com/Homebrew/brew.git
EOS EOS
elsif origin !~ /Homebrew\/brew(\.git)?$/ elsif origin !~ %r{Homebrew/brew(\.git)?$}
<<-EOS.undent <<-EOS.undent
Suspicious git origin remote found. Suspicious git origin remote found.

View File

@ -62,7 +62,7 @@ class Keg
end end
# locale-specific directories have the form language[_territory][.codeset][@modifier] # locale-specific directories have the form language[_territory][.codeset][@modifier]
LOCALEDIR_RX = /(locale|man)\/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?/ LOCALEDIR_RX = %r{(locale|man)/([a-z]{2}|C|POSIX)(_[A-Z]{2})?(\.[a-zA-Z\-0-9]+(@.+)?)?}
INFOFILE_RX = %r{info/([^.].*?\.info|dir)$} INFOFILE_RX = %r{info/([^.].*?\.info|dir)$}
TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var Frameworks].freeze TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var Frameworks].freeze
ALL_TOP_LEVEL_DIRECTORIES = (TOP_LEVEL_DIRECTORIES + %w[lib/pkgconfig share/locale share/man opt]).freeze ALL_TOP_LEVEL_DIRECTORIES = (TOP_LEVEL_DIRECTORIES + %w[lib/pkgconfig share/locale share/man opt]).freeze
@ -323,13 +323,13 @@ class Keg
when "locale/locale.alias" then :skip_file when "locale/locale.alias" then :skip_file
when INFOFILE_RX then :info when INFOFILE_RX then :info
when LOCALEDIR_RX then :mkpath when LOCALEDIR_RX then :mkpath
when /^icons\/.*\/icon-theme\.cache$/ then :skip_file when %r{^icons/.*/icon-theme\.cache$} then :skip_file
# all icons subfolders should also mkpath # all icons subfolders should also mkpath
when /^icons\// then :mkpath when %r{^icons/} then :mkpath
when /^zsh/ then :mkpath when /^zsh/ then :mkpath
when /^fish/ then :mkpath when /^fish/ then :mkpath
# Lua, Lua51, Lua53 all need the same handling. # Lua, Lua51, Lua53 all need the same handling.
when /^lua\// then :mkpath when %r{^lua/} then :mkpath
when %r{^guile/} then :mkpath when %r{^guile/} then :mkpath
when *SHARE_PATHS then :mkpath when *SHARE_PATHS then :mkpath
else :link else :link
@ -367,7 +367,7 @@ class Keg
# the :link strategy. However, for Foo.framework and # the :link strategy. However, for Foo.framework and
# Foo.framework/Versions we have to use :mkpath so that multiple formulae # Foo.framework/Versions we have to use :mkpath so that multiple formulae
# can link their versions into it and `brew [un]link` works. # can link their versions into it and `brew [un]link` works.
if relative_path.to_s =~ /[^\/]*\.framework(\/Versions)?$/ if relative_path.to_s =~ %r{[^/]*\.framework(/Versions)?$}
:mkpath :mkpath
else else
:link :link

View File

@ -386,7 +386,7 @@ class Version
# e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war # e.g. http://mirrors.jenkins-ci.org/war/1.486/jenkins.war
# e.g. https://github.com/foo/bar/releases/download/0.10.11/bar.phar # e.g. https://github.com/foo/bar/releases/download/0.10.11/bar.phar
m = /\/(\d\.\d+(\.\d+)?)\//.match(spec_s) m = %r{/(\d\.\d+(\.\d+)?)}.match(spec_s)
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz # e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz