Merge pull request #4300 from apjanke/new-rubocop-version

Upgrade to Rubocop 0.57.2
This commit is contained in:
Mike McQuaid 2018-07-01 09:08:16 +01:00 committed by GitHub
commit 61a8c4d1fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 53 additions and 56 deletions

View File

@ -3,6 +3,7 @@ inherit_from:
AllCops: AllCops:
Include: Include:
- '**/*.rb'
- 'Library/Homebrew/.simplecov' - 'Library/Homebrew/.simplecov'
Exclude: Exclude:
- 'bin/*' - 'bin/*'
@ -13,6 +14,10 @@ Layout/MultilineMethodCallIndentation:
Exclude: Exclude:
- '**/*_spec.rb' - '**/*_spec.rb'
# Gets false positives with our heredocs nested inside arrays
Layout/ClosingHeredocIndentation:
Enabled: false
# so many of these in formulae but none in here # so many of these in formulae but none in here
Lint/AmbiguousRegexpLiteral: Lint/AmbiguousRegexpLiteral:
Enabled: true Enabled: true
@ -72,6 +77,11 @@ Naming/PredicateName:
Naming/UncommunicativeMethodParamName: Naming/UncommunicativeMethodParamName:
Enabled: false Enabled: false
# Avoid false positives on modifiers used on symbols of methods
# See https://github.com/rubocop-hq/rubocop/issues/5953
Style/AccessModifierDeclarations:
Enabled: false
Style/BlockDelimiters: Style/BlockDelimiters:
Exclude: Exclude:
- '**/*_spec.rb' - '**/*_spec.rb'

View File

@ -1,4 +1,3 @@
class BuildEnvironment class BuildEnvironment
def initialize(*settings) def initialize(*settings)
@settings = Set.new(*settings) @settings = Set.new(*settings)

View File

@ -75,7 +75,7 @@ module Hbc
end end
if value.nil? || (value.respond_to?(:empty?) && value.empty?) if value.nil? || (value.respond_to?(:empty?) && value.empty?)
stanza_name = artifact_name ? artifact_name : stanza stanza_name = artifact_name || stanza
raise CaskError, "no such stanza '#{stanza_name}' on Cask '#{cask}'" raise CaskError, "no such stanza '#{stanza_name}' on Cask '#{cask}'"
end end

View File

@ -1,4 +1,3 @@
require "hbc/container/base" require "hbc/container/base"
module Hbc module Hbc

View File

@ -1,4 +1,3 @@
require "hbc/container/base" require "hbc/container/base"
module Hbc module Hbc

View File

@ -1,4 +1,3 @@
require "hbc/container/base" require "hbc/container/base"
module Hbc module Hbc

View File

@ -1,4 +1,3 @@
require "hbc/container/base" require "hbc/container/base"
module Hbc module Hbc

View File

@ -1,4 +1,3 @@
require "hbc/container/base" require "hbc/container/base"
module Hbc module Hbc

View File

@ -1,4 +1,3 @@
require "hbc/container/base" require "hbc/container/base"
module Hbc module Hbc

View File

@ -1,4 +1,3 @@
require "hbc/container/base" require "hbc/container/base"
module Hbc module Hbc

View File

@ -1,4 +1,3 @@
require "hbc/container/base" require "hbc/container/base"
module Hbc module Hbc

View File

@ -1,4 +1,3 @@
require "os/mac/version" require "os/mac/version"
module OS module OS

View File

@ -50,7 +50,7 @@ module Homebrew
To continue using the detected name, pass it explicitly: To continue using the detected name, pass it explicitly:
brew diy --name=#{detected_name} brew diy --name=#{detected_name}
EOS EOS
detected_name detected_name
end end

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
# RuboCop version used for `brew style` and `brew cask style` # RuboCop version used for `brew style` and `brew cask style`
HOMEBREW_RUBOCOP_VERSION = "0.55.0" HOMEBREW_RUBOCOP_VERSION = "0.57.2"
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.19.0" # has to be updated when RuboCop version changes HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.20.0" # has to be updated when RuboCop version changes

View File

@ -8,7 +8,7 @@ class CxxStdlib
super <<~EOS super <<~EOS
#{formula.full_name} dependency #{dep.name} was built with a different C++ standard #{formula.full_name} dependency #{dep.name} was built with a different C++ standard
library (#{stdlib.type_string} from #{stdlib.compiler}). This may cause problems at runtime. library (#{stdlib.type_string} from #{stdlib.compiler}). This may cause problems at runtime.
EOS EOS
end end
end end

View File

@ -694,7 +694,7 @@ module Homebrew
next if spec_version >= max_version next if spec_version >= max_version
above_max_version_scheme = current_version_scheme > max_version_scheme above_max_version_scheme = current_version_scheme > max_version_scheme
map_includes_version = spec_version_scheme_map.keys.include?(spec_version) map_includes_version = spec_version_scheme_map.key?(spec_version)
next if !current_version_scheme.zero? && next if !current_version_scheme.zero? &&
(above_max_version_scheme || map_includes_version) (above_max_version_scheme || map_includes_version)
problem "#{spec} version should not decrease (from #{max_version} to #{spec_version})" problem "#{spec} version should not decrease (from #{max_version} to #{spec_version})"

View File

@ -481,8 +481,7 @@ module Homebrew
indent = s.slice(/^( +)stable do/, 1).length indent = s.slice(/^( +)stable do/, 1).length
string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n") string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n")
else else
string = s.sub!( pattern = /(
/(
(\ {2}\#[^\n]*\n)* # comments (\ {2}\#[^\n]*\n)* # comments
\ {2}( # two spaces at the beginning \ {2}( # two spaces at the beginning
(url|head)\ ['"][\S\ ]+['"] # url or head with a string (url|head)\ ['"][\S\ ]+['"] # url or head with a string
@ -494,8 +493,8 @@ module Homebrew
revision\ \d+ # revision with a number revision\ \d+ # revision with a number
)\n+ # multiple empty lines )\n+ # multiple empty lines
)+ )+
/mx, '\0' + output + "\n" /mx
) string = s.sub!(pattern, '\0' + output + "\n")
end end
odie "Bottle block addition failed!" unless string odie "Bottle block addition failed!" unless string
end end

View File

@ -88,7 +88,7 @@ module Homebrew
The formula #{realname} is already aliased to #{fc.name} The formula #{realname} is already aliased to #{fc.name}
Please check that you are not creating a duplicate. Please check that you are not creating a duplicate.
To force creation use --force. To force creation use --force.
EOS EOS
end end
end end

View File

@ -22,7 +22,7 @@ module Homebrew
Changes will be lost! Changes will be lost!
The first time you `brew update', all local changes will be lost, you should The first time you `brew update', all local changes will be lost, you should
thus `brew update' before you `brew edit'! thus `brew update' before you `brew edit'!
EOS EOS
end end
# If no brews are listed, open the project root in an editor. # If no brews are listed, open the project root in an editor.

View File

@ -92,7 +92,7 @@ module Homebrew
# Generate seed ourselves and output later to avoid multiple different # Generate seed ourselves and output later to avoid multiple different
# seeds being output when running parallel tests. # seeds being output when running parallel tests.
seed = args.seed ? args.seed : rand(0xFFFF).to_i seed = args.seed || rand(0xFFFF).to_i
bundle_args = ["-I", HOMEBREW_LIBRARY_PATH/"test"] bundle_args = ["-I", HOMEBREW_LIBRARY_PATH/"test"]
bundle_args += %W[ bundle_args += %W[

View File

@ -282,7 +282,7 @@ class OperationInProgressError < RuntimeError
Operation already in progress for #{name} Operation already in progress for #{name}
Another active Homebrew process is already using #{name}. Another active Homebrew process is already using #{name}.
Please wait for it to finish or terminate it to continue. Please wait for it to finish or terminate it to continue.
EOS EOS
super message super message
end end
@ -333,7 +333,7 @@ class FormulaConflictError < RuntimeError
link the formula again after the install finishes. You can --force this link the formula again after the install finishes. You can --force this
install, but the build may fail or cause obscure side-effects in the install, but the build may fail or cause obscure side-effects in the
resulting software. resulting software.
EOS EOS
message.join("\n") message.join("\n")
end end
end end
@ -498,7 +498,7 @@ class DownloadError < RuntimeError
super <<~EOS super <<~EOS
Failed to download resource #{resource.download_name.inspect} Failed to download resource #{resource.download_name.inspect}
#{cause.message} #{cause.message}
EOS EOS
set_backtrace(cause.backtrace) set_backtrace(cause.backtrace)
end end
end end
@ -547,7 +547,7 @@ class ChecksumMismatchError < RuntimeError
Actual: #{actual} Actual: #{actual}
Archive: #{fn} Archive: #{fn}
To retry an incomplete download, remove the file above. To retry an incomplete download, remove the file above.
EOS EOS
end end
end end

View File

@ -54,12 +54,12 @@ class SystemConfig
def dump_verbose_config(f = $stdout) def dump_verbose_config(f = $stdout)
dump_generic_verbose_config(f) dump_generic_verbose_config(f)
f.puts "macOS: #{MacOS.full_version}-#{kernel}" f.puts "macOS: #{MacOS.full_version}-#{kernel}"
f.puts "CLT: #{clt ? clt : "N/A"}" f.puts "CLT: #{clt || "N/A"}"
if MacOS::CLT.separate_header_package? if MacOS::CLT.separate_header_package?
f.puts "CLT headers: #{clt_headers ? clt_headers : "N/A"}" f.puts "CLT headers: #{clt_headers || "N/A"}"
end end
f.puts "Xcode: #{xcode ? xcode : "N/A"}" f.puts "Xcode: #{xcode || "N/A"}"
f.puts "XQuartz: #{xquartz ? xquartz : "N/A"}" f.puts "XQuartz: #{xquartz || "N/A"}"
end end
end end
end end

View File

@ -8,7 +8,7 @@ class Keg
super <<~EOS super <<~EOS
Cannot link #{keg.name} Cannot link #{keg.name}
Another version is already linked: #{keg.linked_keg_record.resolved_path} Another version is already linked: #{keg.linked_keg_record.resolved_path}
EOS EOS
end end
end end
@ -47,7 +47,7 @@ class Keg
To list all files that would be deleted: To list all files that would be deleted:
brew link --overwrite --dry-run #{keg.name} brew link --overwrite --dry-run #{keg.name}
EOS EOS
s.join("\n") s.join("\n")
end end
end end

View File

@ -1,4 +1,3 @@
module Metafiles module Metafiles
# https://github.com/github/markup#markups # https://github.com/github/markup#markups
EXTENSIONS = Set.new %w[ EXTENSIONS = Set.new %w[

View File

@ -33,7 +33,7 @@ class Migrator
end end
super <<~EOS super <<~EOS
#{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} was installed from #{tap ? tap : "path or url"}. #{formula.name} from #{formula.tap} is given, but old name #{formula.oldname} was installed from #{tap || "path or url"}.
#{msg}To force migrate use `brew migrate --force #{formula.oldname}`. #{msg}To force migrate use `brew migrate --force #{formula.oldname}`.
EOS EOS
end end

View File

@ -12,7 +12,7 @@ module Homebrew
case name.downcase case name.downcase
when "gem", /^rubygems?$/ then <<~EOS when "gem", /^rubygems?$/ then <<~EOS
Homebrew provides gem via: `brew install ruby`. Homebrew provides gem via: `brew install ruby`.
EOS EOS
when "tex", "tex-live", "texlive", "latex" then <<~EOS when "tex", "tex-live", "texlive", "latex" then <<~EOS
Installing TeX from source is weird and gross, requires a lot of patches, Installing TeX from source is weird and gross, requires a lot of patches,
and only builds 32-bit (and thus can't use Homebrew dependencies) and only builds 32-bit (and thus can't use Homebrew dependencies)
@ -21,42 +21,42 @@ module Homebrew
You can install it with Homebrew-Cask: You can install it with Homebrew-Cask:
brew cask install mactex brew cask install mactex
EOS EOS
when "pip" then <<~EOS when "pip" then <<~EOS
Homebrew provides pip via: `brew install python`. However you will then Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at: pip via the instructions at:
#{Formatter.url("https://pip.readthedocs.io/en/stable/installing/")} #{Formatter.url("https://pip.readthedocs.io/en/stable/installing/")}
EOS EOS
when "pil" then <<~EOS when "pil" then <<~EOS
Instead of PIL, consider `pip2 install pillow`. Instead of PIL, consider `pip2 install pillow`.
EOS EOS
when "macruby" then <<~EOS when "macruby" then <<~EOS
MacRuby is not packaged and is on an indefinite development hiatus. MacRuby is not packaged and is on an indefinite development hiatus.
You can read more about it at: You can read more about it at:
#{Formatter.url("https://github.com/MacRuby/MacRuby")} #{Formatter.url("https://github.com/MacRuby/MacRuby")}
EOS EOS
when /(lib)?lzma/ when /(lib)?lzma/
"lzma is now part of the xz formula." "lzma is now part of the xz formula."
when "gtest", "googletest", "google-test" then <<~EOS when "gtest", "googletest", "google-test" then <<~EOS
Installing gtest system-wide is not recommended; it should be vendored Installing gtest system-wide is not recommended; it should be vendored
in your projects that use it. in your projects that use it.
EOS EOS
when "gmock", "googlemock", "google-mock" then <<~EOS when "gmock", "googlemock", "google-mock" then <<~EOS
Installing gmock system-wide is not recommended; it should be vendored Installing gmock system-wide is not recommended; it should be vendored
in your projects that use it. in your projects that use it.
EOS EOS
when "sshpass" then <<~EOS when "sshpass" then <<~EOS
We won't add sshpass because it makes it too easy for novice SSH users to We won't add sshpass because it makes it too easy for novice SSH users to
ruin SSH's security. ruin SSH's security.
EOS EOS
when "gsutil" then <<~EOS when "gsutil" then <<~EOS
Install gsutil with `pip2 install gsutil` Install gsutil with `pip2 install gsutil`
EOS EOS
when "gfortran" then <<~EOS when "gfortran" then <<~EOS
GNU Fortran is now provided as part of GCC, and can be installed with: GNU Fortran is now provided as part of GCC, and can be installed with:
brew install gcc brew install gcc
EOS EOS
when "play" then <<~EOS when "play" then <<~EOS
Play 2.3 replaces the play command with activator: Play 2.3 replaces the play command with activator:
brew install typesafe-activator brew install typesafe-activator
@ -64,21 +64,21 @@ module Homebrew
You can read more about this change at: You can read more about this change at:
#{Formatter.url("https://www.playframework.com/documentation/2.3.x/Migration23")} #{Formatter.url("https://www.playframework.com/documentation/2.3.x/Migration23")}
#{Formatter.url("https://www.playframework.com/documentation/2.3.x/Highlights23")} #{Formatter.url("https://www.playframework.com/documentation/2.3.x/Highlights23")}
EOS EOS
when "haskell-platform" then <<~EOS when "haskell-platform" then <<~EOS
We no longer package haskell-platform. Consider installing ghc, We no longer package haskell-platform. Consider installing ghc,
cabal-install and stack instead: cabal-install and stack instead:
brew install ghc cabal-install stack brew install ghc cabal-install stack
EOS EOS
when "mysqldump-secure" then <<~EOS when "mysqldump-secure" then <<~EOS
The creator of mysqldump-secure tried to game our popularity metrics. The creator of mysqldump-secure tried to game our popularity metrics.
EOS EOS
when "ngrok" then <<~EOS when "ngrok" then <<~EOS
Upstream sunsetted 1.x in March 2016 and 2.x is not open-source. Upstream sunsetted 1.x in March 2016 and 2.x is not open-source.
If you wish to use the 2.x release you can install with Homebrew-Cask: If you wish to use the 2.x release you can install with Homebrew-Cask:
brew cask install ngrok brew cask install ngrok
EOS EOS
end end
end end
alias generic_blacklisted_reason blacklisted_reason alias generic_blacklisted_reason blacklisted_reason

View File

@ -1,4 +1,3 @@
class Option class Option
attr_reader :name, :description, :flag attr_reader :name, :description, :flag

View File

@ -8,11 +8,12 @@ GEM
url url
diff-lcs (1.3) diff-lcs (1.3)
docile (1.3.0) docile (1.3.0)
jaro_winkler (1.5.1)
json (2.1.0) json (2.1.0)
parallel (1.12.1) parallel (1.12.1)
parallel_tests (2.21.3) parallel_tests (2.21.3)
parallel parallel
parser (2.5.0.5) parser (2.5.1.0)
ast (~> 2.4.0) ast (~> 2.4.0)
powerpack (0.1.1) powerpack (0.1.1)
rainbow (3.0.0) rainbow (3.0.0)
@ -36,7 +37,8 @@ GEM
rspec-support (3.7.1) rspec-support (3.7.1)
rspec-wait (0.0.9) rspec-wait (0.0.9)
rspec (>= 3, < 4) rspec (>= 3, < 4)
rubocop (0.55.0) rubocop (0.57.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.5) parser (>= 2.5)
powerpack (~> 0.1) powerpack (~> 0.1)
@ -62,7 +64,7 @@ DEPENDENCIES
rspec-its rspec-its
rspec-retry rspec-retry
rspec-wait rspec-wait
rubocop (= 0.55.0) rubocop (= 0.57.1)
simplecov simplecov
BUNDLED WITH BUNDLED WITH

View File

@ -146,7 +146,7 @@ describe Hbc::Pkg, :cask do
expect(fake_system_command).to receive(:run!).with( expect(fake_system_command).to receive(:run!).with(
"/usr/sbin/pkgutil", "/usr/sbin/pkgutil",
args: ["--pkg-info-plist", pkg_id], args: ["--pkg-info-plist", pkg_id],
).and_return( ).and_return(
Hbc::SystemCommand::Result.new(nil, pkg_info_plist, nil, 0), Hbc::SystemCommand::Result.new(nil, pkg_info_plist, nil, 0),
) )

View File

@ -1,4 +1,3 @@
describe Tty do describe Tty do
describe "::strip_ansi" do describe "::strip_ansi" do
it "removes ANSI escape codes from a string" do it "removes ANSI escape codes from a string" do

View File

@ -1,4 +1,3 @@
describe "globally-scoped helper methods" do describe "globally-scoped helper methods" do
let(:dir) { mktmpdir } let(:dir) { mktmpdir }