diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 1ad5fb00f4..3fdcd14605 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -147,7 +147,7 @@ GEM rubocop-performance (1.15.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.16.1) + rubocop-rails (2.17.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -215,7 +215,7 @@ GEM yard-sorbet (0.6.1) sorbet-runtime (>= 0.5) yard (>= 0.9) - zeitwerk (2.6.1) + zeitwerk (2.6.4) PLATFORMS aarch64-linux diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.1.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.17.2.rbi similarity index 98% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.17.2.rbi index 22d8456c63..48b08a346e 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.17.2.rbi @@ -175,6 +175,24 @@ RuboCop::Cop::Rails::ActionFilter::FILTER_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Rails::ActionFilter::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::ActionFilter::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::ActionOrder < ::RuboCop::Cop::Base + include ::RuboCop::Cop::VisibilityHelp + include ::RuboCop::Cop::DefNode + extend ::RuboCop::Cop::AutoCorrector + + def action_declarations(param0, param1); end + def on_class(node); end + + private + + def actions; end + def expected_order; end + def find_index(node); end + def register_offense(previous, current); end +end + +RuboCop::Cop::Rails::ActionOrder::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Rails::ActiveRecordAliases < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector @@ -695,6 +713,10 @@ class RuboCop::Cop::Rails::EagerEvaluationLogMessage < ::RuboCop::Cop::Base def replacement_range(node); end def replacement_source(node, arguments); end + + class << self + def autocorrect_incompatible_with; end + end end RuboCop::Cop::Rails::EagerEvaluationLogMessage::MSG = T.let(T.unsafe(nil), String) @@ -1059,6 +1081,15 @@ end RuboCop::Cop::Rails::I18nLocaleTexts::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::I18nLocaleTexts::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::IgnoredColumnsAssignment < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end +end + +RuboCop::Cop::Rails::IgnoredColumnsAssignment::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::IgnoredColumnsAssignment::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::IgnoredSkipActionFilterOption < ::RuboCop::Cop::Base def filter_options(param0 = T.unsafe(nil)); end def on_send(node); end @@ -1325,8 +1356,11 @@ class RuboCop::Cop::Rails::Pluck < ::RuboCop::Cop::Base private - def message(value, node); end + def message(replacement, node); end def offense_range(node); end + def register_offense(node, key); end + def use_block_argument_in_key?(block_argument, key); end + def use_one_block_argument?(argument); end end RuboCop::Cop::Rails::Pluck::MSG = T.let(T.unsafe(nil), String) @@ -1398,11 +1432,13 @@ class RuboCop::Cop::Rails::Presence < ::RuboCop::Cop::Base private def build_source_for_or_method(other); end + def current(node); end def ignore_if_node?(node); end def ignore_other_node?(node); end def message(node, receiver, other); end + def method_range(node); end def register_offense(node, receiver, other); end - def replacement(receiver, other); end + def replacement(receiver, other, left_sibling); end end RuboCop::Cop::Rails::Presence::MSG = T.let(T.unsafe(nil), String) @@ -2236,6 +2272,18 @@ RuboCop::Cop::Rails::WhereNot::NOT_IN_ANONYMOUS_RE = T.let(T.unsafe(nil), Regexp RuboCop::Cop::Rails::WhereNot::NOT_IN_NAMED_RE = T.let(T.unsafe(nil), Regexp) RuboCop::Cop::Rails::WhereNot::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::WhereNotWithMultipleConditions < ::RuboCop::Cop::Base + def on_send(node); end + def where_not_call?(param0 = T.unsafe(nil)); end + + private + + def multiple_arguments_hash?(hash); end +end + +RuboCop::Cop::Rails::WhereNotWithMultipleConditions::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::WhereNotWithMultipleConditions::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + module RuboCop::Cop::TargetRailsVersion def minimum_target_rails_version(version); end def support_target_rails_version?(version); end diff --git a/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.1.rbi b/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.4.rbi similarity index 88% rename from Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.4.rbi index 7c80df68bc..9ec59b1240 100644 --- a/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.1.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.4.rbi @@ -70,22 +70,28 @@ class Zeitwerk::Inflector def overrides; end end +module Zeitwerk::Internal + def internal(method_name); end +end + class Zeitwerk::Loader include ::Zeitwerk::RealModName include ::Zeitwerk::Loader::Callbacks include ::Zeitwerk::Loader::Helpers include ::Zeitwerk::Loader::Config + include ::Zeitwerk::Loader::EagerLoad def initialize; end def autoloaded_dirs; end def autoloads; end - def eager_load(force: T.unsafe(nil)); end - def lazy_subdirs; end def mutex; end def mutex2; end + def namespace_dirs; end def reload; end def setup; end + def shadowed_file?(file); end + def shadowed_files; end def to_unload; end def unload; end def unloadable_cpath?(cpath); end @@ -111,6 +117,7 @@ class Zeitwerk::Loader def default_logger; end def default_logger=(_arg0); end def eager_load_all; end + def eager_load_namespace(mod); end def for_gem(warn_on_extra_files: T.unsafe(nil)); end end end @@ -128,46 +135,62 @@ module Zeitwerk::Loader::Callbacks end module Zeitwerk::Loader::Config + extend ::Zeitwerk::Internal + def initialize; end + def __ignores?(abspath); end + def __roots; end def collapse(*glob_patterns); end - def collapse_dirs; end - def collapse_glob_patterns; end def dirs(namespaces: T.unsafe(nil)); end def do_not_eager_load(*paths); end - def eager_load_exclusions; end def enable_reloading; end def ignore(*glob_patterns); end - def ignored_glob_patterns; end - def ignored_paths; end - def ignores?(abspath); end def inflector; end def inflector=(_arg0); end def log!; end def logger; end def logger=(_arg0); end def on_load(cpath = T.unsafe(nil), &block); end - def on_load_callbacks; end def on_setup(&block); end - def on_setup_callbacks; end def on_unload(cpath = T.unsafe(nil), &block); end - def on_unload_callbacks; end def push_dir(path, namespace: T.unsafe(nil)); end def reloading_enabled?; end - def root_dirs; end def tag; end def tag=(tag); end private - def actual_root_dirs; end + def actual_roots; end def collapse?(dir); end + def collapse_dirs; end + def collapse_glob_patterns; end + def eager_load_exclusions; end def excluded_from_eager_load?(abspath); end def expand_glob_patterns(glob_patterns); end def expand_paths(paths); end + def ignored_glob_patterns; end + def ignored_paths; end + def ignores?(abspath); end + def on_load_callbacks; end + def on_setup_callbacks; end + def on_unload_callbacks; end def recompute_collapse_dirs; end def recompute_ignored_paths; end def root_dir?(dir); end + def roots; end +end + +module Zeitwerk::Loader::EagerLoad + def eager_load(force: T.unsafe(nil)); end + def eager_load_dir(path); end + def eager_load_namespace(mod); end + def load_file(path); end + + private + + def actual_eager_load_dir(dir, namespace, force: T.unsafe(nil)); end + def eager_load_child_namespace(child, child_name, root_dir, root_namespace); end end module Zeitwerk::Loader::Helpers @@ -183,6 +206,7 @@ module Zeitwerk::Loader::Helpers def ls(dir); end def ruby?(path); end def strict_autoload_path(parent, cname); end + def walk_up(abspath); end end Zeitwerk::Loader::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index fcbc7ad062..55512130bc 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -27,7 +27,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/i18n-1.12.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/minitest-5.16.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tzinfo-2.0.5/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/zeitwerk-2.6.4/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/activesupport-6.1.7/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.1/lib") @@ -106,7 +106,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version $:.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.35.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.15.0/lib") -$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.16.1/lib") +$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rails-2.17.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-2.15.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.6.11/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-3.0.0/lib") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/config/default.yml similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/config/default.yml index c5587794a2..6dba7eb9dd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/config/default.yml @@ -10,6 +10,9 @@ AllCops: # Exclude db/schema.rb and db/[CONFIGURATION_NAMESPACE]_schema.rb by default. # See: https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application - db/*schema.rb + - log/**/* + - public/**/* + - storage/**/* # Enable checking Active Support extensions. # See: https://docs.rubocop.org/rubocop/configuration.html#enable-checking-active-support-extensions ActiveSupportExtensionsEnabled: true @@ -70,7 +73,7 @@ Rails/ActionControllerFlashBeforeRender: StyleGuide: 'https://rails.rubystyle.guide/#flash-before-render' Reference: 'https://api.rubyonrails.org/classes/ActionController/FlashBeforeRender.html' Enabled: 'pending' - SafeAutocorrect: false + SafeAutoCorrect: false VersionAdded: '2.16' Rails/ActionControllerTestCase: @@ -78,7 +81,7 @@ Rails/ActionControllerTestCase: StyleGuide: 'https://rails.rubystyle.guide/#integration-testing' Reference: 'https://api.rubyonrails.org/classes/ActionController/TestCase.html' Enabled: 'pending' - SafeAutocorrect: false + SafeAutoCorrect: false VersionAdded: '2.14' Include: - '**/test/**/*.rb' @@ -95,6 +98,21 @@ Rails/ActionFilter: - app/controllers/**/*.rb - app/mailers/**/*.rb +Rails/ActionOrder: + Description: 'Enforce consistent ordering of controller actions.' + Enabled: pending + VersionAdded: '2.17' + ExpectedOrder: + - index + - show + - new + - edit + - create + - update + - destroy + Include: + - app/controllers/**/*.rb + Rails/ActiveRecordAliases: Description: >- Avoid Active Record aliases: @@ -348,10 +366,13 @@ Rails/DynamicFindBy: # The `Whitelist` has been deprecated, Please use `AllowedMethods` instead. Whitelist: - find_by_sql + - find_by_token_for AllowedMethods: - find_by_sql + - find_by_token_for AllowedReceivers: - Gem::Specification + - page # Prevents a warning for `page.find_by_id`. See: https://github.com/rubocop/rubocop-rails/issues/778 Rails/EagerEvaluationLogMessage: Description: 'Checks that blocks are used for interpolated strings passed to `Rails.logger.debug`.' @@ -535,6 +556,13 @@ Rails/I18nLocaleTexts: Enabled: pending VersionAdded: '2.14' +Rails/IgnoredColumnsAssignment: + Description: 'Looks for assignments of `ignored_columns` that override previous assignments.' + StyleGuide: 'https://rails.rubystyle.guide/#append-ignored-columns' + Enabled: pending + SafeAutoCorrect: false + VersionAdded: '2.17' + Rails/IgnoredSkipActionFilterOption: Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.' Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options' @@ -845,7 +873,7 @@ Rails/RootJoinChain: Rails/RootPathnameMethods: Description: 'Use `Rails.root` IO methods instead of passing it to `File`.' Enabled: pending - SafeAutocorrect: false + SafeAutoCorrect: false VersionAdded: '2.16' Rails/RootPublicPath: @@ -1090,6 +1118,17 @@ Rails/WhereNot: Enabled: 'pending' VersionAdded: '2.8' +Rails/WhereNotWithMultipleConditions: + Description: 'Do not use `where.not(...)` with multiple conditions.' + Enabled: 'pending' + VersionAdded: '2.17' + # Accept `redirect_to(...) and return` and similar cases. Style/AndOr: EnforcedStyle: conditionals + +Style/SymbolProc: + AllowedMethods: + - define_method + - mail + - respond_to diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/config/obsoletion.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/config/obsoletion.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/config/obsoletion.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop-rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop-rails.rb similarity index 67% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop-rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop-rails.rb index a5ac04629e..e505cdac14 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop-rails.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop-rails.rb @@ -14,6 +14,16 @@ RuboCop::Rails::Inject.defaults! require_relative 'rubocop/cop/rails_cops' +RuboCop::Cop::Style::HashExcept.minimum_target_ruby_version(2.0) + +RuboCop::Cop::Style::MethodCallWithArgsParentheses.singleton_class.prepend( + Module.new do + def autocorrect_incompatible_with + super.push(RuboCop::Cop::Rails::EagerEvaluationLogMessage) + end + end +) + RuboCop::Cop::Style::RedundantSelf.singleton_class.prepend( Module.new do def autocorrect_incompatible_with diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/active_record_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/active_record_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/active_record_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/active_record_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/active_record_migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/active_record_migrations_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/active_record_migrations_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/active_record_migrations_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/class_send_node_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/class_send_node_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/class_send_node_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/class_send_node_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/enforce_superclass.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/enforce_superclass.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/enforce_superclass.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/enforce_superclass.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/index_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/index_method.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/index_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/index_method.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/migrations_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/migrations_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/migrations_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/target_rails_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/target_rails_version.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/mixin/target_rails_version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/mixin/target_rails_version.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/action_controller_flash_before_render.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_controller_flash_before_render.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/action_controller_flash_before_render.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_controller_flash_before_render.rb index 92a7af6296..e101de4b3d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/action_controller_flash_before_render.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_controller_flash_before_render.rb @@ -68,9 +68,12 @@ module RuboCop def followed_by_render?(flash_node) flash_assigment_node = find_ancestor(flash_node, type: :send) - context = flash_assigment_node.parent + context = flash_assigment_node + context = context.parent if context.parent.if_type? + context = context.right_siblings + return true if context.empty? - context.each_child_node.any? do |node| + context.compact.any? do |node| render?(node) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/action_controller_test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_controller_test_case.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/action_controller_test_case.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_controller_test_case.rb index 0811e699ab..92959c771c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/action_controller_test_case.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_controller_test_case.rb @@ -31,7 +31,7 @@ module RuboCop def_node_matcher :action_controller_test_case?, <<~PATTERN (class (const nil? _) - (const (const {nil? cbase} :ActionController) :TestCase) nil?) + (const (const {nil? cbase} :ActionController) :TestCase) _) PATTERN def on_class(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_filter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_filter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_order.rb new file mode 100644 index 0000000000..1d2aef4682 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/action_order.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Enforces consistent ordering of the standard Rails RESTful controller actions. + # + # The cop is configurable and can enforce any ordering of the standard actions. + # All other methods are ignored. + # + # [source,yaml] + # ---- + # Rails/ActionOrder: + # ExpectedOrder: + # - index + # - show + # - new + # - edit + # - create + # - update + # - destroy + # ---- + # + # @example + # # bad + # def index; end + # def destroy; end + # def show; end + # + # # good + # def index; end + # def show; end + # def destroy; end + class ActionOrder < Base + extend AutoCorrector + include VisibilityHelp + include DefNode + + MSG = 'Action `%s` should appear before `%s`.' + + def_node_search :action_declarations, '(def {%1} ...)' + + def on_class(node) + action_declarations(node, actions).each_cons(2) do |previous, current| + next if node_visibility(current) != :public || non_public?(current) + next if find_index(current) >= find_index(previous) + + register_offense(previous, current) + end + end + + private + + def expected_order + cop_config['ExpectedOrder'].map(&:to_sym) + end + + def actions + @actions ||= Set.new(expected_order) + end + + def find_index(node) + expected_order.find_index(node.method_name) + end + + def register_offense(previous, current) + message = format( + MSG, + expected_order: expected_order.join(', '), + previous: previous.method_name, + current: current.method_name + ) + add_offense(current, message: message) do |corrector| + corrector.replace(current, previous.source) + corrector.replace(previous, current.source) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_record_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_record_aliases.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_record_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_record_aliases.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_record_callbacks_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_record_callbacks_order.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_record_callbacks_order.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_record_callbacks_order.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_record_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_record_override.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_record_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_record_override.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_support_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_support_aliases.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_support_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_support_aliases.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_support_on_load.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_support_on_load.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/active_support_on_load.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/active_support_on_load.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/add_column_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/add_column_index.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/add_column_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/add_column_index.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/after_commit_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/after_commit_override.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/after_commit_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/after_commit_override.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/application_controller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/application_controller.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/application_controller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/application_controller.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/application_job.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/application_job.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/application_job.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/application_job.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/application_mailer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/application_mailer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/application_mailer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/application_mailer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/application_record.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/application_record.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/application_record.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/application_record.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/arel_star.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/arel_star.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/arel_star.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/arel_star.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/assert_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/assert_not.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/assert_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/assert_not.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/attribute_default_block_value.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/attribute_default_block_value.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/attribute_default_block_value.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/attribute_default_block_value.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/belongs_to.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/belongs_to.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/belongs_to.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/bulk_change_table.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/bulk_change_table.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/bulk_change_table.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/bulk_change_table.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/compact_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/compact_blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/compact_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/compact_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/content_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/content_tag.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/content_tag.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/content_tag.rb index 9cc8dc9d45..7376b09d8b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/content_tag.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/content_tag.rb @@ -56,7 +56,8 @@ module RuboCop argument.send_type? || argument.const_type? || argument.splat_type? || - allowed_name?(argument) + allowed_name?(argument) || + !argument.respond_to?(:value) end def register_offense(node, message, preferred_method) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/create_table_with_timestamps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/create_table_with_timestamps.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/create_table_with_timestamps.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/create_table_with_timestamps.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/date.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/date.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/date.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/default_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/default_scope.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/default_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/default_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/delegate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/delegate.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/delegate.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/delegate.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/delegate_allow_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/delegate_allow_blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/delegate_allow_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/delegate_allow_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/dot_separated_keys.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/dot_separated_keys.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/dot_separated_keys.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/dot_separated_keys.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/duplicate_association.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/duplicate_association.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/duplicate_association.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/duplicate_association.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/duplicate_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/duplicate_scope.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/duplicate_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/duplicate_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/duration_arithmetic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/duration_arithmetic.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/duration_arithmetic.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/duration_arithmetic.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/dynamic_find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/dynamic_find_by.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/dynamic_find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/dynamic_find_by.rb index 654586e947..f1f7b21f36 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/dynamic_find_by.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/dynamic_find_by.rb @@ -22,19 +22,23 @@ module RuboCop # User.find_by(name: name, email: email) # User.find_by!(email: email) # - # @example AllowedMethods: find_by_sql + # @example AllowedMethods: ['find_by_sql', 'find_by_token_for'] (default) # # bad # User.find_by_query(users_query) + # User.find_by_token_for(:password_reset, token) # # # good # User.find_by_sql(users_sql) + # User.find_by_token_for(:password_reset, token) # - # @example AllowedReceivers: Gem::Specification + # @example AllowedReceivers: ['Gem::Specification', 'page'] (default) # # bad # Specification.find_by_name('backend').gem_dir + # page.find_by_id('a_dom_id').click # # # good # Gem::Specification.find_by_name('backend').gem_dir + # page.find_by_id('a_dom_id').click class DynamicFindBy < Base include ActiveRecordHelper extend AutoCorrector diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/eager_evaluation_log_message.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/eager_evaluation_log_message.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/eager_evaluation_log_message.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/eager_evaluation_log_message.rb index 549e2ccdcd..72d686d68c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/eager_evaluation_log_message.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/eager_evaluation_log_message.rb @@ -37,6 +37,10 @@ module RuboCop ) PATTERN + def self.autocorrect_incompatible_with + [Style::MethodCallWithArgsParentheses] + end + def on_send(node) return if node.parent&.block_type? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/enum_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/enum_hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/enum_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/enum_hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/enum_uniqueness.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/enum_uniqueness.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/enum_uniqueness.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/enum_uniqueness.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/environment_comparison.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/environment_comparison.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/environment_comparison.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/environment_comparison.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/environment_variable_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/environment_variable_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/environment_variable_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/environment_variable_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/exit.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/exit.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/exit.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/exit.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/expanded_date_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/expanded_date_range.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/expanded_date_range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/expanded_date_range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/file_path.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/file_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/file_path.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/find_by.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/find_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/find_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/find_by_id.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/find_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/find_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/find_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/find_each.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/find_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/find_each.rb index 4857c13891..a667201bdc 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/find_each.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/find_each.rb @@ -17,7 +17,7 @@ module RuboCop # # good # User.order(:foo).each # - # @example AllowedPattern: [/order/] + # @example AllowedPattern: ['order'] # # good # User.order(:foo).each class FindEach < Base diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/freeze_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/freeze_time.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/freeze_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/freeze_time.rb index 582219cf54..57afdacebc 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/freeze_time.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/freeze_time.rb @@ -43,7 +43,7 @@ module RuboCop PATTERN def on_send(node) - child_node, method_name, time_argument = *node.first_argument.children + child_node, method_name, time_argument = *node.first_argument&.children return if time_argument || !child_node return unless current_time?(child_node, method_name) || current_time_with_convert?(child_node, method_name) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/has_and_belongs_to_many.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/has_and_belongs_to_many.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/has_and_belongs_to_many.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/has_and_belongs_to_many.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/helper_instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/helper_instance_variable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/helper_instance_variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/helper_instance_variable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/http_positional_arguments.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/http_positional_arguments.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/http_positional_arguments.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/http_positional_arguments.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/http_status.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/http_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/http_status.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/i18n_lazy_lookup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/i18n_lazy_lookup.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/i18n_lazy_lookup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/i18n_lazy_lookup.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/i18n_locale_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/i18n_locale_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/i18n_locale_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/i18n_locale_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/i18n_locale_texts.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/i18n_locale_texts.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/i18n_locale_texts.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/i18n_locale_texts.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/ignored_columns_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/ignored_columns_assignment.rb new file mode 100644 index 0000000000..66fa445b11 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/ignored_columns_assignment.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Looks for assignments of `ignored_columns` that may override previous + # assignments. + # + # Overwriting previous assignments is usually a mistake, since it will + # un-ignore the first set of columns. Since duplicate column names is not + # a problem, it is better to simply append to the list. + # + # @example + # + # # bad + # class User < ActiveRecord::Base + # self.ignored_columns = [:one] + # end + # + # # bad + # class User < ActiveRecord::Base + # self.ignored_columns = [:one, :two] + # end + # + # # good + # class User < ActiveRecord::Base + # self.ignored_columns += [:one, :two] + # end + # + # # good + # class User < ActiveRecord::Base + # self.ignored_columns += [:one] + # self.ignored_columns += [:two] + # end + # + class IgnoredColumnsAssignment < Base + extend AutoCorrector + + MSG = 'Use `+=` instead of `=`.' + RESTRICT_ON_SEND = %i[ignored_columns=].freeze + + def on_send(node) + add_offense(node.loc.operator) do |corrector| + corrector.replace(node.loc.operator, '+=') + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/index_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/index_by.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/index_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/index_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/index_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/index_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/index_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/index_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/inverse_of.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/inverse_of.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/inverse_of.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/inverse_of.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/link_to_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/link_to_blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/link_to_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/link_to_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/mailer_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/mailer_name.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/mailer_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/mailer_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/match_route.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/match_route.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/match_route.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/match_route.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/migration_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/migration_class_name.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/migration_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/migration_class_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/negate_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/negate_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/negate_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/negate_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/not_null_column.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/not_null_column.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/not_null_column.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/not_null_column.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/order_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/order_by_id.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/order_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/order_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/output.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/output.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/output.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/output_safety.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/output_safety.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/output_safety.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pick.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pick.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pick.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pick.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluck.rb similarity index 51% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluck.rb index f8c3201135..3c47cc1316 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluck.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluck.rb @@ -21,42 +21,62 @@ module RuboCop extend AutoCorrector extend TargetRailsVersion - MSG = 'Prefer `pluck(:%s)` over `%s`.' + MSG = 'Prefer `%s` over `%s`.' minimum_target_rails_version 5.0 def_node_matcher :pluck_candidate?, <<~PATTERN - ({block numblock} (send _ {:map :collect}) $_argument (send (lvar $_element) :[] (sym $_value))) + ({block numblock} (send _ {:map :collect}) $_argument (send lvar :[] $_key)) PATTERN def on_block(node) - pluck_candidate?(node) do |argument, element, value| + pluck_candidate?(node) do |argument, key| + next unless use_one_block_argument?(argument) + match = if node.block_type? - argument.children.first.source.to_sym == element + block_argument = argument.children.first.source + use_block_argument_in_key?(block_argument, key) else # numblock - argument == 1 && element == :_1 + argument == 1 && use_block_argument_in_key?('_1', key) end next unless match - message = message(value, node) - - add_offense(offense_range(node), message: message) do |corrector| - corrector.replace(offense_range(node), "pluck(:#{value})") - end + register_offense(node, key) end end alias on_numblock on_block private + def use_one_block_argument?(argument) + return true if argument == 1 # Checks for numbered argument `_1`. + + argument.respond_to?(:one?) && argument.one? + end + + def use_block_argument_in_key?(block_argument, key) + return false if block_argument == key.source + + key.each_descendant(:lvar).none? { |lvar| block_argument == lvar.source } + end + def offense_range(node) node.send_node.loc.selector.join(node.loc.end) end - def message(value, node) + def register_offense(node, key) + replacement = "pluck(#{key.source})" + message = message(replacement, node) + + add_offense(offense_range(node), message: message) do |corrector| + corrector.replace(offense_range(node), replacement) + end + end + + def message(replacement, node) current = offense_range(node).source - format(MSG, value: value, current: current) + format(MSG, replacement: replacement, current: current) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluck_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluck_id.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluck_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluck_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluck_in_where.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluck_in_where.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluck_in_where.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluck_in_where.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluralization_grammar.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluralization_grammar.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/pluralization_grammar.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/pluralization_grammar.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/presence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/presence.rb similarity index 76% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/presence.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/presence.rb index f9313ef75a..ac1e69c185 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/presence.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/presence.rb @@ -93,7 +93,7 @@ module RuboCop def register_offense(node, receiver, other) add_offense(node, message: message(node, receiver, other)) do |corrector| - corrector.replace(node.source_range, replacement(receiver, other)) + corrector.replace(node.source_range, replacement(receiver, other, node.left_sibling)) end end @@ -106,10 +106,20 @@ module RuboCop end def message(node, receiver, other) - format(MSG, prefer: replacement(receiver, other), current: node.source) + prefer = replacement(receiver, other, node.left_sibling).gsub(/^\s*|\n/, '') + current = current(node).gsub(/^\s*|\n/, '') + format(MSG, prefer: prefer, current: current) end - def replacement(receiver, other) + def current(node) + if node.source.include?("\n") + "#{node.loc.keyword.with(end_pos: node.condition.loc.selector.end_pos).source} ... end" + else + node.source + end + end + + def replacement(receiver, other, left_sibling) or_source = if other&.send_type? build_source_for_or_method(other) elsif other.nil? || other.nil_type? @@ -118,23 +128,24 @@ module RuboCop " || #{other.source}" end - "#{receiver.source}.presence" + or_source + replaced = "#{receiver.source}.presence#{or_source}" + left_sibling ? "(#{replaced})" : replaced end def build_source_for_or_method(other) - if other.parenthesized? || other.method?('[]') || !other.arguments? + if other.parenthesized? || other.method?('[]') || other.arithmetic_operation? || !other.arguments? " || #{other.source}" else - method = range_between( - other.source_range.begin_pos, - other.first_argument.source_range.begin_pos - 1 - ).source - + method = method_range(other).source arguments = other.arguments.map(&:source).join(', ') " || #{method}(#{arguments})" end end + + def method_range(node) + range_between(node.source_range.begin_pos, node.first_argument.source_range.begin_pos - 1) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/present.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/present.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/present.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/present.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/rake_environment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/rake_environment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/rake_environment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/rake_environment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/read_write_attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/read_write_attribute.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/read_write_attribute.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/read_write_attribute.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_allow_nil.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_allow_nil.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_allow_nil.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_allow_nil.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_foreign_key.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_foreign_key.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_foreign_key.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_foreign_key.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb index ac48407a6e..d8ee2670e7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb @@ -143,7 +143,7 @@ module RuboCop def_node_matcher :belongs_to_without_fk?, <<~PATTERN { (send nil? :belongs_to (sym %1)) # belongs_to :user - (send nil? :belongs_to (sym %1) !hash) # belongs_to :user, -> { not_deleted } + (send nil? :belongs_to (sym %1) !hash ...) # belongs_to :user, -> { not_deleted } (send nil? :belongs_to (sym %1) !(hash <(pair (sym :foreign_key) _) ...>)) } PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb index 6a6b1e4827..4c25dcebdd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb @@ -98,6 +98,8 @@ module RuboCop proc = if node.numblock_type? ->(n) { n.receiver.lvar_type? && n.receiver.source == '_1' } else + return false if node.arguments.empty? + arg = node.arguments.first ->(n) { same_value?(arg, n.receiver) } end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_travel_back.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_travel_back.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/redundant_travel_back.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/redundant_travel_back.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/reflection_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/reflection_class_name.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/reflection_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/reflection_class_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/refute_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/refute_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/refute_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/refute_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/relative_date_constant.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/relative_date_constant.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/relative_date_constant.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/relative_date_constant.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/render_inline.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/render_inline.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/render_inline.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/render_inline.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/render_plain_text.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/render_plain_text.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/render_plain_text.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/render_plain_text.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/request_referer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/request_referer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/request_referer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/request_referer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/require_dependency.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/require_dependency.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/require_dependency.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/require_dependency.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/reversible_migration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/reversible_migration.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/reversible_migration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/reversible_migration.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/reversible_migration_method_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/reversible_migration_method_definition.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/reversible_migration_method_definition.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/reversible_migration_method_definition.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/root_join_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/root_join_chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/root_join_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/root_join_chain.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/root_pathname_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/root_pathname_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/root_pathname_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/root_pathname_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/root_public_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/root_public_path.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/root_public_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/root_public_path.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/safe_navigation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/safe_navigation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/safe_navigation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/safe_navigation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/safe_navigation_with_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/safe_navigation_with_blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/safe_navigation_with_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/safe_navigation_with_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/save_bang.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/save_bang.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/save_bang.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/save_bang.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/schema_comment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/schema_comment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/schema_comment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/schema_comment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/scope_args.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/scope_args.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/scope_args.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/scope_args.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/short_i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/short_i18n.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/short_i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/short_i18n.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/skips_model_validations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/skips_model_validations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/skips_model_validations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/skips_model_validations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/squished_sql_heredocs.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/squished_sql_heredocs.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/squished_sql_heredocs.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/squished_sql_heredocs.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/strip_heredoc.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/strip_heredoc.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/strip_heredoc.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/strip_heredoc.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/table_name_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/table_name_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/table_name_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/table_name_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/time_zone.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/time_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/time_zone.rb index 5955fba982..ad44009e3a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/time_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/time_zone.rb @@ -55,7 +55,7 @@ module RuboCop ACCEPTED_METHODS = %i[in_time_zone utc getlocal xmlschema iso8601 jisx0301 rfc3339 httpdate to_i to_f].freeze - TIMEZONE_SPECIFIER = /[A-z]/.freeze + TIMEZONE_SPECIFIER = /([A-z]|[+-]\d{2}:?\d{2})\z/.freeze def on_const(node) mod, klass = *node @@ -126,7 +126,7 @@ module RuboCop end def attach_timezone_specifier?(date) - date.respond_to?(:value) && TIMEZONE_SPECIFIER.match?(date.value.to_s[-1]) + date.respond_to?(:value) && TIMEZONE_SPECIFIER.match?(date.value.to_s) end def build_message(klass, method_name, node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/time_zone_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/time_zone_assignment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/time_zone_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/time_zone_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/to_formatted_s.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/to_formatted_s.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/to_formatted_s.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/to_formatted_s.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/to_s_with_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/to_s_with_argument.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/to_s_with_argument.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/to_s_with_argument.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/transaction_exit_statement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/transaction_exit_statement.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/transaction_exit_statement.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/transaction_exit_statement.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/uniq_before_pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/uniq_before_pluck.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/uniq_before_pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/uniq_before_pluck.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/unique_validation_without_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/unique_validation_without_index.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/unique_validation_without_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/unique_validation_without_index.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/unknown_env.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/unknown_env.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/unknown_env.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/unknown_env.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/unused_ignored_columns.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/unused_ignored_columns.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/unused_ignored_columns.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/unused_ignored_columns.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/validation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/validation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/validation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/validation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/where_equals.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_equals.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/where_equals.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_equals.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/where_exists.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_exists.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/where_exists.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_exists.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/where_missing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_missing.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/where_missing.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_missing.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/where_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_not.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails/where_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_not.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb new file mode 100644 index 0000000000..5d820da7e3 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Identifies calls to `where.not` with multiple hash arguments. + # + # The behavior of `where.not` changed in Rails 6.1. Prior to the change, + # `.where.not(trashed: true, role: 'admin')` evaluated to + # `WHERE trashed != TRUE AND role != 'admin'`. + # From Rails 6.1 onwards, this executes the query + # `WHERE NOT (trashed == TRUE AND roles == 'admin')`. + # + # @example + # # bad + # User.where.not(trashed: true, role: 'admin') + # User.where.not(trashed: true, role: ['moderator', 'admin']) + # User.joins(:posts).where.not(posts: { trashed: true, title: 'Rails' }) + # + # # good + # User.where.not(trashed: true) + # User.where.not(role: ['moderator', 'admin']) + # User.where.not(trashed: true).where.not(role: ['moderator', 'admin']) + # User.where.not('trashed = ? OR role = ?', true, 'admin') + class WhereNotWithMultipleConditions < Base + MSG = 'Use a SQL statement instead of `where.not` with multiple conditions.' + RESTRICT_ON_SEND = %i[not].freeze + + def_node_matcher :where_not_call?, <<~PATTERN + (send (send _ :where) :not $...) + PATTERN + + def on_send(node) + where_not_call?(node) do |args| + next unless args[0].hash_type? + next unless multiple_arguments_hash? args[0] + + range = node.receiver.loc.selector.with(end_pos: node.loc.expression.end_pos) + + add_offense(range) + end + end + + private + + def multiple_arguments_hash?(hash) + return true if hash.pairs.size >= 2 + return false unless hash.values[0]&.hash_type? + + multiple_arguments_hash?(hash.values[0]) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails_cops.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails_cops.rb index 8e0e555cc4..24908f0516 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/cop/rails_cops.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/cop/rails_cops.rb @@ -11,6 +11,7 @@ require_relative 'mixin/target_rails_version' require_relative 'rails/action_controller_flash_before_render' require_relative 'rails/action_controller_test_case' require_relative 'rails/action_filter' +require_relative 'rails/action_order' require_relative 'rails/active_record_aliases' require_relative 'rails/active_record_callbacks_order' require_relative 'rails/active_record_override' @@ -61,6 +62,7 @@ require_relative 'rails/http_status' require_relative 'rails/i18n_lazy_lookup' require_relative 'rails/i18n_locale_assignment' require_relative 'rails/i18n_locale_texts' +require_relative 'rails/ignored_columns_assignment' require_relative 'rails/ignored_skip_action_filter_option' require_relative 'rails/index_by' require_relative 'rails/index_with' @@ -127,3 +129,4 @@ require_relative 'rails/where_equals' require_relative 'rails/where_exists' require_relative 'rails/where_missing' require_relative 'rails/where_not' +require_relative 'rails/where_not_with_multiple_conditions' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/schema_loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/schema_loader.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/schema_loader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/schema_loader.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/schema_loader/schema.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/schema_loader/schema.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/schema_loader/schema.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/schema_loader/schema.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/version.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/version.rb index 910c915687..c408f6914d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.1/lib/rubocop/rails/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.17.2/lib/rubocop/rails/version.rb @@ -4,7 +4,7 @@ module RuboCop module Rails # This module holds the RuboCop Rails version information. module Version - STRING = '2.16.1' + STRING = '2.17.2' def self.document_version STRING.match('\d+\.\d+').to_s diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk.rb index 0f3e180b33..4095a1b1e1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk.rb @@ -2,6 +2,7 @@ module Zeitwerk require_relative "zeitwerk/real_mod_name" + require_relative "zeitwerk/internal" require_relative "zeitwerk/loader" require_relative "zeitwerk/gem_loader" require_relative "zeitwerk/registry" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/error.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/error.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/explicit_namespace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/explicit_namespace.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/explicit_namespace.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/explicit_namespace.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/gem_inflector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/gem_inflector.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/gem_inflector.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/gem_inflector.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/gem_loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/gem_loader.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/gem_loader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/gem_loader.rb index cbbffc944c..806a839483 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/gem_loader.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/gem_loader.rb @@ -43,7 +43,7 @@ module Zeitwerk next if abspath == expected_namespace_dir basename_without_ext = basename.delete_suffix(".rb") - cname = inflector.camelize(basename_without_ext, abspath) + cname = inflector.camelize(basename_without_ext, abspath).to_sym ftype = dir?(abspath) ? "directory" : "file" warn(<<~EOS) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/inflector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/inflector.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/inflector.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/inflector.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/internal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/internal.rb new file mode 100644 index 0000000000..7984281b08 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/internal.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# This is a private module. +module Zeitwerk::Internal + def internal(method_name) + private method_name + + mangled = "__#{method_name}" + alias_method mangled, method_name + public mangled + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/kernel.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/kernel.rb index 3e2463ddb7..bfe7477846 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/kernel.rb @@ -19,6 +19,9 @@ module Kernel # included in Object, and changes in ancestors don't get propagated into # already existing ancestor chains on Ruby < 3.0. alias_method :zeitwerk_original_require, :require + class << self + alias_method :zeitwerk_original_require, :require + end # @sig (String) -> true | false def require(path) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader.rb similarity index 82% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader.rb index dc75497824..df1875940d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader.rb @@ -7,11 +7,13 @@ module Zeitwerk require_relative "loader/helpers" require_relative "loader/callbacks" require_relative "loader/config" + require_relative "loader/eager_load" include RealModName include Callbacks include Helpers include Config + include EagerLoad MUTEX = Mutex.new private_constant :MUTEX @@ -54,7 +56,7 @@ module Zeitwerk # @sig Hash[String, [String, [Module, Symbol]]] attr_reader :to_unload - # Maps constant paths of namespaces to arrays of corresponding directories. + # Maps namespace constant paths to their respective directories. # # For example, given this mapping: # @@ -64,13 +66,24 @@ module Zeitwerk # ... # ] # - # when `Admin` gets defined we know that it plays the role of a namespace and - # that its children are spread over those directories. We'll visit them to set - # up the corresponding autoloads. + # when `Admin` gets defined we know that it plays the role of a namespace + # and that its children are spread over those directories. We'll visit them + # to set up the corresponding autoloads. # # @private # @sig Hash[String, Array[String]] - attr_reader :lazy_subdirs + attr_reader :namespace_dirs + + # A shadowed file is a file managed by this loader that is ignored when + # setting autoloads because its matching constant is already taken. + # + # This private set is populated as we descend. For example, if the loader + # has only scanned the top-level, `shadowed_files` does not have shadowed + # files that may exist deep in the project tree yet. + # + # @private + # @sig Set[String] + attr_reader :shadowed_files # @private # @sig Mutex @@ -86,7 +99,8 @@ module Zeitwerk @autoloads = {} @autoloaded_dirs = [] @to_unload = {} - @lazy_subdirs = Hash.new { |h, cpath| h[cpath] = [] } + @namespace_dirs = Hash.new { |h, cpath| h[cpath] = [] } + @shadowed_files = Set.new @mutex = Mutex.new @mutex2 = Mutex.new @setup = false @@ -102,8 +116,8 @@ module Zeitwerk mutex.synchronize do break if @setup - actual_root_dirs.each do |root_dir, namespace| - set_autoloads_in_dir(root_dir, namespace) + actual_roots.each do |root_dir, root_namespace| + set_autoloads_in_dir(root_dir, root_namespace) end on_setup_callbacks.each(&:call) @@ -181,7 +195,8 @@ module Zeitwerk autoloads.clear autoloaded_dirs.clear to_unload.clear - lazy_subdirs.clear + namespace_dirs.clear + shadowed_files.clear Registry.on_unload(self) ExplicitNamespace.unregister_loader(self) @@ -208,58 +223,6 @@ module Zeitwerk setup end - # Eager loads all files in the root directories, recursively. Files do not - # need to be in `$LOAD_PATH`, absolute file names are used. Ignored files - # are not eager loaded. You can opt-out specifically in specific files and - # directories with `do_not_eager_load`, and that can be overridden passing - # `force: true`. - # - # @sig (true | false) -> void - def eager_load(force: false) - mutex.synchronize do - break if @eager_loaded - - log("eager load start") if logger - - honour_exclusions = !force - - queue = [] - actual_root_dirs.each do |root_dir, namespace| - queue << [namespace, root_dir] unless honour_exclusions && excluded_from_eager_load?(root_dir) - end - - while to_eager_load = queue.shift - namespace, dir = to_eager_load - - ls(dir) do |basename, abspath| - next if honour_exclusions && excluded_from_eager_load?(abspath) - - if ruby?(abspath) - if cref = autoloads[abspath] - cget(*cref) - end - elsif !root_dirs.key?(abspath) - if collapse?(abspath) - queue << [namespace, abspath] - else - cname = inflector.camelize(basename, abspath) - queue << [cget(namespace, cname), abspath] - end - end - end - end - - autoloaded_dirs.each do |autoloaded_dir| - Registry.unregister_autoload(autoloaded_dir) - end - autoloaded_dirs.clear - - @eager_loaded = true - - log("eager load end") if logger - end - end - # Says if the given constant path would be unloaded on reload. This # predicate returns `false` if reloading is disabled. # @@ -285,6 +248,15 @@ module Zeitwerk ExplicitNamespace.unregister_loader(self) end + # The return value of this predicate is only meaningful if the loader has + # scanned the file. This is the case in the spots where we use it. + # + # @private + # @sig (String) -> Boolean + def shadowed_file?(file) + shadowed_files.member?(file) + end + # --- Class methods --------------------------------------------------------------------------- class << self @@ -318,6 +290,15 @@ module Zeitwerk Registry.loaders.each(&:eager_load) end + # Broadcasts `eager_load_namespace` to all loaders. + # + # @sig (Module) -> void + def eager_load_namespace(mod) + Registry.loaders.each do |loader| + loader.eager_load_namespace(mod) + end + end + # Returns an array with the absolute paths of the root directories of all # registered loaders. This is a read-only collection. # @@ -338,19 +319,11 @@ module Zeitwerk cname = inflector.camelize(basename, abspath).to_sym autoload_file(parent, cname, abspath) else - # In a Rails application, `app/models/concerns` is a subdirectory of - # `app/models`, but both of them are root directories. - # - # To resolve the ambiguity file name -> constant path this introduces, - # the `app/models/concerns` directory is totally ignored as a namespace, - # it counts only as root. The guard checks that. - unless root_dir?(abspath) + if collapse?(abspath) + set_autoloads_in_dir(abspath, parent) + else cname = inflector.camelize(basename, abspath).to_sym - if collapse?(abspath) - set_autoloads_in_dir(abspath, parent) - else - autoload_subdir(parent, cname, abspath) - end + autoload_subdir(parent, cname, abspath) end end rescue ::NameError => error @@ -380,10 +353,10 @@ module Zeitwerk # We do not need to issue another autoload, the existing one is enough # no matter if it is for a file or a directory. Just remember the # subdirectory has to be visited if the namespace is used. - lazy_subdirs[cpath] << subdir + namespace_dirs[cpath] << subdir elsif !cdef?(parent, cname) # First time we find this namespace, set an autoload for it. - lazy_subdirs[cpath(parent, cname)] << subdir + namespace_dirs[cpath(parent, cname)] << subdir set_autoload(parent, cname, subdir) else # For whatever reason the constant that corresponds to this namespace has @@ -398,6 +371,7 @@ module Zeitwerk if autoload_path = strict_autoload_path(parent, cname) || Registry.inception?(cpath(parent, cname)) # First autoload for a Ruby file wins, just ignore subsequent ones. if ruby?(autoload_path) + shadowed_files << file log("file #{file} is ignored because #{autoload_path} has precedence") if logger else promote_namespace_from_implicit_to_explicit( @@ -408,6 +382,7 @@ module Zeitwerk ) end elsif cdef?(parent, cname) + shadowed_files << file log("file #{file} is ignored because #{cpath(parent, cname)} is already defined") if logger else set_autoload(parent, cname, file) @@ -466,19 +441,20 @@ module Zeitwerk # @sig (String) -> void def raise_if_conflicting_directory(dir) MUTEX.synchronize do + dir_slash = dir + "/" + Registry.loaders.each do |loader| next if loader == self - next if loader.ignores?(dir) + next if loader.__ignores?(dir) - dir = dir + "/" - loader.root_dirs.each do |root_dir, _namespace| + loader.__roots.each_key do |root_dir| next if ignores?(root_dir) - root_dir = root_dir + "/" - if dir.start_with?(root_dir) || root_dir.start_with?(dir) + root_dir_slash = root_dir + "/" + if dir_slash.start_with?(root_dir_slash) || root_dir_slash.start_with?(dir_slash) require "pp" # Needed for pretty_inspect, even in Ruby 2.5. raise Error, - "loader\n\n#{pretty_inspect}\n\nwants to manage directory #{dir.chop}," \ + "loader\n\n#{pretty_inspect}\n\nwants to manage directory #{dir}," \ " which is already managed by\n\n#{loader.pretty_inspect}\n" EOS end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/callbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/callbacks.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/callbacks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/callbacks.rb index 5ec2758ae2..d8ac2eb706 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/callbacks.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/callbacks.rb @@ -42,7 +42,7 @@ module Zeitwerk::Loader::Callbacks # Without the mutex and subsequent delete call, t2 would reset the module. # That not only would reassign the constant (undesirable per se) but, worse, # the module object created by t2 wouldn't have any of the autoloads for its - # children, since t1 would have correctly deleted its lazy_subdirs entry. + # children, since t1 would have correctly deleted its namespace_dirs entry. mutex2.synchronize do if cref = autoloads.delete(dir) autovivified_module = cref[0].const_set(cref[1], Module.new) @@ -71,9 +71,9 @@ module Zeitwerk::Loader::Callbacks # @private # @sig (Module) -> void def on_namespace_loaded(namespace) - if subdirs = lazy_subdirs.delete(real_mod_name(namespace)) - subdirs.each do |subdir| - set_autoloads_in_dir(subdir, namespace) + if dirs = namespace_dirs.delete(real_mod_name(namespace)) + dirs.each do |dir| + set_autoloads_in_dir(dir, namespace) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/config.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/config.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/config.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/config.rb index 706964246a..b1a8c0d922 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/config.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/config.rb @@ -4,86 +4,89 @@ require "set" require "securerandom" module Zeitwerk::Loader::Config - # Absolute paths of the root directories. Stored in a hash to preserve - # order, easily handle duplicates, have a fast lookup needed for detecting - # nested paths, and store custom namespaces as values. + extend Zeitwerk::Internal + + # @sig #camelize + attr_accessor :inflector + + # @sig #call | #debug | nil + attr_accessor :logger + + # Absolute paths of the root directories. Stored in a hash to preserve order, + # easily handle duplicates, have a fast lookup needed for detecting nested + # paths, and store namespaces as values. # - # "/Users/fxn/blog/app/assets" => Object, # "/Users/fxn/blog/app/channels" => Object, - # "/Users/fxn/blog/adapters" => ActiveJob::QueueAdapters, + # "/Users/fxn/blog/app/adapters" => ActiveJob::QueueAdapters, # ... # # This is a private collection maintained by the loader. The public # interface for it is `push_dir` and `dirs`. # - # @private # @sig Hash[String, Module] - attr_reader :root_dirs - - # @sig #camelize - attr_accessor :inflector + attr_reader :roots + internal :roots # Absolute paths of files, directories, or glob patterns to be totally # ignored. # - # @private # @sig Set[String] attr_reader :ignored_glob_patterns + private :ignored_glob_patterns # The actual collection of absolute file and directory names at the time the # ignored glob patterns were expanded. Computed on setup, and recomputed on # reload. # - # @private # @sig Set[String] attr_reader :ignored_paths + private :ignored_paths # Absolute paths of directories or glob patterns to be collapsed. # - # @private # @sig Set[String] attr_reader :collapse_glob_patterns + private :collapse_glob_patterns # The actual collection of absolute directory names at the time the collapse # glob patterns were expanded. Computed on setup, and recomputed on reload. # - # @private # @sig Set[String] attr_reader :collapse_dirs + private :collapse_dirs # Absolute paths of files or directories not to be eager loaded. # - # @private # @sig Set[String] attr_reader :eager_load_exclusions + private :eager_load_exclusions # User-oriented callbacks to be fired on setup and on reload. # - # @private # @sig Array[{ () -> void }] attr_reader :on_setup_callbacks + private :on_setup_callbacks # User-oriented callbacks to be fired when a constant is loaded. # - # @private # @sig Hash[String, Array[{ (Object, String) -> void }]] # Hash[Symbol, Array[{ (String, Object, String) -> void }]] attr_reader :on_load_callbacks + private :on_load_callbacks # User-oriented callbacks to be fired before constants are removed. # - # @private # @sig Hash[String, Array[{ (Object, String) -> void }]] # Hash[Symbol, Array[{ (String, Object, String) -> void }]] attr_reader :on_unload_callbacks - - # @sig #call | #debug | nil - attr_accessor :logger + private :on_unload_callbacks def initialize - @initialized_at = Time.now - @root_dirs = {} @inflector = Zeitwerk::Inflector.new + @logger = self.class.default_logger + @tag = SecureRandom.hex(3) + @initialized_at = Time.now + @roots = {} @ignored_glob_patterns = Set.new @ignored_paths = Set.new @collapse_glob_patterns = Set.new @@ -93,8 +96,6 @@ module Zeitwerk::Loader::Config @on_setup_callbacks = [] @on_load_callbacks = {} @on_unload_callbacks = {} - @logger = self.class.default_logger - @tag = SecureRandom.hex(3) end # Pushes `path` to the list of root directories. @@ -114,7 +115,7 @@ module Zeitwerk::Loader::Config abspath = File.expand_path(path) if dir?(abspath) raise_if_conflicting_directory(abspath) - root_dirs[abspath] = namespace + roots[abspath] = namespace else raise Zeitwerk::Error, "the root directory #{abspath} does not exist" end @@ -147,9 +148,9 @@ module Zeitwerk::Loader::Config # @sig () -> Array[String] | Hash[String, Module] def dirs(namespaces: false) if namespaces - root_dirs.clone + roots.clone else - root_dirs.keys + roots.keys end.freeze end @@ -273,57 +274,71 @@ module Zeitwerk::Loader::Config @logger = ->(msg) { puts msg } end - # @private + # Returns true if the argument has been configured to be ignored, or is a + # descendant of an ignored directory. + # # @sig (String) -> bool - def ignores?(abspath) - ignored_paths.any? do |ignored_path| - ignored_path == abspath || (dir?(ignored_path) && abspath.start_with?(ignored_path + "/")) + internal def ignores?(abspath) + # Common use case. + return false if ignored_paths.empty? + + walk_up(abspath) do |abspath| + return true if ignored_paths.member?(abspath) + return false if roots.key?(abspath) end + + false end - private - # @sig () -> Array[String] - def actual_root_dirs - root_dirs.reject do |root_dir, _namespace| + private def actual_roots + roots.reject do |root_dir, _root_namespace| !dir?(root_dir) || ignored_paths.member?(root_dir) end end # @sig (String) -> bool - def root_dir?(dir) - root_dirs.key?(dir) + private def root_dir?(dir) + roots.key?(dir) end # @sig (String) -> bool - def excluded_from_eager_load?(abspath) - eager_load_exclusions.member?(abspath) + private def excluded_from_eager_load?(abspath) + # Optimize this common use case. + return false if eager_load_exclusions.empty? + + walk_up(abspath) do |abspath| + return true if eager_load_exclusions.member?(abspath) + return false if roots.key?(abspath) + end + + false end # @sig (String) -> bool - def collapse?(dir) + private def collapse?(dir) collapse_dirs.member?(dir) end # @sig (String | Pathname | Array[String | Pathname]) -> Array[String] - def expand_paths(paths) + private def expand_paths(paths) paths.flatten.map! { |path| File.expand_path(path) } end # @sig (Array[String]) -> Array[String] - def expand_glob_patterns(glob_patterns) + private def expand_glob_patterns(glob_patterns) # Note that Dir.glob works with regular file names just fine. That is, # glob patterns technically need no wildcards. glob_patterns.flat_map { |glob_pattern| Dir.glob(glob_pattern) } end # @sig () -> void - def recompute_ignored_paths + private def recompute_ignored_paths ignored_paths.replace(expand_glob_patterns(ignored_glob_patterns)) end # @sig () -> void - def recompute_collapse_dirs + private def recompute_collapse_dirs collapse_dirs.replace(expand_glob_patterns(collapse_glob_patterns)) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/eager_load.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/eager_load.rb new file mode 100644 index 0000000000..6ac01e6f41 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/eager_load.rb @@ -0,0 +1,223 @@ +module Zeitwerk::Loader::EagerLoad + # Eager loads all files in the root directories, recursively. Files do not + # need to be in `$LOAD_PATH`, absolute file names are used. Ignored and + # shadowed files are not eager loaded. You can opt-out specifically in + # specific files and directories with `do_not_eager_load`, and that can be + # overridden passing `force: true`. + # + # @sig (true | false) -> void + def eager_load(force: false) + mutex.synchronize do + break if @eager_loaded + + log("eager load start") if logger + + actual_roots.each do |root_dir, root_namespace| + actual_eager_load_dir(root_dir, root_namespace, force: force) + end + + autoloaded_dirs.each do |autoloaded_dir| + Zeitwerk::Registry.unregister_autoload(autoloaded_dir) + end + autoloaded_dirs.clear + + @eager_loaded = true + + log("eager load end") if logger + end + end + + # @sig (String | Pathname) -> void + def eager_load_dir(path) + abspath = File.expand_path(path) + + raise Zeitwerk::Error.new("#{abspath} is not a directory") unless dir?(abspath) + + cnames = [] + + root_namespace = nil + walk_up(abspath) do |dir| + return if ignored_paths.member?(dir) + return if eager_load_exclusions.member?(dir) + + break if root_namespace = roots[dir] + + unless collapse?(dir) + basename = File.basename(dir) + cnames << inflector.camelize(basename, dir).to_sym + end + end + + raise Zeitwerk::Error.new("I do not manage #{abspath}") unless root_namespace + + return if @eager_loaded + + namespace = root_namespace + cnames.reverse_each do |cname| + # Can happen if there are no Ruby files. This is not an error condition, + # the directory is actually managed. Could have Ruby files later. + return unless cdef?(namespace, cname) + namespace = cget(namespace, cname) + end + + # A shortcircuiting test depends on the invocation of this method. Please + # keep them in sync if refactored. + actual_eager_load_dir(abspath, namespace) + end + + # @sig (Module) -> void + def eager_load_namespace(mod) + unless mod.is_a?(Module) + raise Zeitwerk::Error, "#{mod.inspect} is not a class or module object" + end + + return if @eager_loaded + + mod_name = real_mod_name(mod) + return unless mod_name + + actual_roots.each do |root_dir, root_namespace| + if mod.equal?(Object) + # A shortcircuiting test depends on the invocation of this method. + # Please keep them in sync if refactored. + actual_eager_load_dir(root_dir, root_namespace) + elsif root_namespace.equal?(Object) + eager_load_child_namespace(mod, mod_name, root_dir, root_namespace) + else + root_namespace_name = real_mod_name(root_namespace) + if root_namespace_name.start_with?(mod_name + "::") + actual_eager_load_dir(root_dir, root_namespace) + elsif mod_name == root_namespace_name + actual_eager_load_dir(root_dir, root_namespace) + elsif mod_name.start_with?(root_namespace_name + "::") + eager_load_child_namespace(mod, mod_name, root_dir, root_namespace) + else + # Unrelated constant hierarchies, do nothing. + end + end + end + end + + # Loads the given Ruby file. + # + # Raises if the argument is ignored, shadowed, or not managed by the receiver. + # + # The method is implemented as `constantize` for files, in a sense, to be able + # to descend orderly and make sure the file is loadable. + # + # @sig (String | Pathname) -> void + def load_file(path) + abspath = File.expand_path(path) + + raise Zeitwerk::Error.new("#{abspath} does not exist") unless File.exist?(abspath) + raise Zeitwerk::Error.new("#{abspath} is not a Ruby file") if dir?(abspath) || !ruby?(abspath) + raise Zeitwerk::Error.new("#{abspath} is ignored") if ignored_paths.member?(abspath) + + basename = File.basename(abspath, ".rb") + base_cname = inflector.camelize(basename, abspath).to_sym + + root_namespace = nil + cnames = [] + + walk_up(File.dirname(abspath)) do |dir| + raise Zeitwerk::Error.new("#{abspath} is ignored") if ignored_paths.member?(dir) + + break if root_namespace = roots[dir] + + unless collapse?(dir) + basename = File.basename(dir) + cnames << inflector.camelize(basename, dir).to_sym + end + end + + raise Zeitwerk::Error.new("I do not manage #{abspath}") unless root_namespace + + namespace = root_namespace + cnames.reverse_each do |cname| + namespace = cget(namespace, cname) + end + + raise Zeitwerk::Error.new("#{abspath} is shadowed") if shadowed_file?(abspath) + + cget(namespace, base_cname) + end + + # The caller is responsible for making sure `namespace` is the namespace that + # corresponds to `dir`. + # + # @sig (String, Module, Boolean) -> void + private def actual_eager_load_dir(dir, namespace, force: false) + honour_exclusions = !force + return if honour_exclusions && excluded_from_eager_load?(dir) + + log("eager load directory #{dir} start") if logger + + queue = [[dir, namespace]] + while to_eager_load = queue.shift + dir, namespace = to_eager_load + + ls(dir) do |basename, abspath| + next if honour_exclusions && eager_load_exclusions.member?(abspath) + + if ruby?(abspath) + if (cref = autoloads[abspath]) && !shadowed_file?(abspath) + cget(*cref) + end + else + if collapse?(abspath) + queue << [abspath, namespace] + else + cname = inflector.camelize(basename, abspath).to_sym + queue << [abspath, cget(namespace, cname)] + end + end + end + end + + log("eager load directory #{dir} end") if logger + end + + # In order to invoke this method, the caller has to ensure `child` is a + # strict namespace descendendant of `root_namespace`. + # + # @sig (Module, String, Module, Boolean) -> void + private def eager_load_child_namespace(child, child_name, root_dir, root_namespace) + suffix = child_name + unless root_namespace.equal?(Object) + suffix = suffix.delete_prefix(real_mod_name(root_namespace) + "::") + end + + # These directories are at the same namespace level, there may be more if + # we find collapsed ones. As we scan, we look for matches for the first + # segment, and store them in `next_dirs`. If there are any, we look for + # the next segments in those matches. Repeat. + # + # If we exhaust the search locating directories that match all segments, + # we just need to eager load those ones. + dirs = [root_dir] + next_dirs = [] + + suffix.split("::").each do |segment| + while dir = dirs.shift + ls(dir) do |basename, abspath| + next unless dir?(abspath) + + if collapse?(abspath) + current_dirs << abspath + elsif segment == inflector.camelize(basename, abspath) + next_dirs << abspath + end + end + end + + return if next_dirs.empty? + + dirs.replace(next_dirs) + next_dirs.clear + end + + dirs.each do |dir| + actual_eager_load_dir(dir, child) + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/helpers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/helpers.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/helpers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/helpers.rb index 117167180b..575712ede2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/loader/helpers.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/loader/helpers.rb @@ -31,7 +31,8 @@ module Zeitwerk::Loader::Helpers next if ignored_paths.member?(abspath) if dir?(abspath) - next unless has_at_least_one_ruby_file?(abspath) + next if roots.key?(abspath) + next if !has_at_least_one_ruby_file?(abspath) else next unless ruby?(abspath) end @@ -74,6 +75,15 @@ module Zeitwerk::Loader::Helpers basename.start_with?(".") end + # @sig (String) { (String) -> void } -> void + def walk_up(abspath) + loop do + yield abspath + abspath, basename = File.split(abspath) + break if basename == "/" + end + end + # --- Constants --------------------------------------------------------------------------------- # The autoload? predicate takes into account the ancestor chain of the diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/real_mod_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/real_mod_name.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/real_mod_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/real_mod_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/registry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/registry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/registry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/registry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/version.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/version.rb index 2ffe91f7ea..c23baf979f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.1/lib/zeitwerk/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.6.4/lib/zeitwerk/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Zeitwerk - VERSION = "2.6.1" + VERSION = "2.6.4" end