diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index cca9c7e219..98c9c1838b 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -132,14 +132,14 @@ GEM rspec (>= 3, < 4) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.41.1) + rubocop (1.42.0) json (~> 2.3) parallel (~> 1.10) parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) + rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.24.1) diff --git a/Library/Homebrew/cask/macos.rb b/Library/Homebrew/cask/macos.rb index be2693b239..1587de3456 100644 --- a/Library/Homebrew/cask/macos.rb +++ b/Library/Homebrew/cask/macos.rb @@ -378,8 +378,7 @@ module OS "~/Library/Widgets", "~/Library/Workflows", ] - .map { |path| Pathname(path.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path } - .to_set + .to_set { |path| Pathname(path.sub(%r{^~(?=(/|$))}, Dir.home)).expand_path } .union(SYSTEM_DIRS) .freeze private_constant :UNDELETABLE_PATHS diff --git a/Library/Homebrew/cleanup.rb b/Library/Homebrew/cleanup.rb index e134256d74..16201b3cb0 100644 --- a/Library/Homebrew/cleanup.rb +++ b/Library/Homebrew/cleanup.rb @@ -307,11 +307,7 @@ module Homebrew def cleanup_logs return unless HOMEBREW_LOGS.directory? - logs_days = if days > CLEANUP_DEFAULT_DAYS - CLEANUP_DEFAULT_DAYS - else - days - end + logs_days = [days, CLEANUP_DEFAULT_DAYS].min HOMEBREW_LOGS.subdirs.each do |dir| cleanup_path(dir) { dir.rmtree } if dir.prune?(logs_days) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index acce289519..b217588e57 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -105,7 +105,7 @@ class AbstractDownloadStrategy def chdir(&block) entries = Dir["*"] - raise "Empty archive" if entries.length.zero? + raise "Empty archive" if entries.empty? if entries.length != 1 yield diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index e1829e32a6..62b2692c43 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -188,7 +188,7 @@ module Stdenv # @private sig { params(map: T::Hash[Symbol, String]).void } - def set_cpu_cflags(map = Hardware::CPU.optimization_flags) # rubocop:disable Naming/AccessorMethodName + def set_cpu_cflags(map = Hardware::CPU.optimization_flags) set_cpu_flags(CC_FLAG_VARS, map) end diff --git a/Library/Homebrew/ignorable.rb b/Library/Homebrew/ignorable.rb index 4ede76f392..5aeeb4dc02 100644 --- a/Library/Homebrew/ignorable.rb +++ b/Library/Homebrew/ignorable.rb @@ -48,10 +48,8 @@ module Ignorable def self.unhook_raise Object.class_eval do # False positive - https://github.com/rubocop/rubocop/issues/5022 - # rubocop:disable Lint/DuplicateMethods alias_method :raise, :original_raise alias_method :fail, :original_raise - # rubocop:enable Lint/DuplicateMethods undef :original_raise end end diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.41.1.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.42.0.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@1.41.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@1.42.0.rbi index caf9209538..05aaeb4abf 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@1.41.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@1.42.0.rbi @@ -1426,6 +1426,7 @@ class RuboCop::Cop::Corrector < ::Parser::Source::TreeRewriter def remove_preceding(node_or_range, size); end def remove_trailing(node_or_range, size); end def rewrite; end + def swap(node_or_range1, node_or_range2); end private @@ -1643,15 +1644,14 @@ class RuboCop::Cop::Gemspec::DependencyVersion < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::GemspecHelp - def add_dependency_method_declarations(param0); end + def add_dependency_method_declaration?(param0 = T.unsafe(nil)); end def includes_commit_reference?(param0 = T.unsafe(nil)); end def includes_version_specification?(param0 = T.unsafe(nil)); end - def on_new_investigation; end + def on_send(node); end private def add_dependency_method?(method_name); end - def add_dependency_method_nodes; end def allowed_gem?(node); end def allowed_gems; end def forbidden_offense?(node); end @@ -1664,8 +1664,10 @@ class RuboCop::Cop::Gemspec::DependencyVersion < ::RuboCop::Cop::Base def version_specification?(expression); end end +RuboCop::Cop::Gemspec::DependencyVersion::ADD_DEPENDENCY_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Gemspec::DependencyVersion::FORBIDDEN_MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Gemspec::DependencyVersion::REQUIRED_MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Gemspec::DependencyVersion::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) RuboCop::Cop::Gemspec::DependencyVersion::VERSION_SPECIFICATION_REGEX = T.let(T.unsafe(nil), Regexp) class RuboCop::Cop::Gemspec::DeprecatedAttributeAssignment < ::RuboCop::Cop::Base @@ -2259,7 +2261,6 @@ class RuboCop::Cop::Layout::ClassStructure < ::RuboCop::Cop::Base include ::RuboCop::Cop::VisibilityHelp extend ::RuboCop::Cop::AutoCorrector - def dynamic_constant?(param0 = T.unsafe(nil)); end def on_class(class_node); end private @@ -2270,13 +2271,16 @@ class RuboCop::Cop::Layout::ClassStructure < ::RuboCop::Cop::Base def categories; end def class_elements(class_node); end def classify(node); end + def dynamic_constant?(node); end def end_position_for(node); end def expected_order; end def find_category(node); end def find_heredoc(node); end def humanize_node(node); end - def ignore?(classification); end + def ignore?(node, classification); end def ignore_for_autocorrect?(node, sibling); end + def marked_as_private_constant?(node, name); end + def private_constant?(node); end def source_range_with_comment(node); end def start_line_position(node); end def walk_over_nested_class_definition(class_node); end @@ -3308,6 +3312,7 @@ class RuboCop::Cop::Layout::LineContinuationSpacing < ::RuboCop::Cop::Base def comment_ranges(comments); end def find_offensive_spacing(line); end def ignore_range?(backtick_range); end + def ignored_ranges; end def investigate(line, line_number); end def last_line(processed_source); end def message(_range); end @@ -4260,6 +4265,7 @@ class RuboCop::Cop::Layout::TrailingWhitespace < ::RuboCop::Cop::Base def extract_heredocs(ast); end def find_heredoc(line_number); end + def heredocs; end def offense_range(lineno, line); end def process_line(line, lineno); end def process_line_in_heredoc(corrector, range, heredoc); end @@ -5451,6 +5457,7 @@ RuboCop::Cop::Lint::OrderedMagicComments::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::OutOfRangeRegexpRef < ::RuboCop::Cop::Base def after_send(node); end + def on_in_pattern(node); end def on_match_with_lvasgn(node); end def on_new_investigation; end def on_nth_ref(node); end @@ -5460,6 +5467,7 @@ class RuboCop::Cop::Lint::OutOfRangeRegexpRef < ::RuboCop::Cop::Base def check_regexp(node); end def nth_ref_receiver?(send_node); end + def patterns(pattern_node); end def regexp_first_argument?(send_node); end def regexp_receiver?(send_node); end end @@ -8494,6 +8502,7 @@ class RuboCop::Cop::Style::ConcatArrayLiterals < ::RuboCop::Cop::Base private def offense_range(node); end + def percent_literals_includes_only_basic_literals?(node); end def preferred_method(node); end end @@ -9369,12 +9378,12 @@ class RuboCop::Cop::Style::GuardClause < ::RuboCop::Cop::Base def and_or_guard_clause?(guard_clause); end def autocorrect(corrector, node, condition, replacement, guard); end def autocorrect_heredoc_argument(corrector, node, heredoc_branch, leave_branch, guard); end - def branch_to_remove(node, guard); end def check_ending_body(body); end def check_ending_if(node); end def consecutive_conditionals?(parent, node); end def guard_clause_source(guard_clause); end def heredoc?(argument); end + def range_of_branch_to_remove(node, guard); end def register_offense(node, scope_exiting_keyword, conditional_keyword, guard = T.unsafe(nil)); end def remove_whole_lines(corrector, range); end def too_long_for_single_line?(node, example); end @@ -9569,7 +9578,9 @@ class RuboCop::Cop::Style::IdenticalConditionalBranches < ::RuboCop::Cop::Base def duplicated_expressions?(node, expressions); end def expand_elses(branch); end def head(node); end + def last_child_of_parent?(node); end def message(node); end + def single_child_branch?(branch_node); end def tail(node); end end @@ -9972,6 +9983,21 @@ end RuboCop::Cop::Style::MapToHash::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::MapToHash::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Style::MapToSet < ::RuboCop::Cop::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + + def map_to_set?(param0 = T.unsafe(nil)); end + def on_send(node); end + + private + + def autocorrect(corrector, to_set, map); end +end + +RuboCop::Cop::Style::MapToSet::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::MapToSet::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Style::MethodCallWithArgsParentheses < ::RuboCop::Cop::Base include ::RuboCop::Cop::ConfigurableEnforcedStyle include ::RuboCop::Cop::AllowedMethods @@ -10087,7 +10113,7 @@ class RuboCop::Cop::Style::MethodDefParentheses < ::RuboCop::Cop::Base private - def anonymous_block_arg?(node); end + def anonymous_arguments?(node); end def arguments_without_parentheses?(node); end def correct_arguments(arg_node, corrector); end def forced_parentheses?(node); end @@ -10115,6 +10141,21 @@ end RuboCop::Cop::Style::MinMax::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Style::MinMaxComparison < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_if(node); end + + private + + def preferred_method(operator, lhs, rhs, if_branch, else_branch); end +end + +RuboCop::Cop::Style::MinMaxComparison::COMPARISON_OPERATORS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Style::MinMaxComparison::GRATER_OPERATORS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Style::MinMaxComparison::LESS_OPERATORS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Style::MinMaxComparison::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::MissingElse < ::RuboCop::Cop::Base include ::RuboCop::Cop::OnNormalIfUnless include ::RuboCop::Cop::ConfigurableEnforcedStyle @@ -11928,6 +11969,7 @@ class RuboCop::Cop::Style::SelectByRegexp < ::RuboCop::Cop::Base def extract_send_node(block_node); end def find_regexp(node, block); end def match_predicate_without_receiver?(node); end + def opposite?(regexp_method_send_node); end def receiver_allowed?(node); end def register_offense(node, block_node, regexp, opposite); end end @@ -12002,7 +12044,6 @@ class RuboCop::Cop::Style::SignalException < ::RuboCop::Cop::Base def custom_fail_methods(param0); end def kernel_call?(param0 = T.unsafe(nil), param1); end - def on_new_investigation; end def on_rescue(node); end def on_send(node); end @@ -12013,6 +12054,7 @@ class RuboCop::Cop::Style::SignalException < ::RuboCop::Cop::Base def check_scope(method_name, node); end def check_send(method_name, node); end def command_or_kernel_call?(name, node); end + def custom_fail_defined?; end def each_command_or_kernel_call(method_name, node); end def message(method_name); end end @@ -12754,6 +12796,7 @@ class RuboCop::Cop::Style::WordArray < ::RuboCop::Cop::Base def build_bracketed_array(node); end def complex_content?(strings, complex_regex: T.unsafe(nil)); end def invalid_percent_array_contents?(node); end + def within_2d_array_of_complex_content?(node); end def word_regex; end class << self @@ -12797,19 +12840,37 @@ RuboCop::Cop::Style::YodaCondition::PROGRAM_NAMES = T.let(T.unsafe(nil), Array) RuboCop::Cop::Style::YodaCondition::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) RuboCop::Cop::Style::YodaCondition::REVERSE_COMPARISON = T.let(T.unsafe(nil), Hash) +class RuboCop::Cop::Style::YodaExpression < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_new_investigation; end + def on_send(node); end + + private + + def offended_ancestor?(node); end + def offended_nodes; end + def supported_operators; end +end + +RuboCop::Cop::Style::YodaExpression::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Style::YodaExpression::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Style::ZeroLengthPredicate < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector def non_polymorphic_collection?(param0 = T.unsafe(nil)); end - def nonzero_length_predicate(param0 = T.unsafe(nil)); end + def nonzero_length_comparison(param0 = T.unsafe(nil)); end def on_send(node); end def other_receiver(param0 = T.unsafe(nil)); end + def zero_length_comparison(param0 = T.unsafe(nil)); end def zero_length_predicate(param0 = T.unsafe(nil)); end def zero_length_receiver(param0 = T.unsafe(nil)); end private - def check_nonzero_length_predicate(node); end + def check_nonzero_length_comparison(node); end + def check_zero_length_comparison(node); end def check_zero_length_predicate(node); end def replacement(node); end end @@ -14169,6 +14230,7 @@ module RuboCop::PathUtil private def absolute?(path); end + def glob?(path); end def hidden_dir?(path); end def hidden_file?(path); end def hidden_file_in_not_hidden_dir?(pattern, path); end @@ -14179,6 +14241,7 @@ module RuboCop::PathUtil class << self def absolute?(path); end + def glob?(path); end def hidden_dir?(path); end def hidden_file?(path); end def hidden_file_in_not_hidden_dir?(pattern, path); end @@ -14285,12 +14348,12 @@ class RuboCop::Runner def default_config(cop_name); end def do_inspection_loop(file); end def each_inspected_file(files); end + def except_redundant_cop_disable_directive?; end def file_finished(file, offenses); end def file_offense_cache(file); end def file_offenses(file); end def file_started(file); end def filter_cop_classes(cop_classes, config); end - def filtered_run?; end def find_target_files(paths); end def formatter_set; end def get_processed_source(file); end @@ -14321,6 +14384,7 @@ class RuboCop::Runner::InfiniteCorrectionLoop < ::StandardError end RuboCop::Runner::MAX_ITERATIONS = T.let(T.unsafe(nil), Integer) +RuboCop::Runner::REDUNDANT_COP_DISABLE_DIRECTIVE_RULES = T.let(T.unsafe(nil), Array) class RuboCop::StringInterpreter class << self diff --git a/Library/Homebrew/test/pathname_spec.rb b/Library/Homebrew/test/pathname_spec.rb index 4e5e8d4faa..0611260c7f 100644 --- a/Library/Homebrew/test/pathname_spec.rb +++ b/Library/Homebrew/test/pathname_spec.rb @@ -95,7 +95,7 @@ describe Pathname do it "preserves permissions" do File.open(file, "w", 0100777) {} file.atomic_write("CONTENT") - expect(file.stat.mode.to_s(8)).to eq((0100777 & ~File.umask).to_s(8)) + expect(file.stat.mode.to_s(8)).to eq((~File.umask & 0100777).to_s(8)) end it "preserves default permissions" do diff --git a/Library/Homebrew/unpack_strategy/dmg.rb b/Library/Homebrew/unpack_strategy/dmg.rb index f758c1a78c..b71b58a1e9 100644 --- a/Library/Homebrew/unpack_strategy/dmg.rb +++ b/Library/Homebrew/unpack_strategy/dmg.rb @@ -46,10 +46,8 @@ module UnpackStrategy def bom tries = 0 result = loop do - # rubocop:disable Style/AsciiComments # We need to use `find` here instead of Ruby in order to properly handle # file names containing special characters, such as “e” + “´” vs. “é”. - # rubocop:enable Style/AsciiComments r = system_command("find", args: [".", "-print0"], chdir: self, print_stderr: false) tries += 1 diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 93e23254b6..56ea25f353 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -354,7 +354,7 @@ module Utils return "The #{url_type} #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser." end - lenratio = (100 * https_content.length / http_content.length).to_i + lenratio = (https_content.length * 100 / http_content.length).to_i return unless (90..110).cover?(lenratio) "The #{url_type} #{url} may be able to use HTTPS rather than HTTP. Please verify it in a browser." diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 63be5e46ba..ebfe77c942 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -104,7 +104,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-ast-1.24.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-progressbar-1.11.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unicode-display_width-2.3.0/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.41.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-1.42.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.4/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.16.0/lib")