Skip to content

Commit 22c431d

Browse files
authored
Merge pull request #2767 from MikeMcQuaid/rubocop-no-special-global-vars
rubocop: don’t allow special global variables.
2 parents aa364fb + 021cef4 commit 22c431d

File tree

23 files changed

+30
-35
lines changed

23 files changed

+30
-35
lines changed

Library/.rubocop.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,6 @@ Style/RaiseArgs:
183183
Style/RegexpLiteral:
184184
EnforcedStyle: slashes
185185

186-
# not a problem for typical shell users
187-
Style/SpecialGlobalVars:
188-
Enabled: false
189-
190186
# ruby style guide favorite
191187
Style/StringLiterals:
192188
EnforcedStyle: double_quotes

Library/Homebrew/brew.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
require "pathname"
1212
HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent
13-
$:.unshift(HOMEBREW_LIBRARY_PATH.to_s)
13+
require "English"
14+
$LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s)
1415
require "global"
1516
require "tap"
1617

Library/Homebrew/cask/lib/hbc/cli/style.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require "English"
2-
31
module Hbc
42
class CLI
53
class Style < AbstractCommand

Library/Homebrew/cmd/style.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def check_style_impl(files, output_type, options = {})
112112
args << "--display-cop-names" if ARGV.include? "--display-cop-names"
113113
args << "--format" << "simple" if files
114114
system(cache_env, "rubocop", *args)
115-
!$?.success?
115+
!$CHILD_STATUS.success?
116116
when :json
117117
json, _, status = Open3.capture3(cache_env, "rubocop", "--format", "json", *args)
118118
# exit status of 1 just means violations were found; other numbers mean

Library/Homebrew/dev-cmd/bump-formula-pr.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,10 @@ def bump_formula_pr
265265
failed_audit = false
266266
if ARGV.include? "--strict"
267267
system HOMEBREW_BREW_FILE, "audit", "--strict", formula.path
268-
failed_audit = !$?.success?
268+
failed_audit = !$CHILD_STATUS.success?
269269
elsif ARGV.include? "--audit"
270270
system HOMEBREW_BREW_FILE, "audit", formula.path
271-
failed_audit = !$?.success?
271+
failed_audit = !$CHILD_STATUS.success?
272272
end
273273
if failed_audit
274274
formula.path.atomic_write(backup_file)

Library/Homebrew/dev-cmd/pull.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def initialize(info)
459459
def self.lookup(name)
460460
json = Utils.popen_read(HOMEBREW_BREW_FILE, "info", "--json=v1", name)
461461

462-
return nil unless $?.success?
462+
return nil unless $CHILD_STATUS.success?
463463

464464
Homebrew.force_utf8!(json)
465465
FormulaInfoFromJson.new(JSON.parse(json)[0])

Library/Homebrew/dev-cmd/tests.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def tests
111111
system "bundle", "exec", "rspec", *args, "--", *files
112112
end
113113

114-
return if $?.success?
114+
return if $CHILD_STATUS.success?
115115
Homebrew.failed = true
116116
end
117117
end

Library/Homebrew/download_strategy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def fetch
338338
rescue ErrorDuringExecution
339339
# 33 == range not supported
340340
# try wiping the incomplete download and retrying once
341-
unless $?.exitstatus == 33 && had_incomplete_download
341+
unless $CHILD_STATUS.exitstatus == 33 && had_incomplete_download
342342
raise CurlDownloadStrategyError, @url
343343
end
344344

Library/Homebrew/extend/os/mac/diagnostic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def check_for_unsupported_curl_vars
271271
def check_xcode_license_approved
272272
# If the user installs Xcode-only, they have to approve the
273273
# license or no "xc*" tool will work.
274-
return unless `/usr/bin/xcrun clang 2>&1` =~ /license/ && !$?.success?
274+
return unless `/usr/bin/xcrun clang 2>&1` =~ /license/ && !$CHILD_STATUS.success?
275275

276276
<<-EOS.undent
277277
You have not agreed to the Xcode license.

Library/Homebrew/extend/os/mac/requirements/java_requirement.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def java_home_cmd
2323
args = %w[--failfast]
2424
args << "--version" << @version.to_s if @version
2525
java_home = Utils.popen_read("/usr/libexec/java_home", *args).chomp
26-
return nil unless $?.success?
26+
return nil unless $CHILD_STATUS.success?
2727
Pathname.new(java_home)/"bin/java"
2828
end
2929

0 commit comments

Comments
 (0)