Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Rubocop 0.57.2 #4300

Merged
merged 2 commits into from Jul 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions Library/Homebrew/.rubocop.yml
Expand Up @@ -3,6 +3,7 @@ inherit_from:

AllCops:
Include:
- '**/*.rb'
- 'Library/Homebrew/.simplecov'
Exclude:
- 'bin/*'
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/build_environment.rb
@@ -1,4 +1,3 @@

class BuildEnvironment
def initialize(*settings)
@settings = Set.new(*settings)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
Expand Up @@ -75,7 +75,7 @@ def run
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

Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/container/cab.rb
@@ -1,4 +1,3 @@

require "hbc/container/base"

module Hbc
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/container/generic_unar.rb
@@ -1,4 +1,3 @@

require "hbc/container/base"

module Hbc
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/container/gpg.rb
@@ -1,4 +1,3 @@

require "hbc/container/base"

module Hbc
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/container/gzip.rb
@@ -1,4 +1,3 @@

require "hbc/container/base"

module Hbc
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/container/lzma.rb
@@ -1,4 +1,3 @@

require "hbc/container/base"

module Hbc
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/container/tar.rb
@@ -1,4 +1,3 @@

require "hbc/container/base"

module Hbc
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/container/xar.rb
@@ -1,4 +1,3 @@

require "hbc/container/base"

module Hbc
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/container/xz.rb
@@ -1,4 +1,3 @@

require "hbc/container/base"

module Hbc
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/cask/lib/hbc/macos.rb
@@ -1,4 +1,3 @@

require "os/mac/version"

module OS
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/diy.rb
Expand Up @@ -50,7 +50,7 @@ def detect_name(path, version)

To continue using the detected name, pass it explicitly:
brew diy --name=#{detected_name}
EOS
EOS

detected_name
end
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/constants.rb
@@ -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
2 changes: 1 addition & 1 deletion Library/Homebrew/cxxstdlib.rb
Expand Up @@ -8,7 +8,7 @@ def initialize(formula, dep, stdlib)
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

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/audit.rb
Expand Up @@ -694,7 +694,7 @@ def audit_revision_and_version_scheme
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})"
Expand Down
7 changes: 3 additions & 4 deletions Library/Homebrew/dev-cmd/bottle.rb
Expand Up @@ -481,8 +481,7 @@ def merge
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
Expand All @@ -494,8 +493,8 @@ def merge
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
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/create.rb
Expand Up @@ -88,7 +88,7 @@ def create
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

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/edit.rb
Expand Up @@ -22,7 +22,7 @@ def edit
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.
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/tests.rb
Expand Up @@ -92,7 +92,7 @@ def tests

# 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[
Expand Down
8 changes: 4 additions & 4 deletions Library/Homebrew/exceptions.rb
Expand Up @@ -282,7 +282,7 @@ def initialize(name)
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
Expand Down Expand Up @@ -333,7 +333,7 @@ def message
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
Expand Down Expand Up @@ -498,7 +498,7 @@ def initialize(resource, cause)
super <<~EOS
Failed to download resource #{resource.download_name.inspect}
#{cause.message}
EOS
EOS
set_backtrace(cause.backtrace)
end
end
Expand Down Expand Up @@ -547,7 +547,7 @@ def initialize(fn, expected, actual)
Actual: #{actual}
Archive: #{fn}
To retry an incomplete download, remove the file above.
EOS
EOS
end
end

Expand Down
8 changes: 4 additions & 4 deletions Library/Homebrew/extend/os/mac/system_config.rb
Expand Up @@ -54,12 +54,12 @@ def xquartz
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
4 changes: 2 additions & 2 deletions Library/Homebrew/keg.rb
Expand Up @@ -8,7 +8,7 @@ def initialize(keg)
super <<~EOS
Cannot link #{keg.name}
Another version is already linked: #{keg.linked_keg_record.resolved_path}
EOS
EOS
end
end

Expand Down Expand Up @@ -47,7 +47,7 @@ def to_s

To list all files that would be deleted:
brew link --overwrite --dry-run #{keg.name}
EOS
EOS
s.join("\n")
end
end
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/metafiles.rb
@@ -1,4 +1,3 @@

module Metafiles
# https://github.com/github/markup#markups
EXTENSIONS = Set.new %w[
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/migrator.rb
Expand Up @@ -33,7 +33,7 @@ def initialize(formula, tap)
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
Expand Down
28 changes: 14 additions & 14 deletions Library/Homebrew/missing_formula.rb
Expand Up @@ -12,7 +12,7 @@ def blacklisted_reason(name)
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)
Expand All @@ -21,64 +21,64 @@ def blacklisted_reason(name)

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

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
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/options.rb
@@ -1,4 +1,3 @@

class Option
attr_reader :name, :description, :flag

Expand Down
8 changes: 5 additions & 3 deletions Library/Homebrew/test/Gemfile.lock
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -62,7 +64,7 @@ DEPENDENCIES
rspec-its
rspec-retry
rspec-wait
rubocop (= 0.55.0)
rubocop (= 0.57.1)
simplecov

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/test/cask/pkg_spec.rb
Expand Up @@ -146,7 +146,7 @@

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),
)
Expand Down
1 change: 0 additions & 1 deletion Library/Homebrew/test/utils/tty_spec.rb
@@ -1,4 +1,3 @@

describe Tty do
describe "::strip_ansi" do
it "removes ANSI escape codes from a string" do
Expand Down