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:
Include:
- '**/*.rb'
- 'Library/Homebrew/.simplecov'
Exclude:
- 'bin/*'
@ -13,6 +14,10 @@ Layout/MultilineMethodCallIndentation:
Exclude:
- '**/*_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
Lint/AmbiguousRegexpLiteral:
Enabled: true
@ -72,6 +77,11 @@ Naming/PredicateName:
Naming/UncommunicativeMethodParamName:
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:
Exclude:
- '**/*_spec.rb'

View File

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

View File

@ -75,7 +75,7 @@ module Hbc
end
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}'"
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true
# RuboCop version used for `brew style` and `brew cask style`
HOMEBREW_RUBOCOP_VERSION = "0.55.0"
HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.19.0" # has to be updated when RuboCop version changes
HOMEBREW_RUBOCOP_VERSION = "0.57.2"
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
#{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.
EOS
EOS
end
end

View File

@ -694,7 +694,7 @@ module Homebrew
next if spec_version >= max_version
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? &&
(above_max_version_scheme || map_includes_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
string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n")
else
string = s.sub!(
/(
pattern = /(
(\ {2}\#[^\n]*\n)* # comments
\ {2}( # two spaces at the beginning
(url|head)\ ['"][\S\ ]+['"] # url or head with a string
@ -494,8 +493,8 @@ module Homebrew
revision\ \d+ # revision with a number
)\n+ # multiple empty lines
)+
/mx, '\0' + output + "\n"
)
/mx
string = s.sub!(pattern, '\0' + output + "\n")
end
odie "Bottle block addition failed!" unless string
end

View File

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

View File

@ -22,7 +22,7 @@ module Homebrew
Changes will be lost!
The first time you `brew update', all local changes will be lost, you should
thus `brew update' before you `brew edit'!
EOS
EOS
end
# 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
# 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 += %W[

View File

@ -282,7 +282,7 @@ class OperationInProgressError < RuntimeError
Operation already in progress for #{name}
Another active Homebrew process is already using #{name}.
Please wait for it to finish or terminate it to continue.
EOS
EOS
super message
end
@ -333,7 +333,7 @@ class FormulaConflictError < RuntimeError
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
resulting software.
EOS
EOS
message.join("\n")
end
end
@ -498,7 +498,7 @@ class DownloadError < RuntimeError
super <<~EOS
Failed to download resource #{resource.download_name.inspect}
#{cause.message}
EOS
EOS
set_backtrace(cause.backtrace)
end
end
@ -547,7 +547,7 @@ class ChecksumMismatchError < RuntimeError
Actual: #{actual}
Archive: #{fn}
To retry an incomplete download, remove the file above.
EOS
EOS
end
end

View File

@ -54,12 +54,12 @@ class SystemConfig
def dump_verbose_config(f = $stdout)
dump_generic_verbose_config(f)
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?
f.puts "CLT headers: #{clt_headers ? clt_headers : "N/A"}"
f.puts "CLT headers: #{clt_headers || "N/A"}"
end
f.puts "Xcode: #{xcode ? xcode : "N/A"}"
f.puts "XQuartz: #{xquartz ? xquartz : "N/A"}"
f.puts "Xcode: #{xcode || "N/A"}"
f.puts "XQuartz: #{xquartz || "N/A"}"
end
end
end

View File

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

View File

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

View File

@ -33,7 +33,7 @@ class Migrator
end
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}`.
EOS
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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