From b5f8de8bf42d25fed56e71be8e95933030d6a52b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 21 Sep 2016 14:44:22 +0200 Subject: [PATCH] Fix Style/RegexpLiteral. --- Library/.rubocop_todo.yml | 10 ---------- Library/Homebrew/diagnostic.rb | 2 +- Library/Homebrew/keg.rb | 10 +++++----- Library/Homebrew/version.rb | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml index 58eb67657a..c6a4f279e0 100644 --- a/Library/.rubocop_todo.yml +++ b/Library/.rubocop_todo.yml @@ -271,16 +271,6 @@ Style/OpMethod: - 'Homebrew/install_renamed.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 # Cop supports --auto-correct. # Configuration parameters: SupportedStyles. diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 62e916ce19..743c653d22 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -754,7 +754,7 @@ module Homebrew cd #{HOMEBREW_REPOSITORY} git remote add origin https://github.com/Homebrew/brew.git EOS - elsif origin !~ /Homebrew\/brew(\.git)?$/ + elsif origin !~ %r{Homebrew/brew(\.git)?$} <<-EOS.undent Suspicious git origin remote found. diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index e49c8126b1..65ce6480a6 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -62,7 +62,7 @@ class Keg end # 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)$} 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 @@ -323,13 +323,13 @@ class Keg when "locale/locale.alias" then :skip_file when INFOFILE_RX then :info 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 - when /^icons\// then :mkpath + when %r{^icons/} then :mkpath when /^zsh/ then :mkpath when /^fish/ then :mkpath # Lua, Lua51, Lua53 all need the same handling. - when /^lua\// then :mkpath + when %r{^lua/} then :mkpath when %r{^guile/} then :mkpath when *SHARE_PATHS then :mkpath else :link @@ -367,7 +367,7 @@ class Keg # the :link strategy. However, for Foo.framework and # Foo.framework/Versions we have to use :mkpath so that multiple formulae # 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 else :link diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index b15fc3693a..c0e5324eaa 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -386,7 +386,7 @@ class Version # 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 - m = /\/(\d\.\d+(\.\d+)?)\//.match(spec_s) + m = %r{/(\d\.\d+(\.\d+)?)}.match(spec_s) return m.captures.first unless m.nil? # e.g. http://www.ijg.org/files/jpegsrc.v8d.tar.gz