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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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 }