language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/cask/cli/home_test.rb
@@ -1,17 +1,21 @@ require "test_helper" # monkeypatch for testing -class Hbc::CLI::Home - def self.system(*command) - system_commands << command - end +module Hbc + class CLI + class Home + def self.system(*command) + system_commands << command + end - def self.reset! - @system_commands = [] - end + def self.reset! + @system_commands = [] + end - def self.system_commands - @system_commands ||= [] + def self.system_commands + @system_commands ||= [] + end + end end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/support/cleanup.rb
@@ -1,12 +1,10 @@ -module Hbc::CleanupHooks - def after_teardown - super - Hbc.installed.each do |cask| - Hbc::Installer.new(cask).purge_versioned_files +module MiniTest + class Spec + def after_teardown + super + Hbc.installed.each do |cask| + Hbc::Installer.new(cask).purge_versioned_files + end end end end - -class MiniTest::Spec - include Hbc::CleanupHooks -end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/support/fake_dirs.rb
@@ -24,6 +24,8 @@ def after_teardown end end -class MiniTest::Spec - include FakeDirHooks +module MiniTest + class Spec + include FakeDirHooks + end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/support/fake_fetcher.rb
@@ -1,20 +1,22 @@ -class Hbc::FakeFetcher - def self.fake_response_for(url, response) - @responses[url] = response - end +module Hbc + class FakeFetcher + def self.fake_response_for(url, response) + @responses[url] = response + end - def self.head(url) - @responses ||= {} - raise("no response faked for #{url.inspect}") unless @responses.key?(url) - @responses[url] - end + def self.head(url) + @responses ||= {} + raise("no response faked for #{url.inspect}") unless @responses.key?(url) + @responses[url] + end - def self.init - @responses = {} - end + def self.init + @responses = {} + end - def self.clear - @responses = {} + def self.clear + @responses = {} + end end end @@ -30,6 +32,8 @@ def after_teardown end end -class MiniTest::Spec - include FakeFetcherHooks +module MiniTest + class Spec + include FakeFetcherHooks + end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/support/fake_system_command.rb
@@ -1,61 +1,63 @@ -class Hbc::FakeSystemCommand - def self.responses - @responses ||= {} - end +module Hbc + class FakeSystemCommand + def self.responses + @responses ||= {} + end - def self.expectations - @expectations ||= {} - end + def self.expectations + @expectations ||= {} + end - def self.system_calls - @system_calls ||= Hash.new(0) - end + def self.system_calls + @system_calls ||= Hash.new(0) + end - def self.clear - @responses = nil - @expectations = nil - @system_calls = nil - end + def self.clear + @responses = nil + @expectations = nil + @system_calls = nil + end - def self.stubs_command(command, response = "") - responses[command] = response - end + def self.stubs_command(command, response = "") + responses[command] = response + end - def self.expects_command(command, response = "", times = 1) - stubs_command(command, response) - expectations[command] = times - end + def self.expects_command(command, response = "", times = 1) + stubs_command(command, response) + expectations[command] = times + end - def self.expect_and_pass_through(command, times = 1) - pass_through = ->(cmd, opts) { Hbc::SystemCommand.run(cmd, opts) } - expects_command(command, pass_through, times) - end + def self.expect_and_pass_through(command, times = 1) + pass_through = ->(cmd, opts) { Hbc::SystemCommand.run(cmd, opts) } + expects_command(command, pass_through, times) + end - def self.verify_expectations! - expectations.each do |command, times| - unless system_calls[command] == times - raise("expected #{command.inspect} to be run #{times} times, but got #{system_calls[command]}") + def self.verify_expectations! + expectations.each do |command, times| + unless system_calls[command] == times + raise("expected #{command.inspect} to be run #{times} times, but got #{system_calls[command]}") + end end end - end - def self.run(command_string, options = {}) - command = Hbc::SystemCommand.new(command_string, options).command - unless responses.key?(command) - raise("no response faked for #{command.inspect}, faked responses are: #{responses.inspect}") - end - system_calls[command] += 1 + def self.run(command_string, options = {}) + command = Hbc::SystemCommand.new(command_string, options).command + unless responses.key?(command) + raise("no response faked for #{command.inspect}, faked responses are: #{responses.inspect}") + end + system_calls[command] += 1 - response = responses[command] - if response.respond_to?(:call) - response.call(command_string, options) - else - Hbc::SystemCommand::Result.new(command, response, "", 0) + response = responses[command] + if response.respond_to?(:call) + response.call(command_string, options) + else + Hbc::SystemCommand::Result.new(command, response, "", 0) + end end - end - def self.run!(command, options = {}) - run(command, options.merge(must_succeed: true)) + def self.run!(command, options = {}) + run(command, options.merge(must_succeed: true)) + end end end @@ -68,6 +70,8 @@ def after_teardown end end -class MiniTest::Spec - include FakeSystemCommandHooks +module MiniTest + class Spec + include FakeSystemCommandHooks + end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/support/never_sudo_system_command.rb
@@ -1,5 +1,7 @@ -class Hbc::NeverSudoSystemCommand < Hbc::SystemCommand - def self.run(command, options = {}) - super(command, options.merge(sudo: false)) +module Hbc + class NeverSudoSystemCommand < SystemCommand + def self.run(command, options = {}) + super(command, options.merge(sudo: false)) + end end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/support/shared_examples.rb
@@ -5,14 +5,18 @@ def self.shared_examples end end -module MiniTest::Spec::SharedExamples - def shared_examples_for(desc, &block) - MiniTest::Spec.shared_examples[desc] = block - end +module MiniTest + class Spec + module SharedExamples + def shared_examples_for(desc, &block) + MiniTest::Spec.shared_examples[desc] = block + end - def it_behaves_like(desc, *args, &block) - instance_exec(*args, &MiniTest::Spec.shared_examples[desc]) - instance_eval(&block) if block_given? + def it_behaves_like(desc, *args, &block) + instance_exec(*args, &MiniTest::Spec.shared_examples[desc]) + instance_eval(&block) if block_given? + end + end end end
true
Other
Homebrew
brew
b86c8efb79b3ed835d552c4d7416640ef10caf21.json
Cask: Use nested classes and modules.
Library/Homebrew/cask/test/test_helper.rb
@@ -159,7 +159,9 @@ def self.install_without_artifacts_with_caskfile(cask) FileUtils.mkdir_p Hbc.homebrew_prefix.join("bin") # Common superclass for test Casks for when we need to filter them out -class Hbc::TestCask < Hbc::Cask; end +module Hbc + class TestCask < Cask; end +end # jack in some optional utilities FileUtils.ln_s "/usr/local/bin/cabextract", Hbc.homebrew_prefix.join("bin/cabextract")
true
Other
Homebrew
brew
25df0c03d6abd79fbc103f3be9df38d48bd4f938.json
Store the formula used to build the keg in the keg Store the formula used to build the keg inside the keg in a file named NAME/VERSION/.brew/NAME.rb after removing the bottle do ... end block. See https://github.com/Homebrew/brew-evolution/pull/6. Closes https://github.com/Homebrew/brew/issues/931.
Library/Homebrew/cmd/list.rb
@@ -140,6 +140,8 @@ def initialize(path) # dylibs have multiple symlinks and we don't care about them (pnn.extname == ".dylib" || pnn.extname == ".pc") && !pnn.symlink? end + when ".brew" + # Ignore .brew else if pn.directory? if pn.symlink?
true
Other
Homebrew
brew
25df0c03d6abd79fbc103f3be9df38d48bd4f938.json
Store the formula used to build the keg in the keg Store the formula used to build the keg inside the keg in a file named NAME/VERSION/.brew/NAME.rb after removing the bottle do ... end block. See https://github.com/Homebrew/brew-evolution/pull/6. Closes https://github.com/Homebrew/brew/issues/931.
Library/Homebrew/formula_installer.rb
@@ -260,6 +260,12 @@ def install compute_and_install_dependencies if not_pouring && !ignore_deps? build clean + + # Store the formula used to build the keg in the keg. + s = formula.path.read.gsub(/ bottle do.+?end\n\n?/m, "") + brew_prefix = formula.prefix/".brew" + brew_prefix.mkdir + Pathname(brew_prefix/"#{formula.name}.rb").atomic_write(s) end build_bottle_postinstall if build_bottle?
true
Other
Homebrew
brew
25df0c03d6abd79fbc103f3be9df38d48bd4f938.json
Store the formula used to build the keg in the keg Store the formula used to build the keg inside the keg in a file named NAME/VERSION/.brew/NAME.rb after removing the bottle do ... end block. See https://github.com/Homebrew/brew-evolution/pull/6. Closes https://github.com/Homebrew/brew/issues/931.
Library/Homebrew/test/test_formula_installer.rb
@@ -58,6 +58,7 @@ def test_a_basic_install bin = HOMEBREW_PREFIX+"bin" assert_predicate bin, :directory? assert_equal 3, bin.children.length + assert_predicate f.prefix/".brew/testball.rb", :readable? end end
true
Other
Homebrew
brew
12aad5c65fee39c5f044e39ca1efcbed58aebd39.json
diagnostic: limit fatal dev tools check to Sierra
Library/Homebrew/extend/os/mac/diagnostic.rb
@@ -14,13 +14,13 @@ def development_tools_checks end def fatal_development_tools_checks - if ENV["TRAVIS"] || ARGV.homebrew_developer? + if MacOS.version >= :sierra && ENV["CI"].nil? %w[ + check_xcode_up_to_date + check_clt_up_to_date ] else %w[ - check_xcode_up_to_date - check_clt_up_to_date ] end end
false
Other
Homebrew
brew
2714b163f44c5d5580b0e535b17a41623005af69.json
rubocop: allow all current core formula names.
Library/.rubocop_rules.yml
@@ -116,7 +116,7 @@ Style/FileName: # FILENAME.rb (ARGV and ENV) # does not match: # dashes-and_underscores.rb - Regex: !ruby/regexp /^((([\dA-Z]+|[\da-z]+)(_([\dA-Z]+|[\da-z]+))*|(\-\-)?([\dA-Z]+|[\da-z]+)(-([\dA-Z]+|[\da-z]+))*))(\.rb)?$/ + Regex: !ruby/regexp /^((([\dA-Z]+|[\da-z\+]+)(_([\dA-Z]+|[\da-z\+]+))*|(\-\-)?([\dA-Z]+|[\da-z\+\.]+)([-@]([\dA-Z]+|[\da-z\+\.]+))*))(\.rb)?$/ # no percent word array, being friendly to non-ruby users # TODO: enforce when rubocop has fixed this
false
Other
Homebrew
brew
741e68766368b4ad18120a81b2180743790b529e.json
accessibility_test: fix warning message
Library/Homebrew/cask/test/cask/accessibility_test.rb
@@ -61,7 +61,7 @@ @installer.stubs(bundle_identifier: "com.example.BasicCask") capture_io { @installer.disable_accessibility_access }[1] - .must_match("Warning: Accessibility access was enabled for with-accessibility-access, but it is not safe to disable") + .must_match("Warning: Accessibility access cannot be disabled automatically on this version of macOS.") end it "warns about disabling accessibility access on new macOS releases" do MacOS.stubs(version: MacOS::Version.new("10.12"))
false
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/.rubocop_todo.yml
@@ -1,6 +1,6 @@ # This configuration was generated by -# `rubocop --auto-gen-config --exclude-limit 30` -# on 2016-09-18 15:15:22 +0100 using RuboCop version 0.41.2. +# `rubocop --auto-gen-config --exclude-limit 100` +# on 2016-09-20 22:03:20 +0200 using RuboCop version 0.43.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -80,12 +80,7 @@ Lint/RescueException: # Offense count: 1 Lint/ShadowedException: Exclude: - - 'Homebrew/brew.rb' - -# Offense count: 2 -Lint/UselessAssignment: - Exclude: - - 'Homebrew/requirements.rb' + - 'Homebrew/utils/fork.rb' # Offense count: 18 Metrics/BlockNesting: @@ -94,9 +89,9 @@ Metrics/BlockNesting: # Offense count: 20 # Configuration parameters: CountComments. Metrics/ModuleLength: - Max: 400 + Max: 373 -# Offense count: 1 +# Offense count: 2 # Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: Max: 6 @@ -125,25 +120,10 @@ Style/Alias: Exclude: - 'Homebrew/blacklist.rb' -# Offense count: 26 +# Offense count: 1 Style/CaseEquality: Exclude: - - 'Homebrew/cleanup.rb' - - 'Homebrew/cmd/search.rb' - 'Homebrew/compilers.rb' - - 'Homebrew/cxxstdlib.rb' - - 'Homebrew/debrew.rb' - - 'Homebrew/dependencies.rb' - - 'Homebrew/dependency_collector.rb' - - 'Homebrew/download_strategy.rb' - - 'Homebrew/formula.rb' - - 'Homebrew/options.rb' - - 'Homebrew/patch.rb' - - 'Homebrew/pkg_version.rb' - - 'Homebrew/requirement.rb' - - 'Homebrew/requirements.rb' - - 'Homebrew/software_spec.rb' - - 'Homebrew/version.rb' # Offense count: 1 # Cop supports --auto-correct. @@ -193,11 +173,103 @@ Style/GlobalVars: - 'Homebrew/diagnostic.rb' - 'Homebrew/utils.rb' +# Offense count: 97 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'Taps/**/*' + - 'Homebrew/brew.rb' + - 'Homebrew/build.rb' + - 'Homebrew/caveats.rb' + - 'Homebrew/cleaner.rb' + - 'Homebrew/cmd/cleanup.rb' + - 'Homebrew/cmd/diy.rb' + - 'Homebrew/cmd/info.rb' + - 'Homebrew/cmd/install.rb' + - 'Homebrew/cmd/reinstall.rb' + - 'Homebrew/cmd/search.rb' + - 'Homebrew/cmd/update-report.rb' + - 'Homebrew/dependency_collector.rb' + - 'Homebrew/dev-cmd/audit.rb' + - 'Homebrew/dev-cmd/bottle.rb' + - 'Homebrew/dev-cmd/pull.rb' + - 'Homebrew/dev-cmd/test-bot.rb' + - 'Homebrew/download_strategy.rb' + - 'Homebrew/extend/ARGV.rb' + - 'Homebrew/extend/ENV/shared.rb' + - 'Homebrew/extend/ENV/std.rb' + - 'Homebrew/extend/ENV/super.rb' + - 'Homebrew/extend/fileutils.rb' + - 'Homebrew/extend/os/mac/extend/ENV/std.rb' + - 'Homebrew/extend/os/mac/formula_cellar_checks.rb' + - 'Homebrew/extend/os/mac/utils/bottles.rb' + - 'Homebrew/extend/string.rb' + - 'Homebrew/formula.rb' + - 'Homebrew/formula_installer.rb' + - 'Homebrew/formula_lock.rb' + - 'Homebrew/formulary.rb' + - 'Homebrew/keg.rb' + - 'Homebrew/migrator.rb' + - 'Homebrew/os/mac/xcode.rb' + - 'Homebrew/patch.rb' + - 'Homebrew/requirement.rb' + - 'Homebrew/tap.rb' + - 'Homebrew/test/test_cmd_testbot.rb' + - 'Homebrew/test/test_integration_cmds.rb' + - 'Homebrew/test/testing_env.rb' + - 'Homebrew/utils.rb' + - 'Homebrew/utils/popen.rb' + - 'Homebrew/version.rb' + # Offense count: 2 Style/IdenticalConditionalBranches: Exclude: - 'Homebrew/formula_lock.rb' +# Offense count: 52 +# Cop supports --auto-correct. +# Configuration parameters: MaxLineLength. +Style/IfUnlessModifier: + Exclude: + - 'Taps/**/*' + - 'Homebrew/dev-cmd/audit.rb' + - 'Homebrew/dev-cmd/bottle.rb' + - 'Homebrew/dev-cmd/edit.rb' + - 'Homebrew/dev-cmd/mirror.rb' + - 'Homebrew/dev-cmd/pull.rb' + - 'Homebrew/dev-cmd/test-bot.rb' + - 'Homebrew/extend/ENV/std.rb' + - 'Homebrew/extend/ENV/super.rb' + - 'Homebrew/extend/os/blacklist.rb' + - 'Homebrew/extend/os/bottles.rb' + - 'Homebrew/extend/os/cleaner.rb' + - 'Homebrew/extend/os/development_tools.rb' + - 'Homebrew/extend/os/diagnostic.rb' + - 'Homebrew/extend/os/emoji.rb' + - 'Homebrew/extend/os/extend/ENV/shared.rb' + - 'Homebrew/extend/os/extend/ENV/std.rb' + - 'Homebrew/extend/os/extend/ENV/super.rb' + - 'Homebrew/extend/os/formula_cellar_checks.rb' + - 'Homebrew/extend/os/keg_relocate.rb' + - 'Homebrew/extend/os/mac/extend/ENV/shared.rb' + - 'Homebrew/extend/os/system_config.rb' + - 'Homebrew/formula.rb' + - 'Homebrew/formula_installer.rb' + - 'Homebrew/formula_versions.rb' + - 'Homebrew/formulary.rb' + - 'Homebrew/language/haskell.rb' + - 'Homebrew/migrator.rb' + - 'Homebrew/os/mac/cctools_mach.rb' + - 'Homebrew/tab.rb' + - 'Homebrew/utils/git.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: SupportedStyles, IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Style/IndentArray: + EnforcedStyle: special_inside_parentheses + # Offense count: 5 # Configuration parameters: EnforcedStyle, SupportedStyles. # SupportedStyles: snake_case, camelCase @@ -249,6 +321,11 @@ Style/Next: Exclude: - 'Homebrew/dev-cmd/test-bot.rb' +# Offense count: 1 +# Cop supports --auto-correct. +Style/NumericLiterals: + MinDigits: 6 + # Offense count: 9 Style/OpMethod: Exclude: @@ -291,3 +368,18 @@ Style/Semicolon: Style/SingleLineBlockParams: Exclude: - 'Homebrew/diagnostic.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: SupportedStyles. +# SupportedStyles: use_perl_names, use_english_names +Style/SpecialGlobalVars: + EnforcedStyle: use_perl_names + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SupportedStyles, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses +Style/TernaryParentheses: + Exclude: + - 'Homebrew/formula.rb'
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/cask/.rubocop.yml
@@ -1,6 +1,7 @@ AllCops: TargetRubyVersion: 2.0 Exclude: + - '**/.simplecov' - '**/Casks/**/*' - '**/vendor/**/*'
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/cleanup.rb
@@ -66,7 +66,7 @@ def self.cleanup_cache(cache = HOMEBREW_CACHE) next unless path.file? file = path - if Pathname::BOTTLE_EXTNAME_RX === file.to_s + if file.to_s =~ Pathname::BOTTLE_EXTNAME_RX version = begin Utils::Bottles.resolve_version(file) rescue @@ -86,7 +86,7 @@ def self.cleanup_cache(cache = HOMEBREW_CACHE) next end - file_is_stale = if PkgVersion === version + file_is_stale = if version.is_a?(PkgVersion) f.pkg_version > version else f.version > version
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/cmd/search.rb
@@ -150,7 +150,7 @@ def search_tap(user, repo, rx) names = remote_tap_formulae["#{user}/#{repo}"] user = user.downcase if user == "Homebrew" # special handling for the Homebrew organization - names.select { |name| rx === name }.map { |name| "#{user}/#{repo}/#{name}" } + names.select { |name| name =~ rx }.map { |name| "#{user}/#{repo}/#{name}" } rescue GitHub::HTTPNotFoundError opoo "Failed to search tap: #{user}/#{repo}. Please run `brew update`" []
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/cxxstdlib.rb
@@ -16,7 +16,7 @@ def self.create(type, compiler) if type && ![:libstdcxx, :libcxx].include?(type) raise ArgumentError, "Invalid C++ stdlib type: #{type}" end - klass = GNU_GCC_REGEXP === compiler.to_s ? GnuStdlib : AppleStdlib + klass = compiler.to_s =~ GNU_GCC_REGEXP ? GnuStdlib : AppleStdlib klass.new(type, compiler) end
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/debrew.rb
@@ -118,20 +118,22 @@ def self.debug(e) menu.prompt = "Choose an action: " menu.choice(:raise) { original_raise(e) } - menu.choice(:ignore) { return :ignore } if Ignorable === e + menu.choice(:ignore) { return :ignore } if e.is_a?(Ignorable) menu.choice(:backtrace) { puts e.backtrace } - menu.choice(:irb) do - puts "When you exit this IRB session, execution will continue." - set_trace_func proc { |event, _, _, id, binding, klass| - if klass == Raise && id == :raise && event == "return" - set_trace_func(nil) - synchronize { IRB.start_within(binding) } - end - } - - return :ignore - end if Ignorable === e + if e.is_a?(Ignorable) + menu.choice(:irb) do + puts "When you exit this IRB session, execution will continue." + set_trace_func proc { |event, _, _, id, binding, klass| + if klass == Raise && id == :raise && event == "return" + set_trace_func(nil) + synchronize { IRB.start_within(binding) } + end + } + + return :ignore + end + end menu.choice(:shell) do puts "When you exit this shell, you will return to the menu."
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/dependencies.rb
@@ -69,7 +69,7 @@ def each(*args, &block) end def <<(other) - if Comparable === other + if other.is_a?(Comparable) @reqs.grep(other.class) do |req| return self if req > other @reqs.delete(req)
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/dependency_collector.rb
@@ -49,15 +49,15 @@ def fetch(spec) end def cache_key(spec) - if Resource === spec && spec.download_strategy == CurlDownloadStrategy + if spec.is_a?(Resource) && spec.download_strategy == CurlDownloadStrategy File.extname(spec.url) else spec end end def build(spec) - spec, tags = Hash === spec ? spec.first : spec + spec, tags = spec.is_a?(Hash) ? spec.first : spec parse_spec(spec, Array(tags)) end @@ -81,7 +81,7 @@ def parse_spec(spec, tags) end def parse_string_spec(spec, tags) - if HOMEBREW_TAP_FORMULA_REGEX === spec + if spec =~ HOMEBREW_TAP_FORMULA_REGEX TapDependency.new(spec, tags) elsif tags.empty? Dependency.new(spec, tags)
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/download_strategy.rb
@@ -668,7 +668,7 @@ def is_shallow_clone? end def support_depth? - @ref_type != :revision && SHALLOW_CLONE_WHITELIST.any? { |rx| rx === @url } + @ref_type != :revision && SHALLOW_CLONE_WHITELIST.any? { |regex| @url =~ regex } end def git_dir @@ -1021,9 +1021,9 @@ class DownloadStrategyDetector def self.detect(url, strategy = nil) if strategy.nil? detect_from_url(url) - elsif Class === strategy && strategy < AbstractDownloadStrategy + elsif strategy.is_a?(Class) && strategy < AbstractDownloadStrategy strategy - elsif Symbol === strategy + elsif strategy.is_a?(Symbol) detect_from_symbol(strategy) else raise TypeError,
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/formula.rb
@@ -1052,7 +1052,7 @@ def link_overwrite?(path) self.class.link_overwrite_paths.any? do |p| p == to_check || to_check.start_with?(p.chomp("/") + "/") || - /^#{Regexp.escape(p).gsub('\*', ".*?")}$/ === to_check + to_check =~ /^#{Regexp.escape(p).gsub('\*', ".*?")}$/ end end @@ -1246,7 +1246,7 @@ def hash # @private def <=>(other) - return unless Formula === other + return unless other.is_a?(Formula) name <=> other.name end @@ -2226,7 +2226,7 @@ def conflicts # If this formula conflicts with another one. # <pre>conflicts_with "imagemagick", :because => "because this is just a stupid example"</pre> def conflicts_with(*names) - opts = Hash === names.last ? names.pop : {} + opts = names.last.is_a?(Hash) ? names.pop : {} names.each { |name| conflicts << FormulaConflict.new(name, opts[:because]) } end
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/options.rb
@@ -14,7 +14,7 @@ def to_s end def <=>(other) - return unless Option === other + return unless other.is_a?(Option) name <=> other.name end
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/patch.rb
@@ -89,7 +89,7 @@ def contents path.open("rb") do |f| begin line = f.gets - end until line.nil? || /^__END__$/ === line + end until line.nil? || line =~ /^__END__$/ data << line while line = f.gets end data
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/pkg_version.rb
@@ -32,7 +32,7 @@ def to_s alias_method :to_str, :to_s def <=>(other) - return unless PkgVersion === other + return unless other.is_a?(PkgVersion) (version <=> other.version).nonzero? || revision <=> other.revision end alias_method :eql?, :==
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/requirement.rb
@@ -83,7 +83,7 @@ def modify_build_environment # PATH. # This is undocumented magic and it should be removed, but we need to add # a way to declare path-based requirements that work with superenv first. - if Pathname === @satisfied_result + if @satisfied_result.is_a?(Pathname) parent = @satisfied_result.parent unless ENV["PATH"].split(File::PATH_SEPARATOR).include?(parent.to_s) ENV.append_path("PATH", parent) @@ -115,7 +115,7 @@ def inspect def to_dependency f = self.class.default_formula raise "No default formula defined for #{inspect}" if f.nil? - if HOMEBREW_TAP_FORMULA_REGEX === f + if f =~ HOMEBREW_TAP_FORMULA_REGEX TapDependency.new(f, tags, method(:modify_build_environment), name) else Dependency.new(f, tags, method(:modify_build_environment), name)
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/requirements.rb
@@ -22,7 +22,7 @@ class XcodeRequirement < Requirement satisfy(build_env: false) { xcode_installed_version } def initialize(tags) - @version = tags.find { |t| tags.delete(t) if /(\d\.)+\d/ === t } + @version = tags.find { |tag| tags.delete(tag) if tag =~ /(\d\.)+\d/ } super end
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/software_spec.rb
@@ -116,12 +116,12 @@ def option_defined?(name) def option(name, description = "") opt = PREDEFINED_OPTIONS.fetch(name) do - if Symbol === name + if name.is_a?(Symbol) opoo "Passing arbitrary symbols to `option` is deprecated: #{name.inspect}" puts "Symbols are reserved for future use, please pass a string instead" name = name.to_s end - unless String === name + unless name.is_a?(String) raise ArgumentError, "option name must be string or symbol; got a #{name.class}: #{name}" end raise ArgumentError, "option name is required" if name.empty?
true
Other
Homebrew
brew
52ff98853068c03b3bfa777932da1da69e35e583.json
Fix RuboCop CaseEquality.
Library/Homebrew/version.rb
@@ -208,7 +208,7 @@ def head? end def <=>(other) - return unless Version === other + return unless other.is_a?(Version) return 0 if version == other.version return 1 if head? && !other.head? return -1 if !head? && other.head?
true
Other
Homebrew
brew
a5f050245e1d10654c3f90e1df30de56f49b059e.json
Add Regex for `Style/FileName` cop.
Library/.rubocop_rules.yml
@@ -98,10 +98,14 @@ Style/IfUnlessModifier: Enabled: false # dashes in filenames are typical -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1545 Style/FileName: - Enabled: false + # matches: + # file_name.rb (default) + # file-name.rb, --filename.rb (command names) + # FILENAME.rb (ARGV and ENV) + # does not match: + # dashes-and_underscores.rb + Regex: !ruby/regexp /^((([\dA-Z]+|[\da-z]+)(_([\dA-Z]+|[\da-z]+))*|(\-\-)?([\dA-Z]+|[\da-z]+)(-([\dA-Z]+|[\da-z]+))*))(\.rb)?$/ # no percent word array, being friendly to non-ruby users # TODO: enforce when rubocop has fixed this
true
Other
Homebrew
brew
a5f050245e1d10654c3f90e1df30de56f49b059e.json
Add Regex for `Style/FileName` cop.
Library/Homebrew/cask/.rubocop.yml
@@ -91,7 +91,7 @@ Style/Documentation: Enabled: false Style/FileName: - Enabled: false + Regex: !ruby/regexp /^((([\dA-Z]+|[\da-z]+)(_([\dA-Z]+|[\da-z]+))*|(\-\-)?([\dA-Z]+|[\da-z]+)(-([\dA-Z]+|[\da-z]+))*))(\.rb)?$/ Style/HashSyntax: EnforcedStyle: ruby19_no_mixed_keys
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/.rubocop.yml
@@ -31,9 +31,6 @@ Metrics/ModuleLength: Metrics/PerceivedComplexity: Enabled: false -Performance/StringReplacement: - Enabled: false - Style/AlignHash: EnforcedHashRocketStyle: table EnforcedColonStyle: table @@ -129,6 +126,8 @@ Style/RegexpLiteral: Style/StringLiterals: EnforcedStyle: double_quotes +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + Style/TrailingCommaInLiteral: EnforcedStyleForMultiline: comma -
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/artifact/abstract_flight_block.rb
@@ -10,7 +10,7 @@ def self.uninstall_artifact_dsl_key end def self.class_for_dsl_key(dsl_key) - Object.const_get("Hbc::DSL::#{dsl_key.to_s.split('_').collect(&:capitalize).join}") + Object.const_get("Hbc::DSL::#{dsl_key.to_s.split("_").collect(&:capitalize).join}") end def self.me?(cask)
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/artifact/moved.rb
@@ -64,9 +64,9 @@ def warning_target_exists def delete ohai "Removing #{self.class.artifact_english_name}: '#{target}'" - if MacOS.undeletable?(target) - raise Hbc::CaskError, "Cannot remove undeletable #{self.class.artifact_english_name}" - elsif force + raise Hbc::CaskError, "Cannot remove undeletable #{self.class.artifact_english_name}" if MacOS.undeletable?(target) + + if force Hbc::Utils.gain_permissions_remove(target, command: @command) else target.rmtree
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cache.rb
@@ -3,32 +3,32 @@ module Hbc::Cache def ensure_cache_exists return if Hbc.cache.exist? + odebug "Creating Cache at #{Hbc.cache}" Hbc.cache.mkpath end def migrate_legacy_cache - if Hbc.legacy_cache.exist? - ohai "Migrating cached files to #{Hbc.cache}..." - - Hbc.legacy_cache.children.select(&:symlink?).each do |symlink| - file = symlink.readlink + return unless Hbc.legacy_cache.exist? - new_name = file.basename - .sub(%r{\-((?:(\d|#{Hbc::DSL::Version::DIVIDER_REGEX})*\-\2*)*[^\-]+)$}x, - '--\1') + ohai "Migrating cached files to #{Hbc.cache}..." + Hbc.legacy_cache.children.select(&:symlink?).each do |symlink| + file = symlink.readlink - renamed_file = Hbc.cache.join(new_name) + new_name = file.basename + .sub(%r{\-((?:(\d|#{Hbc::DSL::Version::DIVIDER_REGEX})*\-\2*)*[^\-]+)$}x, + '--\1') - if file.exist? - puts "#{file} -> #{renamed_file}" - FileUtils.mv(file, renamed_file) - end + renamed_file = Hbc.cache.join(new_name) - FileUtils.rm(symlink) + if file.exist? + puts "#{file} -> #{renamed_file}" + FileUtils.mv(file, renamed_file) end - FileUtils.remove_entry_secure(Hbc.legacy_cache) + FileUtils.rm(symlink) end + + FileUtils.remove_entry_secure(Hbc.legacy_cache) end end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cask.rb
@@ -87,28 +87,29 @@ def to_s end def dumpcask - if Hbc.respond_to?(:debug) && Hbc.debug - odebug "Cask instance dumps in YAML:" - odebug "Cask instance toplevel:", to_yaml - [ - :name, - :homepage, - :url, - :appcast, - :version, - :license, - :sha256, - :artifacts, - :caveats, - :depends_on, - :conflicts_with, - :container, - :gpg, - :accessibility_access, - :auto_updates, - ].each do |method| - odebug "Cask instance method '#{method}':", send(method).to_yaml - end + return unless Hbc.respond_to?(:debug) + return unless Hbc.debug + + odebug "Cask instance dumps in YAML:" + odebug "Cask instance toplevel:", to_yaml + [ + :name, + :homepage, + :url, + :appcast, + :version, + :license, + :sha256, + :artifacts, + :caveats, + :depends_on, + :conflicts_with, + :container, + :gpg, + :accessibility_access, + :auto_updates, + ].each do |method| + odebug "Cask instance method '#{method}':", send(method).to_yaml end end end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/caskroom.rb
@@ -3,39 +3,39 @@ module Hbc::Caskroom def migrate_caskroom_from_repo_to_prefix repo_caskroom = Hbc.homebrew_repository.join("Caskroom") - if !Hbc.caskroom.exist? && repo_caskroom.directory? - ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX" + return if Hbc.caskroom.exist? + return unless repo_caskroom.directory? - if Hbc.caskroom.parent.writable? - FileUtils.mv repo_caskroom, Hbc.caskroom - else - opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom." - system "/usr/bin/sudo", "--", "/bin/mv", "--", repo_caskroom.to_s, Hbc.caskroom.parent.to_s - end + ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX" + + if Hbc.caskroom.parent.writable? + FileUtils.mv repo_caskroom, Hbc.caskroom + else + opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom." + system "/usr/bin/sudo", "--", "/bin/mv", "--", repo_caskroom.to_s, Hbc.caskroom.parent.to_s end end def ensure_caskroom_exists - unless Hbc.caskroom.exist? - ohai "Creating Caskroom at #{Hbc.caskroom}" + return if Hbc.caskroom.exist? - if Hbc.caskroom.parent.writable? - Hbc.caskroom.mkpath - else - ohai "We'll set permissions properly so we won't need sudo in the future" - toplevel_dir = Hbc.caskroom - toplevel_dir = toplevel_dir.parent until toplevel_dir.parent.root? - unless toplevel_dir.directory? - # If a toplevel dir such as '/opt' must be created, enforce standard permissions. - # sudo in system is rude. - system "/usr/bin/sudo", "--", "/bin/mkdir", "--", toplevel_dir - system "/usr/bin/sudo", "--", "/bin/chmod", "--", "0775", toplevel_dir - end + ohai "Creating Caskroom at #{Hbc.caskroom}" + if Hbc.caskroom.parent.writable? + Hbc.caskroom.mkpath + else + ohai "We'll set permissions properly so we won't need sudo in the future" + toplevel_dir = Hbc.caskroom + toplevel_dir = toplevel_dir.parent until toplevel_dir.parent.root? + unless toplevel_dir.directory? + # If a toplevel dir such as '/opt' must be created, enforce standard permissions. # sudo in system is rude. - system "/usr/bin/sudo", "--", "/bin/mkdir", "-p", "--", Hbc.caskroom - unless Hbc.caskroom.parent == toplevel_dir - system "/usr/bin/sudo", "--", "/usr/sbin/chown", "-R", "--", "#{Hbc::Utils.current_user}:staff", Hbc.caskroom.parent.to_s - end + system "/usr/bin/sudo", "--", "/bin/mkdir", "--", toplevel_dir + system "/usr/bin/sudo", "--", "/bin/chmod", "--", "0775", toplevel_dir + end + # sudo in system is rude. + system "/usr/bin/sudo", "--", "/bin/mkdir", "-p", "--", Hbc.caskroom + unless Hbc.caskroom.parent == toplevel_dir + system "/usr/bin/sudo", "--", "/usr/sbin/chown", "-R", "--", "#{Hbc::Utils.current_user}:staff", Hbc.caskroom.parent.to_s end end end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli.rb
@@ -117,11 +117,11 @@ def self.run_command(command, *rest) rescue NameError nil end + if klass.respond_to?(:run) # invoke "run" on a Ruby library which follows our coding conventions - klass.run(*rest) - else # other Ruby libraries must do everything via "require" + klass.run(*rest) end elsif Hbc::Utils.which "brewcask-#{command}" # arbitrary external executable on PATH, Homebrew-style
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/audit.rb
@@ -6,7 +6,7 @@ def self.help def self.run(*args) failed_casks = new(args, Hbc::Auditor).run return if failed_casks.empty? - raise Hbc::CaskError, "audit failed for casks: #{failed_casks.join(' ')}" + raise Hbc::CaskError, "audit failed for casks: #{failed_casks.join(" ")}" end def initialize(args, auditor)
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/cleanup.rb
@@ -65,7 +65,7 @@ def disk_cleanup_size def remove_cache_files(*tokens) message = "Removing cached downloads" - message.concat " for #{tokens.join(', ')}" unless tokens.empty? + message.concat " for #{tokens.join(", ")}" unless tokens.empty? message.concat " older than #{OUTDATED_DAYS} days old" if outdated_only ohai message
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/doctor.rb
@@ -54,7 +54,7 @@ def self.homebrew_origin if homebrew_origin !~ %r{\S} homebrew_origin = "#{none_string} #{error_string}" elsif homebrew_origin !~ %r{(mxcl|Homebrew)/(home)?brew(\.git)?\Z} - homebrew_origin.concat " #{error_string 'warning: nonstandard origin'}" + homebrew_origin.concat " #{error_string "warning: nonstandard origin"}" end rescue StandardError homebrew_origin = error_string "Not Found - Error running git" @@ -106,7 +106,7 @@ def self.locale_variables end def self.privileged_uid - Process.euid == 0 ? "Yes #{error_string 'warning: not recommended'}" : "No" + Process.euid.zero? ? "Yes #{error_string "warning: not recommended"}" : "No" rescue StandardError notfound_string end @@ -143,7 +143,7 @@ def self.render_tap_paths(paths) if dir.nil? || dir.to_s.empty? none_string elsif dir.to_s.match(legacy_tap_pattern) - dir.to_s.concat(" #{error_string 'Warning: legacy tap path'}") + dir.to_s.concat(" #{error_string "Warning: legacy tap path"}") else dir.to_s end @@ -175,9 +175,9 @@ def self.render_install_location def self.render_staging_location(path) path = Pathname.new(path) if !path.exist? - "#{path} #{error_string 'error: path does not exist'}}" + "#{path} #{error_string "error: path does not exist"}}" elsif !path.writable? - "#{path} #{error_string 'error: not writable by current user'}" + "#{path} #{error_string "error: not writable by current user"}" else path end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/install.rb
@@ -36,7 +36,7 @@ def self.install_casks(cask_tokens, force, skip_cask_deps, require_sha) count += 1 end end - count == 0 ? nil : count == cask_tokens.length + count.zero? ? nil : count == cask_tokens.length end def self.warn_unavailable_with_suggestion(cask_token, e)
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/internal_audit_modified_casks.rb
@@ -62,7 +62,7 @@ def run end def git_root - @git_root ||= git(*%w[rev-parse --show-toplevel]) + @git_root ||= git("rev-parse", "--show-toplevel") end def modified_cask_files @@ -83,8 +83,8 @@ def modified_casks @modified_casks = modified_cask_files.map { |f| Hbc.load(f) } if @modified_casks.any? num_modified = @modified_casks.size - ohai "#{num_modified} modified #{pluralize('cask', num_modified)}: " \ - "#{@modified_casks.join(' ')}" + ohai "#{num_modified} modified #{pluralize("cask", num_modified)}: " \ + "#{@modified_casks.join(" ")}" end @modified_casks end @@ -122,7 +122,7 @@ def report_failures num_failed = failed_casks.size cask_pluralized = pluralize("cask", num_failed) odie "audit failed for #{num_failed} #{cask_pluralized}: " \ - "#{failed_casks.join(' ')}" + "#{failed_casks.join(" ")}" end def pluralize(str, num)
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/internal_dump.rb
@@ -21,7 +21,7 @@ def self.dump_casks(*cask_tokens) opoo "#{cask_token} was not found or would not load: #{e}" end end - count == 0 ? nil : count == cask_tokens.length + count.zero? ? nil : count == cask_tokens.length end def self.help
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -118,7 +118,7 @@ def self.print_stanzas(stanza, format = nil, table = nil, quiet = nil, *cask_tok count += 1 end - count == 0 ? nil : count == cask_tokens.length + count.zero? ? nil : count == cask_tokens.length end def self.help
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/list.rb
@@ -48,7 +48,7 @@ def self.list(*cask_tokens) end end - count == 0 ? nil : count == cask_tokens.length + count.zero? ? nil : count == cask_tokens.length end def self.list_artifacts(cask)
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/cli/uninstall.rb
@@ -28,8 +28,8 @@ def self.run(*args) single = versions.count == 1 puts <<-EOS.undent - #{cask_token} #{versions.join(', ')} #{single ? 'is' : 'are'} still installed. - Remove #{single ? 'it' : 'them all'} with `brew cask uninstall --force #{cask_token}`. + #{cask_token} #{versions.join(", ")} #{single ? "is" : "are"} still installed. + Remove #{single ? "it" : "them all"} with `brew cask uninstall --force #{cask_token}`. EOS end end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/dsl.rb
@@ -269,8 +269,16 @@ def installer(*args) end def method_missing(method, *) - Hbc::Utils.method_missing_message(method, token) - nil + if method + Hbc::Utils.method_missing_message(method, token) + nil + else + super + end + end + + def respond_to_missing?(*) + true end def appdir
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/dsl/base.rb
@@ -13,9 +13,17 @@ def system_command(executable, options = {}) end def method_missing(method, *) - underscored_class = self.class.name.gsub(%r{([[:lower:]])([[:upper:]][[:lower:]])}, '\1_\2').downcase - section = underscored_class.downcase.split("::").last - Hbc::Utils.method_missing_message(method, @cask.to_s, section) - nil + if method + underscored_class = self.class.name.gsub(%r{([[:lower:]])([[:upper:]][[:lower:]])}, '\1_\2').downcase + section = underscored_class.downcase.split("::").last + Hbc::Utils.method_missing_message(method, @cask.to_s, section) + nil + else + super + end + end + + def respond_to_missing?(*) + true end end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/dsl/stanza_proxy.rb
@@ -25,13 +25,21 @@ def encode_with(coder) coder["resolved"] = @resolver.call end - def respond_to?(symbol, include_private = false) - return true if %i{encode_with proxy? to_s type}.include?(symbol) - return false if symbol == :to_ary - @resolver.call.respond_to?(symbol, include_private) + def method_missing(method, *args) + if method != :to_ary + @resolver.call.send(method, *args) + else + super + end end - def method_missing(symbol, *args) - @resolver.call.send(symbol, *args) + def respond_to?(method, include_private = false) + return true if %i{encode_with proxy? to_s type}.include?(method) + return false if method == :to_ary + @resolver.call.respond_to?(method, include_private) + end + + def respond_to_missing?(*) + true end end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -139,15 +139,15 @@ def install_artifacts # dependencies should also apply for "brew cask stage" # override dependencies with --force or perhaps --force-deps def satisfy_dependencies - if @cask.depends_on - ohai "Satisfying dependencies" - macos_dependencies - arch_dependencies - x11_dependencies - formula_dependencies - cask_dependencies unless skip_cask_deps - puts "complete" - end + return unless @cask.depends_on + + ohai "Satisfying dependencies" + macos_dependencies + arch_dependencies + x11_dependencies + formula_dependencies + cask_dependencies unless skip_cask_deps + puts "complete" end def macos_dependencies @@ -159,7 +159,7 @@ def macos_dependencies end elsif @cask.depends_on.macos.length > 1 unless @cask.depends_on.macos.include?(Gem::Version.new(MacOS.version.to_s)) - raise Hbc::CaskError, "Cask #{@cask} depends on macOS release being one of [#{@cask.depends_on.macos.map(&:to_s).join(', ')}], but you are running release #{MacOS.version}." + raise Hbc::CaskError, "Cask #{@cask} depends on macOS release being one of [#{@cask.depends_on.macos.map(&:to_s).join(", ")}], but you are running release #{MacOS.version}." end else unless MacOS.version == @cask.depends_on.macos.first @@ -175,7 +175,7 @@ def arch_dependencies arch[:type] == @current_arch[:type] && Array(arch[:bits]).include?(@current_arch[:bits]) } - raise Hbc::CaskError, "Cask #{@cask} depends on hardware architecture being one of [#{@cask.depends_on.arch.map(&:to_s).join(', ')}], but you are running #{@current_arch}" + raise Hbc::CaskError, "Cask #{@cask} depends on hardware architecture being one of [#{@cask.depends_on.arch.map(&:to_s).join(", ")}], but you are running #{@current_arch}" end def x11_dependencies @@ -203,7 +203,7 @@ def formula_dependencies def cask_dependencies return unless @cask.depends_on.cask && !@cask.depends_on.cask.empty? - ohai "Installing Cask dependencies: #{@cask.depends_on.cask.join(', ')}" + ohai "Installing Cask dependencies: #{@cask.depends_on.cask.join(", ")}" deps = Hbc::CaskDependencies.new(@cask) deps.sorted.each do |dep_token| puts "#{dep_token} ..."
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/source/tapped_qualified.rb
@@ -11,7 +11,7 @@ def self.tap_for_query(query) qualified_token = Hbc::QualifiedToken.parse(query) return if qualified_token.nil? - user, repo, token = qualified_token + user, repo = qualified_token[0..1] Tap.fetch(user, repo) end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/system_command.rb
@@ -123,7 +123,7 @@ def plist end def success? - @exit_status == 0 + @exit_status.zero? end def merged_output
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/url_checker.rb
@@ -36,7 +36,7 @@ def run def _check_response_status ok = OK_RESPONSES[cask.url.scheme] return if ok.include?(@response_status) - add_error "unexpected http response, expecting #{ok.map(&:utf8_inspect).join(' or ')}, got #{@response_status.utf8_inspect}" + add_error "unexpected http response, expecting #{ok.map(&:utf8_inspect).join(" or ")}, got #{@response_status.utf8_inspect}" end def _get_data_from_request
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/lib/hbc/utils.rb
@@ -32,14 +32,15 @@ def tty? # global methods def odebug(title, *sput) - if Hbc.respond_to?(:debug) && Hbc.debug - width = Tty.width * 4 - 6 - if $stdout.tty? && title.to_s.length > width - title = title.to_s[0, width - 3] + "..." - end - puts "#{Tty.magenta}==>#{Tty.reset} #{Tty.white}#{title}#{Tty.reset}" - puts sput unless sput.empty? + return unless Hbc.respond_to?(:debug) + return unless Hbc.debug + + width = Tty.width * 4 - 6 + if $stdout.tty? && title.to_s.length > width + title = title.to_s[0, width - 3] + "..." end + puts "#{Tty.magenta}==>#{Tty.reset} #{Tty.white}#{title}#{Tty.reset}" + puts sput unless sput.empty? end module Hbc::Utils
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/spec/cask/cli/cleanup_spec.rb
@@ -12,7 +12,7 @@ describe "cleanup" do it "removes cached downloads of given casks" do - cleaned_up_cached_download = 'caffeine' + cleaned_up_cached_download = "caffeine" cached_downloads = [ cache_location.join("#{cleaned_up_cached_download}--latest.zip"),
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/spec/spec_helper.rb
@@ -9,7 +9,7 @@ project_root = Pathname.new(File.expand_path("../..", __FILE__)) # add Homebrew to load path -$LOAD_PATH.unshift(File.expand_path("#{ENV['HOMEBREW_REPOSITORY']}/Library/Homebrew")) +$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew")) require "global"
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/test/cask/artifact/two_apps_correct_test.rb
@@ -60,7 +60,6 @@ File.exist?(cask.staged_path.join("Caffeine Deluxe.app")).must_equal true end - describe "avoids clobbering an existing app" do let(:cask) { local_two_apps_caffeine } @@ -70,8 +69,8 @@ TestHelper.must_output(self, lambda { Hbc::Artifact::App.new(cask).install_phase }, <<-EOS.undent.chomp) - ==> It seems there is already an App at '#{Hbc.appdir.join('Caffeine Mini.app')}'; not moving. - ==> Moving App 'Caffeine Pro.app' to '#{Hbc.appdir.join('Caffeine Pro.app')}' + ==> It seems there is already an App at '#{Hbc.appdir.join("Caffeine Mini.app")}'; not moving. + ==> Moving App 'Caffeine Pro.app' to '#{Hbc.appdir.join("Caffeine Pro.app")}' EOS source_path = cask.staged_path.join("Caffeine Mini.app") @@ -85,8 +84,8 @@ TestHelper.must_output(self, lambda { Hbc::Artifact::App.new(cask).install_phase }, <<-EOS.undent.chomp) - ==> Moving App 'Caffeine Mini.app' to '#{Hbc.appdir.join('Caffeine Mini.app')}' - ==> It seems there is already an App at '#{Hbc.appdir.join('Caffeine Pro.app')}'; not moving. + ==> Moving App 'Caffeine Mini.app' to '#{Hbc.appdir.join("Caffeine Mini.app")}' + ==> It seems there is already an App at '#{Hbc.appdir.join("Caffeine Pro.app")}'; not moving. EOS source_path = cask.staged_path.join("Caffeine Pro.app")
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/test/cask/cli/list_test.rb
@@ -79,9 +79,9 @@ Hbc::CLI::List.run("local-transmission", "local-caffeine") }.must_output <<-EOS.undent ==> Apps - #{Hbc.appdir.join('Transmission.app')} (#{Hbc.appdir.join('Transmission.app').abv}) + #{Hbc.appdir.join("Transmission.app")} (#{Hbc.appdir.join("Transmission.app").abv}) ==> Apps - Missing App: #{Hbc.appdir.join('Caffeine.app')} + Missing App: #{Hbc.appdir.join("Caffeine.app")} EOS end end
true
Other
Homebrew
brew
59212445da7048233ef32705433e548783fcf84b.json
Run `rubocop —auto-correct`.
Library/Homebrew/cask/test/test_helper.rb
@@ -10,7 +10,7 @@ tap_root = Pathname.new(ENV["HOMEBREW_LIBRARY"]).join("Taps", "caskroom", "homebrew-cask") # add Homebrew to load path -$LOAD_PATH.unshift(File.expand_path("#{ENV['HOMEBREW_REPOSITORY']}/Library/Homebrew")) +$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew")) require "global"
true
Other
Homebrew
brew
2a1788484af2f7fc6acbbe03bdd6f36b8bad17a7.json
Remove dependency on `rubocop-cask`.
Library/Homebrew/cask/.rubocop.yml
@@ -1,10 +1,9 @@ -require: 'rubocop-cask' - AllCops: TargetRubyVersion: 2.0 + Include: + - '**/.simplecov' Exclude: - '**/Casks/**/*' - - 'developer/**/*' - '**/vendor/**/*' Metrics/AbcSize: @@ -16,10 +15,10 @@ Metrics/ClassLength: Metrics/CyclomaticComplexity: Enabled: false -Metrics/MethodLength: +Metrics/LineLength: Enabled: false -Metrics/PerceivedComplexity: +Metrics/MethodLength: Enabled: false Metrics/ModuleLength: @@ -29,6 +28,19 @@ Metrics/ModuleLength: - 'lib/hbc/macos.rb' - 'lib/hbc/utils.rb' +Metrics/PerceivedComplexity: + Enabled: false + +Performance/StringReplacement: + Enabled: false + +Style/AlignHash: + EnforcedHashRocketStyle: table + EnforcedColonStyle: table + +Style/BarePercentLiterals: + EnforcedStyle: percent_q + Style/BlockDelimiters: EnforcedStyle: semantic FunctionalMethods: @@ -75,15 +87,51 @@ Style/BlockDelimiters: - lambda - proc - Style/ClassAndModuleChildren: EnforcedStyle: compact +Style/Documentation: + Enabled: false + +Style/EmptyElse: + Enabled: false + +Style/FileName: + Enabled: false + +Style/HashSyntax: + EnforcedStyle: ruby19_no_mixed_keys + +Style/IndentArray: + EnforcedStyle: align_brackets + +Style/IndentHash: + EnforcedStyle: align_braces + +Style/PercentLiteralDelimiters: + PreferredDelimiters: + '%': '{}' + '%i': '{}' + '%q': '{}' + '%Q': '{}' + '%r': '{}' + '%s': '()' + '%w': '[]' + '%W': '[]' + '%x': '()' + Style/PredicateName: NameWhitelist: is_32_bit?, is_64_bit? Style/RaiseArgs: EnforcedStyle: exploded +Style/RegexpLiteral: + EnforcedStyle: percent_r + Style/StringLiterals: EnforcedStyle: double_quotes + +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: comma +
true
Other
Homebrew
brew
2a1788484af2f7fc6acbbe03bdd6f36b8bad17a7.json
Remove dependency on `rubocop-cask`.
Library/Homebrew/cask/Gemfile
@@ -7,10 +7,6 @@ group :debug do gem "pry-byebug", platforms: :mri end -group :development do - gem "rubocop-cask", "~> 0.8.3" -end - group :test do # This is SimpleCov v0.12.0 with two fixes merged on top, that finally resolve # all issues with parallel tests, uncovered files, and tracked files. Switch
true
Other
Homebrew
brew
2a1788484af2f7fc6acbbe03bdd6f36b8bad17a7.json
Remove dependency on `rubocop-cask`.
Library/Homebrew/cask/Gemfile.lock
@@ -12,7 +12,6 @@ GEM remote: https://rubygems.org/ specs: ansi (1.5.0) - ast (2.3.0) builder (3.2.2) byebug (9.0.5) codecov (0.1.5) @@ -36,18 +35,13 @@ GEM parallel (1.9.0) parallel_tests (2.9.0) parallel - parser (2.3.1.2) - ast (~> 2.2) - powerpack (0.1.1) pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) pry-byebug (3.4.0) byebug (~> 9.0) pry (~> 0.10) - public_suffix (2.0.2) - rainbow (2.1.0) rake (10.4.2) rspec (3.0.0) rspec-core (~> 3.0.0) @@ -66,19 +60,9 @@ GEM rspec-support (3.0.4) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (0.41.2) - parser (>= 2.3.1.1, < 3.0) - powerpack (~> 0.1) - rainbow (>= 1.99.1, < 3.0) - ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - rubocop-cask (0.8.3) - public_suffix (~> 2.0) - rubocop (~> 0.41.1) ruby-progressbar (1.8.1) simplecov-html (0.10.0) slop (3.6.0) - unicode-display_width (1.1.0) url (0.3.2) PLATFORMS @@ -96,7 +80,6 @@ DEPENDENCIES rspec (~> 3.0.0) rspec-its rspec-wait - rubocop-cask (~> 0.8.3) simplecov (= 0.12.0)! BUNDLED WITH
true
Other
Homebrew
brew
2a1788484af2f7fc6acbbe03bdd6f36b8bad17a7.json
Remove dependency on `rubocop-cask`.
Library/Homebrew/cask/Rakefile
@@ -1,6 +1,5 @@ require "rake/testtask" require "rspec/core/rake_task" -require "rubocop/rake_task" homebrew_repo = `brew --repository`.chomp $LOAD_PATH.unshift(File.expand_path("#{homebrew_repo}/Library/Homebrew")) @@ -18,12 +17,6 @@ namespace :test do end end -RuboCop::RakeTask.new(:rubocop) do |t| - t.options = ["--force-exclusion"] -end - -task default: [:rubocop] - desc "Open a REPL for debugging and experimentation" task :console do require "pry"
true
Other
Homebrew
brew
58a2ef9b58d90dd831647f1bcc39e8597be5a7b8.json
version: improve alpha and rc detection
Library/Homebrew/version.rb
@@ -340,8 +340,8 @@ def self._parse(spec) m = /-((?:\d+\.)*\d+(?:[abc]|rc|RC)\d*)$/.match(stem) return m.captures.first unless m.nil? - # e.g. foobar-4.5.0-beta1, or foobar-4.50-beta - m = /-((?:\d+\.)*\d+-beta\d*)$/.match(stem) + # e.g. foobar-4.5.0-alpha5, foobar-4.5.0-beta1, or foobar-4.50-beta + m = /-((?:\d+\.)*\d+-(?:alpha|beta|rc)\d*)$/.match(stem) return m.captures.first unless m.nil? # e.g. http://ftpmirror.gnu.org/libidn/libidn-1.29-win64.zip
false
Other
Homebrew
brew
6b855938951613fda85945578cbe6d9e7475a547.json
Fix coverage reporting.
Library/Homebrew/.simplecov
@@ -16,14 +16,15 @@ SimpleCov.start do add_filter "/Homebrew/vendor/" if ENV["HOMEBREW_INTEGRATION_TEST"] - command_name ENV["HOMEBREW_INTEGRATION_TEST"] + command_name "#{ENV["HOMEBREW_INTEGRATION_TEST"]} (#{$$})" at_exit do exit_code = $!.nil? ? 0 : $!.status $stdout.reopen("/dev/null") SimpleCov.result # Just save result, but don't write formatted output. exit! exit_code end else + command_name "#{command_name} (#{$$})" # Not using this during integration tests makes the tests 4x times faster # without changing the coverage. track_files "#{SimpleCov.root}/**/*.rb"
true
Other
Homebrew
brew
6b855938951613fda85945578cbe6d9e7475a547.json
Fix coverage reporting.
Library/Homebrew/cask/Gemfile
@@ -12,6 +12,15 @@ group :development do end group :test do + # This is SimpleCov v0.12.0 with two fixes merged on top, that finally resolve + # all issues with parallel tests, uncovered files, and tracked files. Switch + # back to stable as soon as v0.12.1 or v0.13.0 is released. For details, see: + # - https://github.com/colszowka/simplecov/pull/513 + # - https://github.com/colszowka/simplecov/pull/520 + gem "simplecov", "0.12.0", + git: "https://github.com/colszowka/simplecov.git", + branch: "master", # commit 83d8031ddde0927f87ef9327200a98583ca18d77 + require: false gem "codecov", require: false gem "minitest", "5.4.1" gem "minitest-reporters"
true
Other
Homebrew
brew
6b855938951613fda85945578cbe6d9e7475a547.json
Fix coverage reporting.
Library/Homebrew/cask/Gemfile.lock
@@ -1,3 +1,13 @@ +GIT + remote: https://github.com/colszowka/simplecov.git + revision: 83d8031ddde0927f87ef9327200a98583ca18d77 + branch: master + specs: + simplecov (0.12.0) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + GEM remote: https://rubygems.org/ specs: @@ -66,10 +76,6 @@ GEM public_suffix (~> 2.0) rubocop (~> 0.41.1) ruby-progressbar (1.8.1) - simplecov (0.12.0) - docile (~> 1.1.0) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) simplecov-html (0.10.0) slop (3.6.0) unicode-display_width (1.1.0) @@ -91,6 +97,7 @@ DEPENDENCIES rspec-its rspec-wait rubocop-cask (~> 0.8.3) + simplecov (= 0.12.0)! BUNDLED WITH - 1.12.5 + 1.13.1
true
Other
Homebrew
brew
6b855938951613fda85945578cbe6d9e7475a547.json
Fix coverage reporting.
Library/Homebrew/cask/spec/spec_helper.rb
@@ -4,7 +4,6 @@ if ENV["HOMEBREW_TESTS_COVERAGE"] require "simplecov" - SimpleCov.command_name "test:cask:rspec" end project_root = Pathname.new(File.expand_path("../..", __FILE__))
true
Other
Homebrew
brew
6b855938951613fda85945578cbe6d9e7475a547.json
Fix coverage reporting.
Library/Homebrew/cask/test/test_helper.rb
@@ -4,7 +4,6 @@ if ENV["HOMEBREW_TESTS_COVERAGE"] require "simplecov" - SimpleCov.command_name "test:cask:minitest" end project_root = Pathname.new(File.expand_path("../..", __FILE__))
true
Other
Homebrew
brew
6b855938951613fda85945578cbe6d9e7475a547.json
Fix coverage reporting.
Library/Homebrew/test/Gemfile
@@ -6,13 +6,14 @@ gem "rake", "~> 10.3" gem "parallel_tests", "~> 2.9" group :coverage do - # This is SimpleCov v0.12.0 with one PR merged on top, that finally resolves + # This is SimpleCov v0.12.0 with two fixes merged on top, that finally resolve # all issues with parallel tests, uncovered files, and tracked files. Switch - # back to stable as soon as v0.12.1 or v0.13.0 is released. See pull request - # <https://github.com/Homebrew/legacy-homebrew/pull/48250> for full details. + # back to stable as soon as v0.12.1 or v0.13.0 is released. For details, see: + # - https://github.com/colszowka/simplecov/pull/513 + # - https://github.com/colszowka/simplecov/pull/520 gem "simplecov", "0.12.0", git: "https://github.com/colszowka/simplecov.git", - branch: "master", # commit 257e26394c464c4ab388631b4eff1aa98c37d3f1 + branch: "master", # commit 83d8031ddde0927f87ef9327200a98583ca18d77 require: false gem "codecov", require: false end
true
Other
Homebrew
brew
6b855938951613fda85945578cbe6d9e7475a547.json
Fix coverage reporting.
Library/Homebrew/test/Gemfile.lock
@@ -1,6 +1,6 @@ GIT remote: https://github.com/colszowka/simplecov.git - revision: 257e26394c464c4ab388631b4eff1aa98c37d3f1 + revision: 83d8031ddde0927f87ef9327200a98583ca18d77 branch: master specs: simplecov (0.12.0)
true
Other
Homebrew
brew
0029ad2929d1ece249047b381299e63ba9b858fa.json
add the other test back in
Library/Homebrew/test/test_dependency_collector.rb
@@ -76,6 +76,11 @@ def test_x11_min_version_and_tag assert_predicate dep, :optional? end + def test_ant_dep + @d.add :ant => :build + assert_equal find_dependency("ant"), Dependency.new("ant", [:build]) + end + def test_raises_typeerror_for_unknown_classes assert_raises(TypeError) { @d.add(Class.new) } end
false
Other
Homebrew
brew
2e808ff2e33797247b40440e8797bd2500095d1f.json
Xcode.md: update 10.11 expectation
docs/Xcode.md
@@ -10,7 +10,7 @@ Tools available for your platform: 10.8 | 5.1.1 | April 2014 10.9 | 6.2 | 6.2 10.10 | 7.2.1 | 7.2 - 10.11 | 7.3.1 | 7.3 + 10.11 | 8.0 | 8.0 10.12 | 8.0 | 8.0
false
Other
Homebrew
brew
860f4bd11ff06e5875756991e423f33f9ae4f0c8.json
xcode: expect Xcode 8.0 on OS X 10.11
Library/Homebrew/os/mac/xcode.rb
@@ -15,7 +15,7 @@ def latest_version when "10.8" then "5.1.1" when "10.9" then "6.2" when "10.10" then "7.2.1" - when "10.11" then "7.3.1" + when "10.11" then "8.0" when "10.12" then "8.0" else # Default to newest known version of Xcode for unreleased macOS versions. @@ -195,7 +195,7 @@ def update_instructions def latest_version case MacOS.version when "10.12" then "800.0.38" - when "10.11" then "703.0.31" + when "10.11" then "800.0.38" when "10.10" then "700.1.81" when "10.9" then "600.0.57" when "10.8" then "503.0.40"
false
Other
Homebrew
brew
5c5c416d1cb2df75f430c30a8044c82e041f530c.json
cask-tests: remove Travis seed This hack has been in Homebrew Cask for more than two years (since 51f93e6dc9c3da4ab2118459ea95e45c104386ec), and it originated even earlier (6d2f7bc55af0b2aa915b2396d213e30a4446256c). Cask tests apparently aren't even run on Travis anymore, so this can be safely removed.
Library/Homebrew/cask/cmd/brew-cask-tests.rb
@@ -19,10 +19,6 @@ def run_tests(executable, files, args = []) rspec = ARGV.flag?("--rspec") || !ARGV.flag?("--minitest") minitest = ARGV.flag?("--minitest") || !ARGV.flag?("--rspec") - # TODO: setting the --seed here is an ugly temporary hack, to remain only - # until test-suite glitches are fixed. - ENV["TESTOPTS"] = "--seed=14830" if ENV["TRAVIS"] - ENV["HOMEBREW_TESTS_COVERAGE"] = "1" if ARGV.flag?("--coverage") if rspec
false
Other
Homebrew
brew
769cab7e4f936c8ebb04852b1f6202479a34710f.json
follow the pattern more closely
Library/Homebrew/extend/os/dependency_collector.rb
@@ -1,3 +1,5 @@ +require "dependency_collector" + if OS.mac? require "extend/os/mac/dependency_collector" elsif OS.linux?
true
Other
Homebrew
brew
769cab7e4f936c8ebb04852b1f6202479a34710f.json
follow the pattern more closely
Library/Homebrew/extend/os/linux/dependency_collector.rb
@@ -1,3 +1,5 @@ -def ant_dep(spec, tags) - Dependency.new(spec.to_s, tags) +class DependencyCollector + def ant_dep(spec, tags) + Dependency.new(spec.to_s, tags) + end end
true
Other
Homebrew
brew
769cab7e4f936c8ebb04852b1f6202479a34710f.json
follow the pattern more closely
Library/Homebrew/extend/os/mac/dependency_collector.rb
@@ -1,5 +1,7 @@ -def ant_dep(spec, tags) - if MacOS.version >= :mavericks - Dependency.new(spec.to_s, tags) +class DependencyCollector + def ant_dep(spec, tags) + if MacOS.version >= :mavericks + Dependency.new(spec.to_s, tags) + end end end
true
Other
Homebrew
brew
01b93117cddd2b90277bf1b8030675868328940b.json
move os checks to extend/os
Library/Homebrew/dependency_collector.rb
@@ -5,12 +5,6 @@ require "requirements" require "set" -if OS.mac? - require "extend/os/mac/dependency_collector" -elsif OS.linux? - require "extend/os/linux/dependency_collector" -end - ## A dependency is a formula that another formula needs to install. ## A requirement is something other than a formula that another formula ## needs to be present. This includes external language modules, @@ -175,3 +169,5 @@ def parse_url_spec(url, tags) end end end + +require "extend/os/dependency_collector"
true
Other
Homebrew
brew
01b93117cddd2b90277bf1b8030675868328940b.json
move os checks to extend/os
Library/Homebrew/extend/os/dependency_collector.rb
@@ -0,0 +1,5 @@ +if OS.mac? + require "extend/os/mac/dependency_collector" +elsif OS.linux? + require "extend/os/linux/dependency_collector" +end
true
Other
Homebrew
brew
25b6c0c23694a53176720a6c4330c6730707aaa7.json
Remove unnecessary skips
Library/Homebrew/test/test_os_mac_dependency_collector.rb
@@ -21,14 +21,12 @@ def test_ld64_dep_leopard_or_newer end def test_ant_dep_mavericks_or_newer - skip "Only for Mac OS" unless OS.mac? MacOS.stubs(:version).returns(MacOS::Version.new("10.9")) @d.add :ant => :build assert_equal find_dependency("ant"), Dependency.new("ant", [:build]) end def test_ant_dep_pre_mavericks - skip "Only for Mac OS" unless OS.mac? MacOS.stubs(:version).returns(MacOS::Version.new("10.7")) @d.add :ant => :build assert_nil find_dependency("ant")
false
Other
Homebrew
brew
54a086e2fe06218c8a336fb7033da60078db7d78.json
dependency_collector: Fix ant_dep for Linux. Signed-off-by: Bob W. Hogg <rwhogg@linux.com>
Library/Homebrew/dependency_collector.rb
@@ -136,7 +136,7 @@ def parse_class_spec(spec, tags) end def ant_dep(spec, tags) - if MacOS.version >= :mavericks + if MacOS.version >= :mavericks || !OS.mac? Dependency.new(spec.to_s, tags) end end
true
Other
Homebrew
brew
54a086e2fe06218c8a336fb7033da60078db7d78.json
dependency_collector: Fix ant_dep for Linux. Signed-off-by: Bob W. Hogg <rwhogg@linux.com>
Library/Homebrew/test/test_dependency_collector.rb
@@ -76,6 +76,20 @@ def test_x11_min_version_and_tag assert_predicate dep, :optional? end + def test_ant_dep_mavericks_or_newer + skip "Only for Mac OS" unless OS.mac? + MacOS.stubs(:version).returns(MacOS::Version.new("10.9")) + @d.add :ant => :build + assert_equal find_dependency("ant"), Dependency.new("ant", [:build]) + end + + def test_ant_dep_pre_mavericks + skip "Only for Mac OS" unless OS.mac? + MacOS.stubs(:version).returns(MacOS::Version.new("10.7")) + @d.add :ant => :build + assert_nil find_dependency("ant") + end + def test_raises_typeerror_for_unknown_classes assert_raises(TypeError) { @d.add(Class.new) } end
true
Other
Homebrew
brew
f0e9292acdcf2bd5604d69fc1070d6f159d0b34e.json
Use git describe to get the HOMEBREW_VERSION. For tagged commits produces the output: - `1.0.1` For untagged commits with a dirty tree produces the output: - `1.0.1-19-g23efbc5-dirty` Performance: ``` git describe --tags --dirty 2> /dev/null 0.07s user 0.01s system 96% cpu 0.086 total ``` This means we can tag any commit without needing to manually remember to bump the revision every time.
Library/Homebrew/brew.rb
@@ -14,7 +14,7 @@ require "global" if ARGV == %w[--version] || ARGV == %w[-v] - puts "Homebrew #{Homebrew.homebrew_version_string}" + puts "Homebrew #{HOMEBREW_VERSION}" puts "Homebrew/homebrew-core #{Homebrew.core_tap_version_string}" exit 0 end
true
Other
Homebrew
brew
f0e9292acdcf2bd5604d69fc1070d6f159d0b34e.json
Use git describe to get the HOMEBREW_VERSION. For tagged commits produces the output: - `1.0.1` For untagged commits with a dirty tree produces the output: - `1.0.1-19-g23efbc5-dirty` Performance: ``` git describe --tags --dirty 2> /dev/null 0.07s user 0.01s system 96% cpu 0.086 total ``` This means we can tag any commit without needing to manually remember to bump the revision every time.
Library/Homebrew/brew.sh
@@ -1,4 +1,8 @@ -HOMEBREW_VERSION="1.0.0" +HOMEBREW_VERSION="$(git describe --tags --dirty 2>/dev/null)" +if [[ -z "$HOMEBREW_VERSION" ]] +then + HOMEBREW_VERSION=">1.0.0 (no git repository)" +fi onoe() { if [[ -t 2 ]] # check whether stderr is a tty.
true
Other
Homebrew
brew
f0e9292acdcf2bd5604d69fc1070d6f159d0b34e.json
Use git describe to get the HOMEBREW_VERSION. For tagged commits produces the output: - `1.0.1` For untagged commits with a dirty tree produces the output: - `1.0.1-19-g23efbc5-dirty` Performance: ``` git describe --tags --dirty 2> /dev/null 0.07s user 0.01s system 96% cpu 0.086 total ``` This means we can tag any commit without needing to manually remember to bump the revision every time.
Library/Homebrew/utils.rb
@@ -248,15 +248,6 @@ def self.system(cmd, *args) _system(cmd, *args) end - def self.homebrew_version_string - if pretty_revision = HOMEBREW_REPOSITORY.git_short_head - last_commit = HOMEBREW_REPOSITORY.git_last_commit_date - "#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})" - else - "#{HOMEBREW_VERSION} (no git repository)" - end - end - def self.core_tap_version_string require "tap" tap = CoreTap.instance
true
Other
Homebrew
brew
9f58edbdd5b104cff885ce4724f984c534a63c36.json
readme: fix maintainer link
README.md
@@ -40,7 +40,7 @@ This is our PGP key which is valid until May 24, 2017. ## Who Are You? Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid). -Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Andrew Janke](https://github.com/apjanke), [Xu Cheng](https://github.com/xu-cheng), [Tomasz Pajor](https://github.com/nijikon), [Baptiste Fontaine](https://github.com/bfontaine), [Zhiming Wang](https://github.com/zmwangx), [Brett Koonce](https://github.com/asparagui), [ilovezfs](https://github.com/ilovezfs), [Martin Afanasjew](https://github.com/UniqMartin), [Uladzislau Shablinski](https://github.com/orgs/Homebrew/people/vladshablinsky), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith) and [Alex Dunn](https://github.com/dunn). +Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Andrew Janke](https://github.com/apjanke), [Xu Cheng](https://github.com/xu-cheng), [Tomasz Pajor](https://github.com/nijikon), [Baptiste Fontaine](https://github.com/bfontaine), [Zhiming Wang](https://github.com/zmwangx), [Brett Koonce](https://github.com/asparagui), [ilovezfs](https://github.com/ilovezfs), [Martin Afanasjew](https://github.com/UniqMartin), [Uladzislau Shablinski](https://github.com/vladshablinsky), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith) and [Alex Dunn](https://github.com/dunn). Former maintainers with significant contributions include [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
false
Other
Homebrew
brew
b3a85aaf348c82d94daab2c2207afb8f3dba94d5.json
test, cask-tests: update simplecov paths
Library/Homebrew/.simplecov
@@ -1,8 +1,8 @@ #!/usr/bin/env ruby SimpleCov.start do - coverage_dir File.expand_path("../coverage", File.realpath(__FILE__)) - root File.expand_path("../..", File.realpath(__FILE__)) + coverage_dir File.expand_path("../test/coverage", File.realpath(__FILE__)) + root File.expand_path("..", File.realpath(__FILE__)) # We manage the result cache ourselves and the default of 10 minutes can be # too low (particularly on Travis CI), causing results from some integration
false
Other
Homebrew
brew
be94f02910efba204ba3a45d7b17778f32a111d2.json
remove Cask's .rubocop.yml
Library/Homebrew/cask/spec/support/Casks/.rubocop.yml
@@ -1 +0,0 @@ -../../../../cask/.rubocop.yml \ No newline at end of file
true
Other
Homebrew
brew
be94f02910efba204ba3a45d7b17778f32a111d2.json
remove Cask's .rubocop.yml
Library/Homebrew/cask/test/support/Casks/.rubocop.yml
@@ -1 +0,0 @@ -../../../../cask/.rubocop.yml \ No newline at end of file
true
Other
Homebrew
brew
3c31e29d5c46720ed51b7a75a863e2ff4577439f.json
Simplify accessibility access disable warnings
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -253,12 +253,7 @@ def enable_accessibility_access def disable_accessibility_access return unless @cask.accessibility_access - if MacOS.version <= :mountain_lion - opoo <<-EOS.undent - Accessibility access was enabled for #{@cask}, but it is not safe to disable - automatically on this version of macOS. See System Preferences. - EOS - elsif MacOS.version <= :el_capitan + if MacOS.version >= :mavericks && MacOS.version <= :el_capitan ohai "Disabling accessibility access" @command.run!("/usr/bin/sqlite3", args: [
false
Other
Homebrew
brew
14c99abc6512d066b36f558c82c42abf7bf138c4.json
Add compatibility for `MacOS.release`.
Library/Homebrew/compat/macos.rb
@@ -136,6 +136,11 @@ def has_apple_developer_tools? odeprecated "MacOS.has_apple_developer_tools?", "DevelopmentTools.installed?" DevelopmentTools.installed? end + + def release + odeprecated "MacOS.release", "MacOS.version" + version + end end end end
false
Other
Homebrew
brew
1bfdddc95c5dccbe8b6b2049311237bb8bca01a1.json
rubocop: fix soft links targets
Library/Homebrew/cask/spec/support/Casks/.rubocop.yml
@@ -1 +1 @@ -../../../Casks/.rubocop.yml \ No newline at end of file +../../../../cask/.rubocop.yml \ No newline at end of file
true
Other
Homebrew
brew
1bfdddc95c5dccbe8b6b2049311237bb8bca01a1.json
rubocop: fix soft links targets
Library/Homebrew/cask/test/support/Casks/.rubocop.yml
@@ -1 +1 @@ -../../../Casks/.rubocop.yml \ No newline at end of file +../../../../cask/.rubocop.yml \ No newline at end of file
true
Other
Homebrew
brew
66ca9e79fc14f28e54f259bba94a52922728bde8.json
uninstall: improve pronoun for multiple version message When exactly two versions of a package were installed, the uninstall message should not read "Remove them all with...", since only one version remains. "Remove all versions with..." is flexible enough to avoid being interpreted as grammatically incorrect, and it still accurately describes the general behavior of `brew uninstall --force`.
Library/Homebrew/cmd/uninstall.rb
@@ -25,7 +25,7 @@ def uninstall versions = rack.subdirs.map(&:basename) verb = versions.length == 1 ? "is" : "are" puts "#{keg.name} #{versions.join(", ")} #{verb} still installed." - puts "Remove them all with `brew uninstall --force #{keg.name}`." + puts "Remove all versions with `brew uninstall --force #{keg.name}`." end end end
false
Other
Homebrew
brew
96232722839e54ce4cdaf3dc87f976542795eced.json
update.sh: force a full update if we have no tags.
Library/Homebrew/cmd/update.sh
@@ -425,6 +425,12 @@ EOS declare UPSTREAM_BRANCH"$TAP_VAR"="$UPSTREAM_BRANCH_DIR" declare PREFETCH_REVISION"$TAP_VAR"="$(git rev-parse -q --verify refs/remotes/origin/"$UPSTREAM_BRANCH_DIR")" + # Force a full update if we don't have any tags. + if [[ "$DIR" = "$HOMEBREW_REPOSITORY" && -z "$(git tag --list)" ]] + then + HOMEBREW_UPDATE_FORCE=1 + fi + if [[ -z "$HOMEBREW_UPDATE_FORCE" ]] then [[ -n "$SKIP_FETCH_BREW_REPOSITORY" && "$DIR" = "$HOMEBREW_REPOSITORY" ]] && continue
false
Other
Homebrew
brew
ad17bbff9c59ef5d0490e6af317f7ce2d3069f69.json
cask-tests: fix loading simplecov
Library/Homebrew/cask/Rakefile
@@ -6,6 +6,18 @@ homebrew_repo = `brew --repository`.chomp $LOAD_PATH.unshift(File.expand_path("#{homebrew_repo}/Library/Homebrew")) $LOAD_PATH.unshift(File.expand_path("../lib", __FILE__)) +namespace :test do + namespace :coverage do + desc "Upload coverage to Codecov" + task :upload do + require "simplecov" + require "codecov" + formatter = SimpleCov::Formatter::Codecov.new + formatter.format(SimpleCov::ResultMerger.merged_result) + end + end +end + RuboCop::RakeTask.new(:rubocop) do |t| t.options = ["--force-exclusion"] end
true