diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 415610c369..80afe8b7ca 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -139,10 +139,10 @@ GEM rubocop-performance (1.14.3) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.15.2) + rubocop-rails (2.16.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) + rubocop (>= 1.33.0, < 2.0) rubocop-rspec (2.12.1) rubocop (~> 1.31) rubocop-sorbet (0.6.11) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.15.2.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.0.rbi similarity index 93% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.15.2.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.0.rbi index fe2e98a76f..3a793a7d83 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.15.2.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.16.0.rbi @@ -53,6 +53,7 @@ module RuboCop::Cop::EnforceSuperclass end end +RuboCop::Cop::IgnoredMethods = RuboCop::Cop::AllowedMethods RuboCop::Cop::IgnoredPattern = RuboCop::Cop::AllowedPattern module RuboCop::Cop::IndexMethod @@ -125,6 +126,25 @@ end module RuboCop::Cop::Rails; end +class RuboCop::Cop::Rails::ActionControllerFlashBeforeRender < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def action_controller?(param0); end + def flash_assignment?(param0); end + def on_send(flash_node); end + def render?(param0); end + + private + + def find_ancestor(node, type:); end + def followed_by_render?(flash_node); end + def inherit_action_controller_base?(node); end + def instance_method_or_block?(node); end +end + +RuboCop::Cop::Rails::ActionControllerFlashBeforeRender::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::ActionControllerFlashBeforeRender::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::ActionControllerTestCase < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector extend ::RuboCop::Cop::TargetRailsVersion @@ -217,6 +237,16 @@ RuboCop::Cop::Rails::ActiveSupportAliases::ALIASES = T.let(T.unsafe(nil), Hash) RuboCop::Cop::Rails::ActiveSupportAliases::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::ActiveSupportAliases::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::ActiveSupportOnLoad < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end +end + +RuboCop::Cop::Rails::ActiveSupportOnLoad::LOAD_HOOKS = T.let(T.unsafe(nil), Hash) +RuboCop::Cop::Rails::ActiveSupportOnLoad::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::ActiveSupportOnLoad::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::AddColumnIndex < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector @@ -545,7 +575,7 @@ class RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods < ::RuboCop::Cop:: extend ::RuboCop::Cop::AutoCorrector def any_manipulation?(param0 = T.unsafe(nil)); end - def errors_keys?(param0 = T.unsafe(nil)); end + def errors_deprecated?(param0 = T.unsafe(nil)); end def messages_details_assignment?(param0 = T.unsafe(nil)); end def messages_details_manipulation?(param0 = T.unsafe(nil)); end def on_send(node); end @@ -561,9 +591,11 @@ class RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods < ::RuboCop::Cop:: def offense_range(node, receiver); end def receiver_matcher(node); end def replacement(node, receiver); end + def skip_autocorrect?(node); end end -RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::AUTOCORECTABLE_METHODS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::AUTOCORRECTABLE_METHODS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::INCOMPATIBLE_METHODS = T.let(T.unsafe(nil), Array) RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::MANIPULATIVE_METHODS = T.let(T.unsafe(nil), Set) RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::MSG = T.let(T.unsafe(nil), String) @@ -837,6 +869,8 @@ RuboCop::Cop::Rails::FindById::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) class RuboCop::Cop::Rails::FindEach < ::RuboCop::Cop::Base include ::RuboCop::Cop::ActiveRecordHelper + include ::RuboCop::Cop::AllowedMethods + include ::RuboCop::Cop::AllowedPattern extend ::RuboCop::Cop::AutoCorrector def on_send(node); end @@ -852,6 +886,24 @@ RuboCop::Cop::Rails::FindEach::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::FindEach::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) RuboCop::Cop::Rails::FindEach::SCOPE_METHODS = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::FreezeTime < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end + def time_now?(param0 = T.unsafe(nil)); end + def zoned_time_now?(param0 = T.unsafe(nil)); end + + private + + def current_time?(node, method_name); end + def current_time_with_convert?(node, method_name); end +end + +RuboCop::Cop::Rails::FreezeTime::CONV_METHODS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Rails::FreezeTime::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::FreezeTime::NOW_METHODS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Rails::FreezeTime::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::HasAndBelongsToMany < ::RuboCop::Cop::Base def on_send(node); end end @@ -1486,12 +1538,13 @@ class RuboCop::Cop::Rails::RedundantReceiverInWithOptions < ::RuboCop::Cop::Base def all_block_nodes_in(param0); end def all_send_nodes_in(param0); end def on_block(node); end - def with_options?(param0 = T.unsafe(nil)); end + def on_numblock(node); end private - def autocorrect(corrector, node); end + def autocorrect(corrector, send_node, node); end def block_argument_range(node); end + def redundant_receiver?(send_nodes, node); end def same_value?(arg_node, recv_node); end def search_begin_pos_of_space_before_block_argument(begin_pos); end end @@ -1517,6 +1570,7 @@ class RuboCop::Cop::Rails::ReflectionClassName < ::RuboCop::Cop::Base private def reflection_class_value?(class_value); end + def str_assigned?(reflection_class_name); end end RuboCop::Cop::Rails::ReflectionClassName::ALLOWED_REFLECTION_CLASS_TYPES = T.let(T.unsafe(nil), Array) @@ -1621,6 +1675,7 @@ class RuboCop::Cop::Rails::ReversibleMigration < ::RuboCop::Cop::Base def drop_table_call(param0 = T.unsafe(nil)); end def irreversible_schema_statement_call(param0 = T.unsafe(nil)); end def on_block(node); end + def on_numblock(node); end def on_send(node); end def remove_column_call(param0 = T.unsafe(nil)); end def remove_columns_call(param0 = T.unsafe(nil)); end @@ -1672,6 +1727,26 @@ end RuboCop::Cop::Rails::RootJoinChain::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::RootJoinChain::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) +class RuboCop::Cop::Rails::RootPathnameMethods < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + + def on_send(node); end + def pathname_method(param0 = T.unsafe(nil)); end + def rails_root?(param0 = T.unsafe(nil)); end + def rails_root_pathname?(param0 = T.unsafe(nil)); end + + private + + def evidence(node); end +end + +RuboCop::Cop::Rails::RootPathnameMethods::DIR_METHODS = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Rails::RootPathnameMethods::FILE_METHODS = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Rails::RootPathnameMethods::FILE_TEST_METHODS = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Rails::RootPathnameMethods::FILE_UTILS_METHODS = T.let(T.unsafe(nil), Set) +RuboCop::Cop::Rails::RootPathnameMethods::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::RootPathnameMethods::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) + class RuboCop::Cop::Rails::RootPublicPath < ::RuboCop::Cop::Base extend ::RuboCop::Cop::AutoCorrector @@ -1925,6 +2000,31 @@ end RuboCop::Cop::Rails::ToFormattedS::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::ToFormattedS::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::ToSWithArgument < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRailsVersion + + def on_csend(node); end + def on_send(node); end +end + +RuboCop::Cop::Rails::ToSWithArgument::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::ToSWithArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + +class RuboCop::Cop::Rails::TopLevelHashWithIndifferentAccess < ::RuboCop::Cop::Base + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRailsVersion + + def on_const(node); end + def top_level_hash_with_indifferent_access?(param0 = T.unsafe(nil)); end + + private + + def autocorrect(corrector, node); end +end + +RuboCop::Cop::Rails::TopLevelHashWithIndifferentAccess::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Rails::TransactionExitStatement < ::RuboCop::Cop::Base def exit_statements(param0); end def on_send(node); end @@ -2084,6 +2184,31 @@ end RuboCop::Cop::Rails::WhereExists::MSG = T.let(T.unsafe(nil), String) RuboCop::Cop::Rails::WhereExists::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) +class RuboCop::Cop::Rails::WhereMissing < ::RuboCop::Cop::Base + include ::RuboCop::Cop::RangeHelp + extend ::RuboCop::Cop::AutoCorrector + extend ::RuboCop::Cop::TargetRailsVersion + + def missing_relationship(param0); end + def on_send(node); end + def where_node_and_argument(param0); end + + private + + def message(node, where_argument); end + def multi_condition?(where_arg); end + def register_offense(node, where_node, where_argument, range); end + def remove_where_method(corrector, node, where_node); end + def replace_range(child); end + def replace_where_method(corrector, where_node); end + def root_receiver(node); end + def same_line?(left_joins_node, where_node); end + def same_relationship?(where, left_joins); end +end + +RuboCop::Cop::Rails::WhereMissing::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Rails::WhereMissing::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) + class RuboCop::Cop::Rails::WhereNot < ::RuboCop::Cop::Base include ::RuboCop::Cop::RangeHelp extend ::RuboCop::Cop::AutoCorrector diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index 3342a28d97..68c116ff28 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -4926,9 +4926,11 @@ module RuboCop::AST::NodePattern::Sets SET_BUILD_RECOMMENDED_TEST_OPTIONAL = ::T.let(nil, ::T.untyped) SET_DEPENDS_ON_USES_FROM_MACOS = ::T.let(nil, ::T.untyped) SET_INCLUDE_WITH_WITHOUT = ::T.let(nil, ::T.untyped) + SET_KEYS_VALUES_TO_H_TO_XML = ::T.let(nil, ::T.untyped) SET_ON_INTEL_ON_ARM = ::T.let(nil, ::T.untyped) SET_OR_NEWER_OR_OLDER = ::T.let(nil, ::T.untyped) SET_SYSTEM_SHELL_OUTPUT_PIPE_OUTPUT = ::T.let(nil, ::T.untyped) + SET_TIME_DATETIME = ::T.let(nil, ::T.untyped) SET_WITH_WITHOUT = ::T.let(nil, ::T.untyped) SET____ETC_4 = ::T.let(nil, ::T.untyped) end diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 3bdbb9abd7..4bfa80a8b9 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -88,7 +88,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11 $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.2.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.35.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.14.3/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.15.2/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.16.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.12.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.11/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-3.0.0/lib" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/obsoletion.yml deleted file mode 100644 index 9cfb451ff7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/obsoletion.yml +++ /dev/null @@ -1,7 +0,0 @@ -# -# Configuration for obsoletion. -# -# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions -# -extracted: - Rails/*: ~ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/default.yml similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/default.yml index 27446c2fed..bb8a6376a3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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 + # Enable checking Active Support extensions. + # See: https://docs.rubocop.org/rubocop/configuration.html#enable-checking-active-support-extensions + ActiveSupportExtensionsEnabled: true # What version of Rails is the inspected code using? If a value is specified # for TargetRailsVersion then it is used. Acceptable values are specified # as a float (i.e. 5.1); the patch version of Rails should not be included. @@ -23,6 +26,24 @@ Lint/NumberConversion: # Add Rails' duration methods to the ignore list for `Lint/NumberConversion` # so that calling `to_i` on one of these does not register an offense. # See: https://github.com/rubocop/rubocop/issues/8950 + AllowedMethods: + - ago + - from_now + - second + - seconds + - minute + - minutes + - hour + - hours + - day + - days + - week + - weeks + - fortnight + - fortnights + - in_milliseconds + AllowedPatterns: [] + # Deprecated. IgnoredMethods: - ago - from_now @@ -40,6 +61,18 @@ Lint/NumberConversion: - fortnights - in_milliseconds +Rails: + Enabled: true + DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails + +Rails/ActionControllerFlashBeforeRender: + Description: 'Use `flash.now` instead of `flash` before `render`.' + StyleGuide: 'https://rails.rubystyle.guide/#flash-before-render' + Reference: 'https://api.rubyonrails.org/classes/ActionController/FlashBeforeRender.html' + Enabled: 'pending' + SafeAutocorrect: false + VersionAdded: '2.16' + Rails/ActionControllerTestCase: Description: 'Use `ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`.' StyleGuide: 'https://rails.rubystyle.guide/#integration-testing' @@ -96,6 +129,15 @@ Rails/ActiveSupportAliases: Enabled: true VersionAdded: '0.48' +Rails/ActiveSupportOnLoad: + Description: 'Use `ActiveSupport.on_load(...)` to patch Rails framework classes.' + Enabled: 'pending' + Reference: + - 'https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html' + - 'https://guides.rubyonrails.org/engines.html#available-load-hooks' + SafeAutoCorrect: false + VersionAdded: '2.16' + Rails/AddColumnIndex: Description: >- Rails migrations don't make use of a given `index` key, but also @@ -407,6 +449,14 @@ Rails/FindEach: VersionChanged: '2.9' Include: - app/models/**/*.rb + AllowedMethods: + # Methods that don't work well with `find_each`. + - order + - limit + - select + - lock + AllowedPatterns: [] + # Deprecated. IgnoredMethods: # Methods that don't work well with `find_each`. - order @@ -414,6 +464,13 @@ Rails/FindEach: - select - lock +Rails/FreezeTime: + Description: 'Prefer `freeze_time` over `travel_to` with an argument of the current time.' + StyleGuide: 'https://rails.rubystyle.guide/#freeze-time' + Enabled: pending + VersionAdded: '2.16' + SafeAutoCorrect: false + Rails/HasAndBelongsToMany: Description: 'Prefer has_many :through to has_and_belongs_to_many.' StyleGuide: 'https://rails.rubystyle.guide#has-many-through' @@ -785,6 +842,11 @@ Rails/RootJoinChain: Enabled: pending VersionAdded: '2.13' +Rails/RootPathnameMethods: + Description: 'Use `Rails.root` IO methods instead of passing it to `File`.' + Enabled: pending + VersionAdded: '2.16' + Rails/RootPublicPath: Description: "Favor `Rails.public_path` over `Rails.root` with `'public'`." Enabled: pending @@ -937,6 +999,18 @@ Rails/ToFormattedS: - to_formatted_s VersionAdded: '2.15' +Rails/ToSWithArgument: + Description: 'Identifies passing any argument to `#to_s`.' + Enabled: pending + Safe: false + VersionAdded: '2.16' + +Rails/TopLevelHashWithIndifferentAccess: + Description: 'Identifies top-level `HashWithIndifferentAccess`.' + Reference: 'https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#top-level-hashwithindifferentaccess-is-soft-deprecated' + Enabled: pending + VersionAdded: '2.16' + Rails/TransactionExitStatement: Description: 'Avoid the usage of `return`, `break` and `throw` in transaction blocks.' Enabled: pending @@ -1003,6 +1077,12 @@ Rails/WhereExists: VersionAdded: '2.7' VersionChanged: '2.10' +Rails/WhereMissing: + Description: 'Use `where.missing(...)` to find missing relationship records.' + StyleGuide: 'https://rails.rubystyle.guide/#finding-missing-relationship-records' + Enabled: pending + VersionAdded: '2.16' + Rails/WhereNot: Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.' StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/obsoletion.yml new file mode 100644 index 0000000000..b304073aa6 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/config/obsoletion.yml @@ -0,0 +1,17 @@ +# +# Configuration for obsoletion. +# +# See: https://docs.rubocop.org/rubocop/extensions.html#config-obsoletions +# +extracted: + Rails/*: ~ + +# Cop parameters that have been changed +# Can be treated as a warning instead of a failure with `severity: warning` +changed_parameters: + - cops: Rails/FindEach + parameters: IgnoredMethods + alternatives: + - AllowedMethods + - AllowedPatterns + severity: warning diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop-rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop-rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop-rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop-rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_helper.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_helper.rb index 3a9b1ea4b3..4e776f90bd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_helper.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_helper.rb @@ -48,10 +48,7 @@ module RuboCop class_nodes = class_node.defined_module.each_node namespaces = class_node.each_ancestor(:class, :module).map(&:identifier) - [*class_nodes, *namespaces] - .reverse - .map { |node| node.children[1] }.join('_') - .tableize + [*class_nodes, *namespaces].reverse.map { |node| node.children[1] }.join('_').tableize end # Resolve relation into column name. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_migrations_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb index 0934d2693f..0364f2b99d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/active_record_migrations_helper.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb @@ -10,9 +10,7 @@ module RuboCop bigint binary boolean date datetime decimal float integer json string text time timestamp virtual ].freeze - RAILS_ABSTRACT_SCHEMA_DEFINITIONS_HELPERS = %i[ - column references belongs_to primary_key numeric - ].freeze + RAILS_ABSTRACT_SCHEMA_DEFINITIONS_HELPERS = %i[column references belongs_to primary_key numeric].freeze POSTGRES_SCHEMA_DEFINITIONS = %i[ bigserial bit bit_varying cidr citext daterange hstore inet interval int4range int8range jsonb ltree macaddr money numrange oid point line diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/class_send_node_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/mixin/class_send_node_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/class_send_node_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/enforce_superclass.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/enforce_superclass.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/enforce_superclass.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/enforce_superclass.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/index_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/index_method.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/index_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/index_method.rb index 952ffcf862..5cc2009486 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/index_method.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/index_method.rb @@ -6,7 +6,7 @@ module RuboCop module IndexMethod # rubocop:disable Metrics/ModuleLength RESTRICT_ON_SEND = %i[each_with_object to_h map collect []].freeze - def on_block(node) + def on_block(node) # rubocop:todo InternalAffairs/NumblockHandler on_bad_each_with_object(node) do |*match| handle_possible_offense(node, match, 'each_with_object') end @@ -98,10 +98,7 @@ module RuboCop captures = extract_captures(correction.match) correction.set_new_arg_name(captures.transformed_argname, corrector) - correction.set_new_body_expression( - captures.transforming_body_expr, - corrector - ) + correction.set_new_body_expression(captures.transforming_body_expr, corrector) end # Internal helper class to hold match data @@ -110,8 +107,7 @@ module RuboCop :transforming_body_expr ) do def noop_transformation? - transforming_body_expr.lvar_type? && - transforming_body_expr.children == [transformed_argname] + transforming_body_expr.lvar_type? && transforming_body_expr.children == [transformed_argname] end end @@ -157,17 +153,11 @@ module RuboCop end def set_new_arg_name(transformed_argname, corrector) - corrector.replace( - block_node.arguments.loc.expression, - "|#{transformed_argname}|" - ) + corrector.replace(block_node.arguments.loc.expression, "|#{transformed_argname}|") end def set_new_body_expression(transforming_body_expr, corrector) - corrector.replace( - block_node.body.loc.expression, - transforming_body_expr.loc.expression.source - ) + corrector.replace(block_node.body.loc.expression, transforming_body_expr.loc.expression.source) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/migrations_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/migrations_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/migrations_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/mixin/target_rails_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/mixin/target_rails_version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/mixin/target_rails_version.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb new file mode 100644 index 0000000000..92a7af6296 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_flash_before_render.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Using `flash` assignment before `render` in Rails controllers will persist the message for too long. + # Check https://guides.rubyonrails.org/action_controller_overview.html#flash-now + # + # @safety + # This cop's autocorrection is unsafe because it replaces `flash` by `flash.now`. + # Even though it is usually a mistake, it might be used intentionally. + # + # @example + # + # # bad + # class HomeController < ApplicationController + # def create + # flash[:alert] = "msg" + # render :index + # end + # end + # + # # good + # class HomeController < ApplicationController + # def create + # flash.now[:alert] = "msg" + # render :index + # end + # end + # + class ActionControllerFlashBeforeRender < Base + extend AutoCorrector + + MSG = 'Use `flash.now` before `render`.' + + def_node_search :flash_assignment?, <<~PATTERN + ^(send (send nil? :flash) :[]= ...) + PATTERN + + def_node_search :render?, <<~PATTERN + (send nil? :render ...) + PATTERN + + def_node_search :action_controller?, <<~PATTERN + { + (const nil? :ApplicationController) + (const (const nil? :ActionController) :Base) + } + PATTERN + + RESTRICT_ON_SEND = [:flash].freeze + + def on_send(flash_node) + return unless flash_assignment?(flash_node) + + return unless followed_by_render?(flash_node) + + return unless instance_method_or_block?(flash_node) + + return unless inherit_action_controller_base?(flash_node) + + add_offense(flash_node) do |corrector| + corrector.replace(flash_node, 'flash.now') + end + end + + private + + def followed_by_render?(flash_node) + flash_assigment_node = find_ancestor(flash_node, type: :send) + context = flash_assigment_node.parent + + context.each_child_node.any? do |node| + render?(node) + end + end + + def inherit_action_controller_base?(node) + class_node = find_ancestor(node, type: :class) + return unless class_node + + action_controller?(class_node) + end + + def instance_method_or_block?(node) + def_node = find_ancestor(node, type: :def) + block_node = find_ancestor(node, type: :block) + + def_node || block_node + end + + def find_ancestor(node, type:) + node.each_ancestor(type).first + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_controller_test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_test_case.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_controller_test_case.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_controller_test_case.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_filter.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_filter.rb index 83db0ade84..e144568e8a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/action_filter.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/action_filter.rb @@ -69,7 +69,7 @@ module RuboCop RESTRICT_ON_SEND = FILTER_METHODS + ACTION_METHODS - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler check_method_node(node.send_node) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_aliases.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_aliases.rb index d48e184723..6f81e3b6d7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_aliases.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_aliases.rb @@ -21,10 +21,7 @@ module RuboCop MSG = 'Use `%s` instead of `%s`.' - ALIASES = { - update_attributes: :update, - update_attributes!: :update! - }.freeze + ALIASES = { update_attributes: :update, update_attributes!: :update! }.freeze RESTRICT_ON_SEND = ALIASES.keys.freeze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_callbacks_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/active_record_callbacks_order.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_callbacks_order.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_override.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_override.rb index 16fe42e82d..695643fb57 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_record_override.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_record_override.rb @@ -25,12 +25,9 @@ module RuboCop # end # class ActiveRecordOverride < Base - MSG = - 'Use %s callbacks instead of overriding the Active Record ' \ - 'method `%s`.' + MSG = 'Use %s callbacks instead of overriding the Active Record method `%s`.' BAD_METHODS = %i[create destroy save update].freeze - ACTIVE_RECORD_CLASSES = %w[ApplicationRecord ActiveModel::Base - ActiveRecord::Base].freeze + ACTIVE_RECORD_CLASSES = %w[ApplicationRecord ActiveModel::Base ActiveRecord::Base].freeze def on_def(node) return unless BAD_METHODS.include?(node.method_name) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/active_support_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/active_support_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_aliases.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_on_load.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_on_load.rb new file mode 100644 index 0000000000..1bb9f50d2b --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/active_support_on_load.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Checks for Rails framework classes that are patched directly instead of using Active Support load hooks. Direct + # patching forcibly loads the framework referenced, using hooks defers loading until it's actually needed. + # + # @safety + # While using lazy load hooks is recommended, it changes the order in which is code is loaded and may reveal + # load order dependency bugs. + # + # @example + # + # # bad + # ActiveRecord::Base.include(MyClass) + # + # # good + # ActiveSupport.on_load(:active_record) { include MyClass } + class ActiveSupportOnLoad < Base + extend AutoCorrector + + MSG = 'Use `%s` instead of `%s`.' + RESTRICT_ON_SEND = %i[prepend include extend].freeze + LOAD_HOOKS = { + 'ActionCable' => 'action_cable', + 'ActionCable::Channel::Base' => 'action_cable_channel', + 'ActionCable::Connection::Base' => 'action_cable_connection', + 'ActionCable::Connection::TestCase' => 'action_cable_connection_test_case', + 'ActionController::API' => 'action_controller', + 'ActionController::Base' => 'action_controller', + 'ActionController::TestCase' => 'action_controller_test_case', + 'ActionDispatch::IntegrationTest' => 'action_dispatch_integration_test', + 'ActionDispatch::Request' => 'action_dispatch_request', + 'ActionDispatch::Response' => 'action_dispatch_response', + 'ActionDispatch::SystemTestCase' => 'action_dispatch_system_test_case', + 'ActionMailbox::Base' => 'action_mailbox', + 'ActionMailbox::InboundEmail' => 'action_mailbox_inbound_email', + 'ActionMailbox::Record' => 'action_mailbox_record', + 'ActionMailbox::TestCase' => 'action_mailbox_test_case', + 'ActionMailer::Base' => 'action_mailer', + 'ActionMailer::TestCase' => 'action_mailer_test_case', + 'ActionText::Content' => 'action_text_content', + 'ActionText::Record' => 'action_text_record', + 'ActionText::RichText' => 'action_text_rich_text', + 'ActionView::Base' => 'action_view', + 'ActionView::TestCase' => 'action_view_test_case', + 'ActiveJob::Base' => 'active_job', + 'ActiveJob::TestCase' => 'active_job_test_case', + 'ActiveRecord::Base' => 'active_record', + 'ActiveStorage::Attachment' => 'active_storage_attachment', + 'ActiveStorage::Blob' => 'active_storage_blob', + 'ActiveStorage::Record' => 'active_storage_record', + 'ActiveStorage::VariantRecord' => 'active_storage_variant_record', + 'ActiveSupport::TestCase' => 'active_support_test_case' + }.freeze + + def on_send(node) + receiver, method, arguments = *node # rubocop:disable InternalAffairs/NodeDestructuring + return unless receiver && (hook = LOAD_HOOKS[receiver.const_name]) + + preferred = "ActiveSupport.on_load(:#{hook}) { #{method} #{arguments.source} }" + add_offense(node, message: format(MSG, prefer: preferred, current: node.source)) do |corrector| + corrector.replace(node, preferred) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/add_column_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/add_column_index.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/add_column_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/add_column_index.rb index 9bc6bb7cd4..96cf6174d1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/add_column_index.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/add_column_index.rb @@ -53,10 +53,7 @@ module RuboCop private def index_range(pair_node) - range_with_surrounding_comma( - range_with_surrounding_space(range: pair_node.loc.expression, side: :left), - :left - ) + range_with_surrounding_comma(range_with_surrounding_space(pair_node.loc.expression, side: :left), :left) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/after_commit_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/after_commit_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/after_commit_override.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_controller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_controller.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_controller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_controller.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_job.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_job.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_job.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_job.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_mailer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_mailer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_mailer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_mailer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_record.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_record.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/application_record.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/application_record.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/arel_star.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/arel_star.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/arel_star.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/arel_star.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/assert_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/assert_not.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/assert_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/assert_not.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/attribute_default_block_value.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/attribute_default_block_value.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/attribute_default_block_value.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/belongs_to.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/belongs_to.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/belongs_to.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/blank.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/blank.rb index d5a0a8fa2c..1c0825a790 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/blank.rb @@ -63,8 +63,7 @@ module RuboCop MSG_NIL_OR_EMPTY = 'Use `%s` instead of `%s`.' MSG_NOT_PRESENT = 'Use `%s` instead of `%s`.' - MSG_UNLESS_PRESENT = 'Use `if %s` instead of ' \ - '`%s`.' + MSG_UNLESS_PRESENT = 'Use `if %s` instead of `%s`.' RESTRICT_ON_SEND = %i[!].freeze # `(send nil $_)` is not actually a valid match for an offense. Nodes diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/bulk_change_table.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/bulk_change_table.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/bulk_change_table.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/bulk_change_table.rb index a9bfb2c9e5..a97f0485a3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/bulk_change_table.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/bulk_change_table.rb @@ -111,25 +111,13 @@ module RuboCop remove_timestamps ].freeze - MYSQL_COMBINABLE_TRANSFORMATIONS = %i[ - rename - index - remove_index - ].freeze + MYSQL_COMBINABLE_TRANSFORMATIONS = %i[rename index remove_index].freeze - MYSQL_COMBINABLE_ALTER_METHODS = %i[ - rename_column - add_index - remove_index - ].freeze + MYSQL_COMBINABLE_ALTER_METHODS = %i[rename_column add_index remove_index].freeze - POSTGRESQL_COMBINABLE_TRANSFORMATIONS = %i[ - change_default - ].freeze + POSTGRESQL_COMBINABLE_TRANSFORMATIONS = %i[change_default].freeze - POSTGRESQL_COMBINABLE_ALTER_METHODS = %i[ - change_column_default - ].freeze + POSTGRESQL_COMBINABLE_ALTER_METHODS = %i[change_column_default].freeze def on_def(node) return unless support_bulk_alter? @@ -186,8 +174,7 @@ module RuboCop options = node.arguments[1] return false unless options - options.hash_type? && - options.keys.any? { |key| key.sym_type? && key.value == :bulk } + options.hash_type? && options.keys.any? { |key| key.sym_type? && key.value == :bulk } end def database @@ -237,8 +224,7 @@ module RuboCop end def call_to_combinable_alter_method?(child_node) - child_node.send_type? && - combinable_alter_methods.include?(child_node.method_name) + child_node.send_type? && combinable_alter_methods.include?(child_node.method_name) end def combinable_alter_methods diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/compact_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/compact_blank.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/compact_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/compact_blank.rb index 8efcf30f1d..fe5e88448f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/compact_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/compact_blank.rb @@ -93,7 +93,11 @@ module RuboCop end def offense_range(node) - end_pos = node.parent&.block_type? ? node.parent.loc.expression.end_pos : node.loc.expression.end_pos + end_pos = if node.parent&.block_type? && node.parent&.send_node == node + node.parent.loc.expression.end_pos + else + node.loc.expression.end_pos + end range_between(node.loc.selector.begin_pos, end_pos) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/content_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/content_tag.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/content_tag.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/content_tag.rb index 2c36621d1c..9cc8dc9d45 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/content_tag.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/content_tag.rb @@ -37,9 +37,7 @@ module RuboCop return if node.arguments.count >= 3 first_argument = node.first_argument - return if !first_argument || - allowed_argument?(first_argument) || - corrected_ancestor?(node) + return if !first_argument || allowed_argument?(first_argument) || corrected_ancestor?(node) preferred_method = node.first_argument.value.to_s.underscore message = format(MSG, preferred_method: preferred_method, current_argument: first_argument.source) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/create_table_with_timestamps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/create_table_with_timestamps.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/date.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/date.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/date.rb index 1515387925..e9de8d44e0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/date.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/date.rb @@ -53,22 +53,17 @@ module RuboCop class Date < Base include ConfigurableEnforcedStyle - MSG = 'Do not use `Date.%s` without zone. Use ' \ - '`Time.zone.%s` instead.' + MSG = 'Do not use `Date.%s` without zone. Use `Time.zone.%s` instead.' - MSG_SEND = 'Do not use `%s` on Date objects, because they ' \ - 'know nothing about the time zone in use.' + MSG_SEND = 'Do not use `%s` on Date objects, because they know nothing about the time zone in use.' RESTRICT_ON_SEND = %i[to_time to_time_in_current_zone].freeze BAD_DAYS = %i[today current yesterday tomorrow].freeze - DEPRECATED_METHODS = [ - { deprecated: 'to_time_in_current_zone', relevant: 'in_time_zone' } - ].freeze + DEPRECATED_METHODS = [{ deprecated: 'to_time_in_current_zone', relevant: 'in_time_zone' }].freeze - DEPRECATED_MSG = '`%s` is deprecated. ' \ - 'Use `%s` instead.' + DEPRECATED_MSG = '`%s` is deprecated. Use `%s` instead.' def on_const(node) mod, klass = *node.children diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/default_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/default_scope.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/default_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/default_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate.rb index 7bc8f27c08..2f1c80662b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate.rb @@ -93,15 +93,12 @@ module RuboCop return false if arg_array.size != argument_array.size arg_array.zip(argument_array).all? do |arg, argument| - arg.arg_type? && - argument.lvar_type? && - arg.children == argument.children + arg.arg_type? && argument.lvar_type? && arg.children == argument.children end end def method_name_matches?(method_name, body) - method_name == body.method_name || - (include_prefix_case? && method_name == prefixed_method_name(body)) + method_name == body.method_name || (include_prefix_case? && method_name == prefixed_method_name(body)) end def include_prefix_case? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/delegate_allow_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/delegate_allow_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/delegate_allow_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb similarity index 81% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb index e2c9d79e93..f07dc156f1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb @@ -37,7 +37,8 @@ module RuboCop extend AutoCorrector MSG = 'Avoid manipulating ActiveModel errors as hash directly.' - AUTOCORECTABLE_METHODS = %i[<< clear keys].freeze + AUTOCORRECTABLE_METHODS = %i[<< clear keys].freeze + INCOMPATIBLE_METHODS = %i[keys values to_h to_xml].freeze MANIPULATIVE_METHODS = Set[ *%i[ @@ -55,7 +56,7 @@ module RuboCop { #root_manipulation? #root_assignment? - #errors_keys? + #errors_deprecated? #messages_details_manipulation? #messages_details_assignment? } @@ -77,10 +78,10 @@ module RuboCop ...) PATTERN - def_node_matcher :errors_keys?, <<~PATTERN + def_node_matcher :errors_deprecated?, <<~PATTERN (send (send #receiver_matcher :errors) - :keys) + {:keys :values :to_h :to_xml}) PATTERN def_node_matcher :messages_details_manipulation?, <<~PATTERN @@ -106,10 +107,10 @@ module RuboCop def on_send(node) any_manipulation?(node) do - next if node.method?(:keys) && target_rails_version <= 6.0 + next if target_rails_version <= 6.0 && INCOMPATIBLE_METHODS.include?(node.method_name) add_offense(node) do |corrector| - next unless AUTOCORECTABLE_METHODS.include?(node.method_name) + next if skip_autocorrect?(node) autocorrect(corrector, node) end @@ -118,14 +119,16 @@ module RuboCop private + def skip_autocorrect?(node) + return true unless AUTOCORRECTABLE_METHODS.include?(node.method_name) + return false unless (receiver = node.receiver.receiver) + + receiver.send_type? && receiver.method?(:details) && node.method?(:<<) + end + def autocorrect(corrector, node) receiver = node.receiver - if receiver.receiver.send_type? && receiver.receiver.method?(:messages) - corrector.remove(receiver.receiver.loc.dot) - corrector.remove(receiver.receiver.loc.selector) - end - range = offense_range(node, receiver) replacement = replacement(node, receiver) @@ -133,11 +136,12 @@ module RuboCop end def offense_range(node, receiver) - range_between(receiver.receiver.source_range.end_pos, node.source_range.end_pos) + receiver = receiver.receiver while receiver.send_type? && !receiver.method?(:errors) && receiver.receiver + range_between(receiver.source_range.end_pos, node.source_range.end_pos) end def replacement(node, receiver) - return '.errors.attribute_names' if node.method?(:keys) + return '.attribute_names' if node.method?(:keys) key = receiver.first_argument.source diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dot_separated_keys.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dot_separated_keys.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dot_separated_keys.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dot_separated_keys.rb index 29d9ece7b9..73d8da171c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dot_separated_keys.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dot_separated_keys.rb @@ -37,7 +37,7 @@ module RuboCop add_offense(scope_node) do |corrector| # Eat the comma on the left. - range = range_with_surrounding_space(range: scope_node.source_range, side: :left) + range = range_with_surrounding_space(scope_node.source_range, side: :left) range = range_with_surrounding_comma(range, :left) corrector.remove(range) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duplicate_association.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duplicate_association.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duplicate_association.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duplicate_association.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duplicate_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duplicate_scope.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duplicate_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duplicate_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duration_arithmetic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duration_arithmetic.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/duration_arithmetic.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/duration_arithmetic.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dynamic_find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dynamic_find_by.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dynamic_find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dynamic_find_by.rb index b3a8750353..654586e947 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/dynamic_find_by.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/dynamic_find_by.rb @@ -70,8 +70,7 @@ module RuboCop end def allowed_invocation?(node) - allowed_method?(node) || allowed_receiver?(node) || - whitelisted?(node) + allowed_method?(node) || allowed_receiver?(node) || whitelisted?(node) end def allowed_method?(node) @@ -95,8 +94,7 @@ module RuboCop end def autocorrect_method_name(corrector, node) - corrector.replace(node.loc.selector, - static_method_name(node.method_name.to_s)) + corrector.replace(node.loc.selector, static_method_name(node.method_name.to_s)) end def autocorrect_argument_keywords(corrector, node, keywords) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/eager_evaluation_log_message.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/eager_evaluation_log_message.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/eager_evaluation_log_message.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_uniqueness.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_uniqueness.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_uniqueness.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_uniqueness.rb index e01ff831f8..dfb49502d1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/enum_uniqueness.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/enum_uniqueness.rb @@ -20,8 +20,7 @@ module RuboCop class EnumUniqueness < Base include Duplication - MSG = 'Duplicate value `%s` found in `%s` ' \ - 'enum declaration.' + MSG = 'Duplicate value `%s` found in `%s` enum declaration.' RESTRICT_ON_SEND = %i[enum].freeze def_node_matcher :enum?, <<~PATTERN @@ -41,9 +40,7 @@ module RuboCop next unless duplicates?(items) consecutive_duplicates(items).each do |item| - add_offense(item, message: format( - MSG, value: item.source, enum: enum_name(key) - )) + add_offense(item, message: format(MSG, value: item.source, enum: enum_name(key))) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_comparison.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_comparison.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_comparison.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_comparison.rb index c5a25465bf..1e1c5261aa 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_comparison.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_comparison.rb @@ -96,8 +96,7 @@ module RuboCop end def rails_env_on_lhs?(node) - comparing_str_env_with_rails_env_on_lhs?(node) || - comparing_sym_env_with_rails_env_on_lhs?(node) + comparing_str_env_with_rails_env_on_lhs?(node) || comparing_sym_env_with_rails_env_on_lhs?(node) end def build_predicate_method_for_rails_env_on_lhs(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/environment_variable_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/environment_variable_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/environment_variable_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/exit.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/exit.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/exit.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/exit.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/expanded_date_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/expanded_date_range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/expanded_date_range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/file_path.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/file_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/file_path.rb index bde2094342..80b9e49a6c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/file_path.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/file_path.rb @@ -50,8 +50,7 @@ module RuboCop return unless node.children.last.str_type? last_child_source = node.children.last.source - return unless last_child_source.start_with?('.') || - last_child_source.include?(File::SEPARATOR) + return unless last_child_source.start_with?('.') || last_child_source.include?(File::SEPARATOR) return if last_child_source.start_with?(':') register_offense(node) @@ -97,8 +96,7 @@ module RuboCop def register_offense(node) line_range = node.loc.column...node.loc.last_column - source_range = source_range(processed_source.buffer, node.first_line, - line_range) + source_range = source_range(processed_source.buffer, node.first_line, line_range) add_offense(source_range) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_by.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/find_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_each.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_each.rb index 73eb23fc45..4857c13891 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/find_each.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/find_each.rb @@ -13,11 +13,17 @@ module RuboCop # # good # User.all.find_each # - # @example IgnoredMethods: ['order'] + # @example AllowedMethods: ['order'] + # # good + # User.order(:foo).each + # + # @example AllowedPattern: [/order/] # # good # User.order(:foo).each class FindEach < Base include ActiveRecordHelper + include AllowedMethods + include AllowedPattern extend AutoCorrector MSG = 'Use `find_each` instead of `each`.' @@ -47,7 +53,7 @@ module RuboCop method_chain = node.each_node(:send).map(&:method_name) - (cop_config['IgnoredMethods'].map(&:to_sym) & method_chain).any? + method_chain.any? { |method_name| allowed_method?(method_name) || matches_allowed_pattern?(method_name) } end def active_model_error_where?(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/freeze_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/freeze_time.rb new file mode 100644 index 0000000000..21d2748544 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/freeze_time.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Identifies usages of `travel_to` with an argument of the current time and + # change them to use `freeze_time` instead. + # + # @safety + # This cop’s autocorrection is unsafe because `freeze_time` just delegates to + # `travel_to` with a default `Time.now`, it is not strictly equivalent to `Time.now` + # if the argument of `travel_to` is the current time considering time zone. + # + # @example + # # bad + # travel_to(Time.now) + # travel_to(Time.new) + # travel_to(DateTime.now) + # travel_to(Time.current) + # travel_to(Time.zone.now) + # travel_to(Time.now.in_time_zone) + # travel_to(Time.current.to_time) + # + # # good + # freeze_time + # + class FreezeTime < Base + extend AutoCorrector + + MSG = 'Use `freeze_time` instead of `travel_to`.' + NOW_METHODS = %i[now new current].freeze + CONV_METHODS = %i[to_time in_time_zone].freeze + RESTRICT_ON_SEND = %i[travel_to].freeze + + # @!method time_now?(node) + def_node_matcher :time_now?, <<~PATTERN + (const nil? {:Time :DateTime}) + PATTERN + + # @!method zoned_time_now?(node) + def_node_matcher :zoned_time_now?, <<~PATTERN + (send (const nil? :Time) :zone) + PATTERN + + def on_send(node) + child_node, method_name = *node.first_argument.children + return unless current_time?(child_node, method_name) || current_time_with_convert?(child_node, method_name) + + add_offense(node) { |corrector| corrector.replace(node, 'freeze_time') } + end + + private + + def current_time?(node, method_name) + return false unless NOW_METHODS.include?(method_name) + + node.send_type? ? zoned_time_now?(node) : time_now?(node) + end + + def current_time_with_convert?(node, method_name) + return false unless CONV_METHODS.include?(method_name) + + child_node, child_method_name = *node.children + current_time?(child_node, child_method_name) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/has_and_belongs_to_many.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/has_and_belongs_to_many.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/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.16.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb index e8f4e69cc3..df752f52b1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb @@ -105,9 +105,7 @@ module RuboCop return false unless node.parent - return true if contain_valid_options_in_with_options_block?( - node.parent.parent - ) + return true if contain_valid_options_in_with_options_block?(node.parent.parent) end false diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/helper_instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/helper_instance_variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/helper_instance_variable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_positional_arguments.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_positional_arguments.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_positional_arguments.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_positional_arguments.rb index bb0f214eae..361e5e5b2c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_positional_arguments.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_positional_arguments.rb @@ -22,11 +22,8 @@ module RuboCop extend AutoCorrector extend TargetRailsVersion - MSG = 'Use keyword arguments instead of ' \ - 'positional arguments for http call: `%s`.' - KEYWORD_ARGS = %i[ - method params session body flash xhr as headers env to - ].freeze + MSG = 'Use keyword arguments instead of positional arguments for http call: `%s`.' + KEYWORD_ARGS = %i[method params session body flash xhr as headers env to].freeze ROUTING_METHODS = %i[draw routes].freeze RESTRICT_ON_SEND = %i[get post put patch delete head].freeze @@ -75,8 +72,7 @@ module RuboCop return false if kwsplat_hash?(data) data.each_pair.none? do |pair| - special_keyword_arg?(pair.key) || - (format_arg?(pair.key) && data.pairs.one?) + special_keyword_arg?(pair.key) || (format_arg?(pair.key) && data.pairs.one?) end end @@ -98,8 +94,7 @@ module RuboCop return '' if data.hash_type? && data.empty? hash_data = if data.hash_type? - format('{ %s }', - data: data.pairs.map(&:source).join(', ')) + format('{ %s }', data: data.pairs.map(&:source).join(', ')) else # user supplies an object, # no need to surround with braces diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_status.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_status.rb index adc4047a8c..b80498c27e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/http_status.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/http_status.rb @@ -84,10 +84,8 @@ module RuboCop # :nodoc: class SymbolicStyleChecker - MSG = 'Prefer `%s` over `%s` ' \ - 'to define HTTP status code.' - DEFAULT_MSG = 'Prefer `symbolic` over `numeric` ' \ - 'to define HTTP status code.' + MSG = 'Prefer `%s` over `%s` to define HTTP status code.' + DEFAULT_MSG = 'Prefer `symbolic` over `numeric` to define HTTP status code.' attr_reader :node @@ -118,17 +116,14 @@ module RuboCop end def custom_http_status_code? - node.int_type? && - !::Rack::Utils::SYMBOL_TO_STATUS_CODE.value?(number) + node.int_type? && !::Rack::Utils::SYMBOL_TO_STATUS_CODE.value?(number) end end # :nodoc: class NumericStyleChecker - MSG = 'Prefer `%s` over `%s` ' \ - 'to define HTTP status code.' - DEFAULT_MSG = 'Prefer `numeric` over `symbolic` ' \ - 'to define HTTP status code.' + MSG = 'Prefer `%s` over `%s` to define HTTP status code.' + DEFAULT_MSG = 'Prefer `numeric` over `symbolic` to define HTTP status code.' PERMITTED_STATUS = %i[error success missing redirect].freeze attr_reader :node diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_lazy_lookup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/i18n_lazy_lookup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_lazy_lookup.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_locale_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/i18n_locale_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_locale_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/i18n_locale_texts.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/i18n_locale_texts.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/i18n_locale_texts.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb index 57a2ca9847..de824f54f1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb @@ -42,12 +42,7 @@ module RuboCop `%s` option will be ignored when `%s` and `%s` are used together. MSG - RESTRICT_ON_SEND = %i[ - skip_after_action - skip_around_action - skip_before_action - skip_action_callback - ].freeze + RESTRICT_ON_SEND = %i[skip_after_action skip_around_action skip_before_action skip_action_callback].freeze FILTERS = RESTRICT_ON_SEND.map { |method_name| ":#{method_name}" } @@ -67,11 +62,9 @@ module RuboCop options = options_hash(options) if if_and_only?(options) - add_offense(options[:if], - message: format(MSG, prefer: :only, ignore: :if)) + add_offense(options[:if], message: format(MSG, prefer: :only, ignore: :if)) elsif if_and_except?(options) - add_offense(options[:except], - message: format(MSG, prefer: :if, ignore: :except)) + add_offense(options[:except], message: format(MSG, prefer: :if, ignore: :except)) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/index_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/index_by.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/index_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/index_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/index_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/index_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/index_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/index_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inverse_of.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inverse_of.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inverse_of.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inverse_of.rb index e80351a7de..b2db3d0f1c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/inverse_of.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/inverse_of.rb @@ -192,8 +192,7 @@ module RuboCop end return if options_ignoring_inverse_of?(options) - return unless scope?(arguments) || - options_requiring_inverse_of?(options) + return unless scope?(arguments) || options_requiring_inverse_of?(options) return if options_contain_inverse_of?(options) @@ -206,8 +205,7 @@ module RuboCop def options_requiring_inverse_of?(options) required = options.any? do |opt| - conditions_option?(opt) || - foreign_key_option?(opt) + conditions_option?(opt) || foreign_key_option?(opt) end return required if target_rails_version >= 5.2 @@ -227,8 +225,7 @@ module RuboCop def with_options_arguments(recv, node) blocks = node.each_ancestor(:block).select do |block| - block.send_node.command?(:with_options) && - same_context_in_with_options?(block.arguments.first, recv) + block.send_node.command?(:with_options) && same_context_in_with_options?(block.arguments.first, recv) end blocks.flat_map { |n| n.send_node.arguments } end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb index 3b96591f88..25cb6e2ffa 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb @@ -184,13 +184,9 @@ module RuboCop # @return [String] def message(methods, parent) if methods.size == 1 - format(MSG, - action: "`#{methods[0]}` is", - type: parent.type) + format(MSG, action: "`#{methods[0]}` is", type: parent.type) else - format(MSG, - action: "`#{methods.join('`, `')}` are", - type: parent.type) + format(MSG, action: "`#{methods.join('`, `')}` are", type: parent.type) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/link_to_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/link_to_blank.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/link_to_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/link_to_blank.rb index a0c2899f99..32811e7952 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/link_to_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/link_to_blank.rb @@ -68,10 +68,7 @@ module RuboCop def append_to_rel(rel_node, corrector) existing_rel = rel_node.children.last.value - str_range = rel_node.children.last.loc.expression.adjust( - begin_pos: 1, - end_pos: -1 - ) + str_range = rel_node.children.last.loc.expression.adjust(begin_pos: 1, end_pos: -1) corrector.replace(str_range, "#{existing_rel} noopener") end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/mailer_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/mailer_name.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/mailer_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/mailer_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/match_route.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/match_route.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/match_route.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/match_route.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/migration_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/migration_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/migration_class_name.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/negate_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/negate_include.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/negate_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/negate_include.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/not_null_column.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/not_null_column.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/not_null_column.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/order_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/order_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/order_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output.rb index 655cef658e..9f87c9a7a8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output.rb @@ -21,11 +21,8 @@ module RuboCop include RangeHelp extend AutoCorrector - MSG = 'Do not write to stdout. ' \ - "Use Rails's logger if you want to log." - RESTRICT_ON_SEND = %i[ - ap p pp pretty_print print puts binwrite syswrite write write_nonblock - ].freeze + MSG = "Do not write to stdout. Use Rails's logger if you want to log." + RESTRICT_ON_SEND = %i[ap p pp pretty_print print puts binwrite syswrite write write_nonblock].freeze def_node_matcher :output?, <<~PATTERN (send nil? {:ap :p :pp :pretty_print :print :puts} ...) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output_safety.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/output_safety.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/output_safety.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pick.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pick.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pick.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pick.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck_id.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluck_in_where.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/pluck_in_where.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluck_in_where.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluralization_grammar.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluralization_grammar.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluralization_grammar.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluralization_grammar.rb index 24f6f1e660..ef62d15c8c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/pluralization_grammar.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/pluralization_grammar.rb @@ -94,8 +94,7 @@ module RuboCop end def duration_method?(method_name) - SINGULAR_DURATION_METHODS.key?(method_name) || - PLURAL_DURATION_METHODS.key?(method_name) + SINGULAR_DURATION_METHODS.key?(method_name) || PLURAL_DURATION_METHODS.key?(method_name) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/presence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/presence.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/presence.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/presence.rb index 2fbba874c1..f9313ef75a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/presence.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/presence.rb @@ -106,9 +106,7 @@ module RuboCop end def message(node, receiver, other) - format(MSG, - prefer: replacement(receiver, other), - current: node.source) + format(MSG, prefer: replacement(receiver, other), current: node.source) end def replacement(receiver, other) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/present.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/present.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/present.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/present.rb index 55b5bd923e..0eccfca32f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/present.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/present.rb @@ -47,10 +47,8 @@ module RuboCop extend AutoCorrector MSG_NOT_BLANK = 'Use `%s` instead of `%s`.' - MSG_EXISTS_AND_NOT_EMPTY = 'Use `%s` instead of ' \ - '`%s`.' - MSG_UNLESS_BLANK = 'Use `if %s` instead of ' \ - '`%s`.' + MSG_EXISTS_AND_NOT_EMPTY = 'Use `%s` instead of `%s`.' + MSG_UNLESS_BLANK = 'Use `if %s` instead of `%s`.' RESTRICT_ON_SEND = %i[!].freeze def_node_matcher :exists_and_not_empty?, <<~PATTERN @@ -118,8 +116,7 @@ module RuboCop unless_blank?(node) do |method_call, receiver| range = unless_condition(node, method_call) - msg = format(MSG_UNLESS_BLANK, prefer: replacement(receiver), - current: range.source) + msg = format(MSG_UNLESS_BLANK, prefer: replacement(receiver), current: range.source) add_offense(range, message: msg) do |corrector| autocorrect(corrector, node) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/rake_environment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/rake_environment.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/rake_environment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/rake_environment.rb index fdb6f76924..8772b2682c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/rake_environment.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/rake_environment.rb @@ -39,7 +39,7 @@ module RuboCop (block $(send nil? :task ...) ...) PATTERN - def on_block(node) + def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler task_definition?(node) do |task_method| return if task_name(task_method) == :default return if with_dependencies?(task_method) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/read_write_attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/read_write_attribute.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/read_write_attribute.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_allow_nil.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_allow_nil.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_allow_nil.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_allow_nil.rb index 9fb17bdf73..b1dccd1335 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_allow_nil.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_allow_nil.rb @@ -30,11 +30,9 @@ module RuboCop include RangeHelp extend AutoCorrector - MSG_SAME = - '`allow_nil` is redundant when `allow_blank` has the same value.' + MSG_SAME = '`allow_nil` is redundant when `allow_blank` has the same value.' - MSG_ALLOW_NIL_FALSE = - '`allow_nil: false` is redundant when `allow_blank` is true.' + MSG_ALLOW_NIL_FALSE = '`allow_nil: false` is redundant when `allow_blank` is true.' RESTRICT_ON_SEND = %i[validates].freeze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_foreign_key.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_foreign_key.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_foreign_key.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_foreign_key.rb index e32d207aa1..21ccc18f4d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_foreign_key.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_foreign_key.rb @@ -41,7 +41,7 @@ module RuboCop association_with_foreign_key(node) do |type, name, options, foreign_key_pair, foreign_key| if redundant?(node, type, name, options, foreign_key) add_offense(foreign_key_pair.loc.expression) do |corrector| - range = range_with_surrounding_space(range: foreign_key_pair.source_range, side: :left) + range = range_with_surrounding_space(foreign_key_pair.source_range, side: :left) range = range_with_surrounding_comma(range, :left) corrector.remove(range) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/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.16.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb index d9a877abc9..ac48407a6e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb @@ -217,7 +217,7 @@ module RuboCop keys.each do |key| key_node = node.arguments.find { |arg| arg.value == key } key_range = range_with_surrounding_space( - range: range_with_surrounding_comma(key_node.source_range, :right), + range_with_surrounding_comma(key_node.source_range, :right), side: :right ) corrector.remove(key_range) @@ -226,7 +226,7 @@ module RuboCop def remove_presence_option(corrector, presence) range = range_with_surrounding_comma( - range_with_surrounding_space(range: presence.source_range, side: :left), + range_with_surrounding_space(presence.source_range, side: :left), :left ) corrector.remove(range) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb index f289e76217..6a6b1e4827 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb @@ -60,15 +60,6 @@ module RuboCop MSG = 'Redundant receiver in `with_options`.' - def_node_matcher :with_options?, <<~PATTERN - (block - (send nil? :with_options - (...)) - (args - $_arg) - $_body) - PATTERN - def_node_search :all_block_nodes_in, <<~PATTERN (block ...) PATTERN @@ -78,29 +69,40 @@ module RuboCop PATTERN def on_block(node) - with_options?(node) do |arg, body| - return if body.nil? - return unless all_block_nodes_in(body).count.zero? + return unless node.method?(:with_options) + return unless (body = node.body) + return unless all_block_nodes_in(body).count.zero? - send_nodes = all_send_nodes_in(body) + send_nodes = all_send_nodes_in(body) + return unless redundant_receiver?(send_nodes, node) - if send_nodes.all? { |n| same_value?(arg, n.receiver) } - send_nodes.each do |send_node| - receiver = send_node.receiver - add_offense(receiver.source_range) do |corrector| - autocorrect(corrector, send_node) - end - end + send_nodes.each do |send_node| + receiver = send_node.receiver + add_offense(receiver.source_range) do |corrector| + autocorrect(corrector, send_node, node) end end end + alias on_numblock on_block + private - def autocorrect(corrector, node) - corrector.remove(node.receiver.source_range) - corrector.remove(node.loc.dot) - corrector.remove(block_argument_range(node)) + def autocorrect(corrector, send_node, node) + corrector.remove(send_node.receiver.source_range) + corrector.remove(send_node.loc.dot) + corrector.remove(block_argument_range(send_node)) unless node.numblock_type? + end + + def redundant_receiver?(send_nodes, node) + proc = if node.numblock_type? + ->(n) { n.receiver.lvar_type? && n.receiver.source == '_1' } + else + arg = node.arguments.first + ->(n) { same_value?(arg, n.receiver) } + end + + send_nodes.all?(&proc) end def block_argument_range(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/redundant_travel_back.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/redundant_travel_back.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/redundant_travel_back.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reflection_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reflection_class_name.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reflection_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reflection_class_name.rb index 2de89b84ac..ff2f3eb283 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reflection_class_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reflection_class_name.rb @@ -34,12 +34,29 @@ module RuboCop def on_send(node) association_with_reflection(node) do |reflection_class_name| + return if reflection_class_name.value.send_type? && reflection_class_name.value.receiver.nil? + return if reflection_class_name.value.lvar_type? && str_assigned?(reflection_class_name) + add_offense(reflection_class_name.loc.expression) end end private + def str_assigned?(reflection_class_name) + lvar = reflection_class_name.value.source + + reflection_class_name.ancestors.each do |nodes| + return true if nodes.each_child_node(:lvasgn).detect do |node| + lhs, rhs = *node + + lhs.to_s == lvar && ALLOWED_REFLECTION_CLASS_TYPES.include?(rhs.type) + end + end + + false + end + def reflection_class_value?(class_value) if class_value.send_type? !class_value.method?(:to_s) || class_value.receiver&.const_type? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/refute_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/refute_methods.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/refute_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/refute_methods.rb index eb86dee436..e141b24ea6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/refute_methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/refute_methods.rb @@ -81,11 +81,7 @@ module RuboCop end def offense_message(method_name) - format( - MSG, - bad_method: method_name, - good_method: convert_good_method(method_name) - ) + format(MSG, bad_method: method_name, good_method: convert_good_method(method_name)) end def convert_good_method(bad_method) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/relative_date_constant.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/relative_date_constant.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/relative_date_constant.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/relative_date_constant.rb index ac57ef0350..92fd50d0b6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/relative_date_constant.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/relative_date_constant.rb @@ -34,8 +34,7 @@ module RuboCop include RangeHelp extend AutoCorrector - MSG = 'Do not assign `%s` to constants as it ' \ - 'will be evaluated only once.' + MSG = 'Do not assign `%s` to constants as it will be evaluated only once.' RELATIVE_DATE_METHODS = %i[since from_now after ago until before yesterday tomorrow].to_set.freeze def on_casgn(node) @@ -77,9 +76,7 @@ module RuboCop return unless scope.nil? indent = ' ' * node.loc.column - new_code = ["def self.#{const_name.downcase}", - "#{indent}#{value.source}", - 'end'].join("\n#{indent}") + new_code = ["def self.#{const_name.downcase}", "#{indent}#{value.source}", 'end'].join("\n#{indent}") corrector.replace(node.source_range, new_code) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/render_inline.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/render_inline.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/render_inline.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/render_inline.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/render_plain_text.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/render_plain_text.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/render_plain_text.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/request_referer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/request_referer.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/request_referer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/request_referer.rb index 4ad0f3a237..38a68d8099 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/request_referer.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/request_referer.rb @@ -23,8 +23,7 @@ module RuboCop include ConfigurableEnforcedStyle extend AutoCorrector - MSG = 'Use `request.%s` instead of ' \ - '`request.%s`.' + MSG = 'Use `request.%s` instead of `request.%s`.' RESTRICT_ON_SEND = %i[referer referrer].freeze def_node_matcher :referer?, <<~PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/require_dependency.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/require_dependency.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/require_dependency.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/require_dependency.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration.rb index ceb9940379..5af544b000 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration.rb @@ -229,6 +229,8 @@ module RuboCop check_change_table_node(node.send_node, node.body) end + alias on_numblock on_block + private def check_irreversible_schema_statement_node(node) @@ -240,10 +242,7 @@ module RuboCop def check_drop_table_node(node) drop_table_call(node) do unless node.parent.block_type? || node.last_argument.block_pass_type? - add_offense( - node, - message: format(MSG, action: 'drop_table(without block)') - ) + add_offense(node, message: format(MSG, action: 'drop_table(without block)')) end end end @@ -251,22 +250,12 @@ module RuboCop def check_reversible_hash_node(node) return if reversible_change_table_call?(node) - add_offense( - node, - message: format( - MSG, action: "#{node.method_name}(without :from and :to)" - ) - ) + add_offense(node, message: format(MSG, action: "#{node.method_name}(without :from and :to)")) end def check_remove_column_node(node) remove_column_call(node) do |args| - if args.to_a.size < 3 - add_offense( - node, - message: format(MSG, action: 'remove_column(without type)') - ) - end + add_offense(node, message: format(MSG, action: 'remove_column(without type)')) if args.to_a.size < 3 end end @@ -295,10 +284,7 @@ module RuboCop unless all_hash_key?(args, :type) && target_rails_version >= 6.1 action = target_rails_version >= 6.1 ? 'remove_columns(without type)' : 'remove_columns' - add_offense( - node, - message: format(MSG, action: action) - ) + add_offense(node, message: format(MSG, action: action)) end end end @@ -306,18 +292,14 @@ module RuboCop def check_remove_index_node(node) remove_index_call(node) do |args| if args.hash_type? && !all_hash_key?(args, :column) - add_offense( - node, - message: format(MSG, action: 'remove_index(without column)') - ) + add_offense(node, message: format(MSG, action: 'remove_index(without column)')) end end end def check_change_table_offense(receiver, node) method_name = node.method_name - return if receiver != node.receiver && - reversible_change_table_call?(node) + return if receiver != node.receiver && reversible_change_table_call?(node) action = if method_name == :remove target_rails_version >= 6.1 ? 't.remove (without type)' : 't.remove' @@ -325,10 +307,7 @@ module RuboCop "change_table(with #{method_name})" end - add_offense( - node, - message: format(MSG, action: action) - ) + add_offense(node, message: format(MSG, action: action)) end def reversible_change_table_call?(node) @@ -353,9 +332,7 @@ module RuboCop def within_reversible_or_up_only_block?(node) node.each_ancestor(:block).any? do |ancestor| - (ancestor.block_type? && - ancestor.send_node.method?(:reversible)) || - ancestor.send_node.method?(:up_only) + (ancestor.block_type? && ancestor.send_node.method?(:reversible)) || ancestor.send_node.method?(:up_only) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration_method_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration_method_definition.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb index acc506cadf..fbf2b1d87d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/reversible_migration_method_definition.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb @@ -45,8 +45,7 @@ module RuboCop class ReversibleMigrationMethodDefinition < Base include MigrationsHelper - MSG = 'Migrations must contain either a `change` method, or ' \ - 'both an `up` and a `down` method.' + MSG = 'Migrations must contain either a `change` method, or both an `up` and a `down` method.' def_node_matcher :change_method?, <<~PATTERN `(def :change (args) _) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/root_join_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/root_join_chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_join_chain.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_pathname_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_pathname_methods.rb new file mode 100644 index 0000000000..5509d5eefd --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_pathname_methods.rb @@ -0,0 +1,175 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Use `Rails.root` IO methods instead of passing it to `File`. + # + # `Rails.root` is an instance of `Pathname` + # so we can apply many IO methods directly. + # + # This cop works best when used together with + # `Style/FileRead`, `Style/FileWrite` and `Rails/RootJoinChain`. + # + # @example + # # bad + # File.open(Rails.root.join('db', 'schema.rb')) + # File.open(Rails.root.join('db', 'schema.rb'), 'w') + # File.read(Rails.root.join('db', 'schema.rb')) + # File.binread(Rails.root.join('db', 'schema.rb')) + # File.write(Rails.root.join('db', 'schema.rb'), content) + # File.binwrite(Rails.root.join('db', 'schema.rb'), content) + # + # # good + # Rails.root.join('db', 'schema.rb').open + # Rails.root.join('db', 'schema.rb').open('w') + # Rails.root.join('db', 'schema.rb').read + # Rails.root.join('db', 'schema.rb').binread + # Rails.root.join('db', 'schema.rb').write(content) + # Rails.root.join('db', 'schema.rb').binwrite(content) + # + class RootPathnameMethods < Base + extend AutoCorrector + + MSG = '`%s` is a `Pathname` so you can just append `#%s`.' + + DIR_METHODS = %i[children delete each_child empty? entries exist? glob mkdir open rmdir unlink].to_set.freeze + + FILE_METHODS = %i[ + atime + basename + binread + binwrite + birthtime + blockdev? + chardev? + chmod + chown + ctime + delete + directory? + dirname + empty? + executable? + executable_real? + exist? + expand_path + extname + file? + fnmatch + fnmatch? + ftype + grpowned? + join + lchmod + lchown + lstat + mtime + open + owned? + pipe? + read + readable? + readable_real? + readlines + readlink + realdirpath + realpath + rename + setgid? + setuid? + size + size? + socket? + split + stat + sticky? + symlink? + sysopen + truncate + unlink + utime + world_readable? + world_writable? + writable? + writable_real? + write + zero? + ].to_set.freeze + + FILE_TEST_METHODS = %i[ + blockdev? + chardev? + directory? + empty? + executable? + executable_real? + exist? + file? + grpowned? + owned? + pipe? + readable? + readable_real? + setgid? + setuid? + size + size? + socket? + sticky? + symlink? + world_readable? + world_writable? + writable? + writable_real? + zero? + ].to_set.freeze + + FILE_UTILS_METHODS = %i[chmod chown mkdir mkpath rmdir rmtree].to_set.freeze + + RESTRICT_ON_SEND = (DIR_METHODS + FILE_METHODS + FILE_TEST_METHODS + FILE_UTILS_METHODS).to_set.freeze + + def_node_matcher :pathname_method, <<~PATTERN + { + (send (const {nil? cbase} :Dir) $DIR_METHODS $_ $...) + (send (const {nil? cbase} {:IO :File}) $FILE_METHODS $_ $...) + (send (const {nil? cbase} :FileTest) $FILE_TEST_METHODS $_ $...) + (send (const {nil? cbase} :FileUtils) $FILE_UTILS_METHODS $_ $...) + } + PATTERN + + def_node_matcher :rails_root_pathname?, <<~PATTERN + { + $#rails_root? + (send $#rails_root? :join ...) + } + PATTERN + + # @!method rails_root?(node) + def_node_matcher :rails_root?, <<~PATTERN + (send (const {nil? cbase} :Rails) {:root :public_path}) + PATTERN + + def on_send(node) + evidence(node) do |method, path, args, rails_root| + add_offense(node, message: format(MSG, method: method, rails_root: rails_root.source)) do |corrector| + replacement = "#{path.source}.#{method}" + replacement += "(#{args.map(&:source).join(', ')})" unless args.empty? + + corrector.replace(node, replacement) + end + end + end + + private + + def evidence(node) + return if node.method?(:open) && node.parent&.send_type? + return unless (method, path, args = pathname_method(node)) && (rails_root = rails_root_pathname?(path)) + + yield(method, path, args, rails_root) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/root_public_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/root_public_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/root_public_path.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation_with_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation_with_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb index 37cb73474e..c19cd8180e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/safe_navigation_with_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb @@ -31,9 +31,7 @@ module RuboCop class SafeNavigationWithBlank < Base extend AutoCorrector - MSG = - 'Avoid calling `blank?` with the safe navigation operator ' \ - 'in conditionals.' + MSG = 'Avoid calling `blank?` with the safe navigation operator in conditionals.' def_node_matcher :safe_navigation_blank_in_conditional?, <<~PATTERN (if $(csend ... :blank?) ...) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/save_bang.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/save_bang.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/save_bang.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/save_bang.rb index da2b0cc7bd..cd0f6288e7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/save_bang.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/save_bang.rb @@ -121,18 +121,12 @@ module RuboCop include NegativeConditional extend AutoCorrector - MSG = 'Use `%s` instead of `%s` if the return ' \ - 'value is not checked.' - CREATE_MSG = (MSG + - ' Or check `persisted?` on model returned from ' \ - '`%s`.').freeze - CREATE_CONDITIONAL_MSG = '`%s` returns a model which is ' \ - 'always truthy.' + MSG = 'Use `%s` instead of `%s` if the return value is not checked.' + CREATE_MSG = "#{MSG} Or check `persisted?` on model returned from `%s`." + CREATE_CONDITIONAL_MSG = '`%s` returns a model which is always truthy.' - CREATE_PERSIST_METHODS = %i[create create_or_find_by - first_or_create find_or_create_by].freeze - MODIFY_PERSIST_METHODS = %i[save - update update_attributes destroy].freeze + CREATE_PERSIST_METHODS = %i[create create_or_find_by first_or_create find_or_create_by].freeze + MODIFY_PERSIST_METHODS = %i[save update update_attributes destroy].freeze RESTRICT_ON_SEND = (CREATE_PERSIST_METHODS + MODIFY_PERSIST_METHODS).freeze def self.joining_forces @@ -244,8 +238,7 @@ module RuboCop parent = node.parent return false unless parent - operator_or_single_negative?(parent) || - (conditional?(parent) && node == parent.condition) + operator_or_single_negative?(parent) || (conditional?(parent) && node == parent.condition) end def operator_or_single_negative?(node) @@ -294,9 +287,7 @@ module RuboCop # NameSpace::Const != ::Const # Const != NameSpace::Const def const_matches?(const, allowed_const) - parts = allowed_const.split('::').reverse.zip( - const.split('::').reverse - ) + parts = allowed_const.split('::').reverse.zip(const.split('::').reverse) parts.all? do |(allowed_part, const_part)| allowed_part == const_part.to_s end @@ -335,9 +326,7 @@ module RuboCop end def persist_method?(node, methods = RESTRICT_ON_SEND) - methods.include?(node.method_name) && - expected_signature?(node) && - !allowed_receiver?(node) + methods.include?(node.method_name) && expected_signature?(node) && !allowed_receiver?(node) end # Check argument signature as no arguments or one hash @@ -345,8 +334,7 @@ module RuboCop !node.arguments? || (node.arguments.one? && node.method_name != :destroy && - (node.first_argument.hash_type? || - !node.first_argument.literal?)) + (node.first_argument.hash_type? || !node.first_argument.literal?)) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/schema_comment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/schema_comment.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/schema_comment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/schema_comment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/scope_args.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/scope_args.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/scope_args.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/scope_args.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/short_i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/short_i18n.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/short_i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/short_i18n.rb index 82152a1580..35e02faf2d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/short_i18n.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/short_i18n.rb @@ -44,10 +44,7 @@ module RuboCop MSG = 'Use `%s` instead of `%s`.' - PREFERRED_METHODS = { - translate: :t, - localize: :l - }.freeze + PREFERRED_METHODS = { translate: :t, localize: :l }.freeze RESTRICT_ON_SEND = PREFERRED_METHODS.keys.freeze diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/skips_model_validations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/skips_model_validations.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/skips_model_validations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/skips_model_validations.rb index 16266c2d86..cbc977eb95 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/skips_model_validations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/skips_model_validations.rb @@ -93,8 +93,7 @@ module RuboCop end def allowed_method?(node) - METHODS_WITH_ARGUMENTS.include?(node.method_name.to_s) && - !node.arguments? + METHODS_WITH_ARGUMENTS.include?(node.method_name.to_s) && !node.arguments? end def forbidden_methods diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/squished_sql_heredocs.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/squished_sql_heredocs.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb index ec36e3be85..55f5654baf 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/squished_sql_heredocs.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb @@ -72,11 +72,7 @@ module RuboCop end def message(node) - format( - MSG, - expect: "#{node.source}#{SQUISH}", - current: node.source - ) + format(MSG, expect: "#{node.source}#{SQUISH}", current: node.source) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/strip_heredoc.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/strip_heredoc.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/strip_heredoc.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/strip_heredoc.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/table_name_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/table_name_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/table_name_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone.rb index 5cf55ec422..5955fba982 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone.rb @@ -43,21 +43,17 @@ module RuboCop include ConfigurableEnforcedStyle extend AutoCorrector - MSG = 'Do not use `%s` without zone. Use `%s` ' \ - 'instead.' + MSG = 'Do not use `%s` without zone. Use `%s` instead.' - MSG_ACCEPTABLE = 'Do not use `%s` without zone. ' \ - 'Use one of %s instead.' + MSG_ACCEPTABLE = 'Do not use `%s` without zone. Use one of %s instead.' - MSG_LOCALTIME = 'Do not use `Time.localtime` without ' \ - 'offset or zone.' + MSG_LOCALTIME = 'Do not use `Time.localtime` without offset or zone.' GOOD_METHODS = %i[zone zone_default find_zone find_zone!].freeze DANGEROUS_METHODS = %i[now local new parse at].freeze - ACCEPTED_METHODS = %i[in_time_zone utc getlocal xmlschema iso8601 - jisx0301 rfc3339 httpdate to_i to_f].freeze + ACCEPTED_METHODS = %i[in_time_zone utc getlocal xmlschema iso8601 jisx0301 rfc3339 httpdate to_i to_f].freeze TIMEZONE_SPECIFIER = /[A-z]/.freeze @@ -100,13 +96,11 @@ module RuboCop # remove redundant `.in_time_zone` from `Time.zone.now.in_time_zone` def remove_redundant_in_time_zone(corrector, node) time_methods_called = extract_method_chain(node) - return unless time_methods_called.include?(:in_time_zone) || - time_methods_called.include?(:zone) + return unless time_methods_called.include?(:in_time_zone) || time_methods_called.include?(:zone) while node&.send_type? if node.children.last == :in_time_zone - in_time_zone_with_dot = - node.loc.selector.adjust(begin_pos: -1) + in_time_zone_with_dot = node.loc.selector.adjust(begin_pos: -1) corrector.remove(in_time_zone_with_dot) end node = node.parent @@ -144,9 +138,7 @@ module RuboCop ) else safe_method_name = safe_method(method_name, node) - format(MSG, - current: "#{klass}.#{method_name}", - prefer: "Time.zone.#{safe_method_name}") + format(MSG, current: "#{klass}.#{method_name}", prefer: "Time.zone.#{safe_method_name}") end end @@ -227,10 +219,7 @@ module RuboCop end def acceptable_methods(klass, method_name, node) - acceptable = [ - "`Time.zone.#{safe_method(method_name, node)}`", - "`#{klass}.current`" - ] + acceptable = ["`Time.zone.#{safe_method(method_name, node)}`", "`#{klass}.current`"] ACCEPTED_METHODS.each do |am| acceptable << "`#{klass}.#{method_name}.#{am}`" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/time_zone_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/time_zone_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/time_zone_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/to_formatted_s.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/to_formatted_s.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_formatted_s.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_s_with_argument.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_s_with_argument.rb new file mode 100644 index 0000000000..cf04752b6f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/to_s_with_argument.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Identifies passing any argument to `#to_s`. + # + # @safety + # This cop is marked as unsafe because it may detect `#to_s` calls + # that are not related to Active Support implementation. + # + # @example + # + # # bad + # obj.to_s(:delimited) + # + # # good + # obj.to_formatted_s(:delimited) + # + class ToSWithArgument < Base + extend AutoCorrector + extend TargetRailsVersion + + MSG = 'Use `to_formatted_s` instead.' + + RESTRICT_ON_SEND = %i[to_s].freeze + + minimum_target_rails_version 7.0 + + def on_send(node) + return if node.arguments.empty? + + add_offense(node.loc.selector) do |corrector| + corrector.replace(node.loc.selector, 'to_formatted_s') + end + end + alias on_csend on_send + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb new file mode 100644 index 0000000000..2d5ca04db6 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/top_level_hash_with_indifferent_access.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Identifies top-level `HashWithIndifferentAccess`. + # This has been soft-deprecated since Rails 5.1. + # + # @example + # # bad + # HashWithIndifferentAccess.new(foo: 'bar') + # + # # good + # ActiveSupport::HashWithIndifferentAccess.new(foo: 'bar') + # + class TopLevelHashWithIndifferentAccess < Base + extend AutoCorrector + extend TargetRailsVersion + + minimum_target_rails_version 5.1 + + MSG = 'Avoid top-level `HashWithIndifferentAccess`.' + + # @!method top_level_hash_with_indifferent_access?(node) + # @param [RuboCop::AST::ConstNode] node + # @return [Boolean] + def_node_matcher :top_level_hash_with_indifferent_access?, <<~PATTERN + (const {nil? cbase} :HashWithIndifferentAccess) + PATTERN + + # @param [RuboCop::AST::ConstNode] node + def on_const(node) + return unless top_level_hash_with_indifferent_access?(node) + + add_offense(node) do |corrector| + autocorrect(corrector, node) + end + end + + private + + def autocorrect(corrector, node) + corrector.insert_before(node.location.name, 'ActiveSupport::') + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/transaction_exit_statement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/transaction_exit_statement.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/transaction_exit_statement.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/uniq_before_pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/uniq_before_pluck.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/uniq_before_pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/uniq_before_pluck.rb index bcbe1477e9..91caf5506d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/uniq_before_pluck.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/uniq_before_pluck.rb @@ -54,11 +54,9 @@ module RuboCop NEWLINE = "\n" PATTERN = '[!^block (send (send %s :pluck ...) :uniq ...)]' - def_node_matcher :conservative_node_match, - format(PATTERN, type: 'const') + def_node_matcher :conservative_node_match, format(PATTERN, type: 'const') - def_node_matcher :aggressive_node_match, - format(PATTERN, type: '_') + def_node_matcher :aggressive_node_match, format(PATTERN, type: '_') def on_send(node) uniq = if style == :conservative @@ -80,8 +78,7 @@ module RuboCop private def dot_method_with_whitespace(method, node) - range_between(dot_method_begin_pos(method, node), - node.loc.selector.end_pos) + range_between(dot_method_begin_pos(method, node), node.loc.selector.end_pos) end def dot_method_begin_pos(method, node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unique_validation_without_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unique_validation_without_index.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unique_validation_without_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unique_validation_without_index.rb index f2aa63db34..6c7cc3d222 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unique_validation_without_index.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unique_validation_without_index.rb @@ -59,9 +59,7 @@ module RuboCop add_indices = schema.add_indices_by(table_name: table_name(klass)) (table.indices + add_indices).any? do |index| - index.unique && - (index.columns.to_set == names || - include_column_names_in_expression_index?(index, names)) + index.unique && (index.columns.to_set == names || include_column_names_in_expression_index?(index, names)) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unknown_env.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unknown_env.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unknown_env.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unknown_env.rb index 42020b4155..c3d8d467eb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unknown_env.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unknown_env.rb @@ -19,8 +19,7 @@ module RuboCop # Rails.env == 'production' class UnknownEnv < Base MSG = 'Unknown environment `%s`.' - MSG_SIMILAR = 'Unknown environment `%s`. ' \ - 'Did you mean `%s`?' + MSG_SIMILAR = 'Unknown environment `%s`. Did you mean `%s`?' def_node_matcher :rails_env?, <<~PATTERN (send @@ -79,8 +78,7 @@ module RuboCop def unknown_env_predicate?(name) name = name.to_s - name.end_with?('?') && - !environments.include?(name[0..-2]) + name.end_with?('?') && !environments.include?(name[0..-2]) end def unknown_env_name?(name) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/unused_ignored_columns.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2/lib/rubocop/cop/rails/unused_ignored_columns.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/unused_ignored_columns.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/validation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/validation.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/validation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/validation.rb index 29f5f33629..2958e14552 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/validation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/validation.rb @@ -35,8 +35,7 @@ module RuboCop class Validation < Base extend AutoCorrector - MSG = 'Prefer the new style validations `%s` over ' \ - '`%s`.' + MSG = 'Prefer the new style validations `%s` over `%s`.' TYPES = %w[ acceptance @@ -62,8 +61,7 @@ module RuboCop add_offense(range, message: message(node)) do |corrector| last_argument = node.arguments.last - return if !last_argument.literal? && !last_argument.splat_type? && - !frozen_array_argument?(last_argument) + return if !last_argument.literal? && !last_argument.splat_type? && !frozen_array_argument?(last_argument) corrector.replace(range, 'validates') correct_validate_type(corrector, node) @@ -104,10 +102,7 @@ module RuboCop end def correct_validate_type_for_hash(corrector, node, arguments) - corrector.replace( - arguments.loc.expression, - "#{validate_type(node)}: #{braced_options(arguments)}" - ) + corrector.replace(arguments.loc.expression, "#{validate_type(node)}: #{braced_options(arguments)}") end def correct_validate_type_for_array(corrector, node, arguments, loc) @@ -121,10 +116,7 @@ module RuboCop end end - corrector.replace( - loc.expression, - "#{attributes.join(', ')}, #{validate_type(node)}: true" - ) + corrector.replace(loc.expression, "#{attributes.join(', ')}, #{validate_type(node)}: true") end def validate_type(node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_equals.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_equals.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_equals.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_equals.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_exists.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_exists.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_exists.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_exists.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_missing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_missing.rb new file mode 100644 index 0000000000..04009fef00 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_missing.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Use `where.missing(...)` to find missing relationship records. + # + # This cop is enabled in Rails 6.1 or higher. + # + # @example + # # bad + # Post.left_joins(:author).where(authors: { id: nil }) + # + # # good + # Post.where.missing(:author) + # + class WhereMissing < Base + include RangeHelp + extend AutoCorrector + extend TargetRailsVersion + + MSG = 'Use `where.missing(:%s)` instead of ' \ + '`%s(:%s).where(%s: { id: nil })`.' + RESTRICT_ON_SEND = %i[left_joins left_outer_joins].freeze + + minimum_target_rails_version 6.1 + + # @!method where_node_and_argument(node) + def_node_search :where_node_and_argument, <<~PATTERN + $(send ... :where (hash <(pair $(sym _) (hash (pair (sym :id) (nil))))...> )) + PATTERN + + # @!method missing_relationship(node) + def_node_search :missing_relationship, <<~PATTERN + (pair (sym _) (hash (pair (sym :id) (nil)))) + PATTERN + + def on_send(node) + return unless node.first_argument.sym_type? + + where_node_and_argument(root_receiver(node)) do |where_node, where_argument| + next unless same_relationship?(where_argument, node.first_argument) + + range = range_between(node.loc.selector.begin_pos, node.loc.expression.end_pos) + register_offense(node, where_node, where_argument, range) + break + end + end + + private + + def root_receiver(node) + node&.parent&.send_type? ? root_receiver(node.parent) : node + end + + def same_relationship?(where, left_joins) + where.value.to_s.match?(/^#{left_joins.value}s?$/) + end + + def register_offense(node, where_node, where_argument, range) + add_offense(range, message: message(node, where_argument)) do |corrector| + corrector.replace(node.loc.selector, 'where.missing') + if multi_condition?(where_node.first_argument) + replace_where_method(corrector, where_node) + else + remove_where_method(corrector, node, where_node) + end + end + end + + def replace_where_method(corrector, where_node) + missing_relationship(where_node) do |where_clause| + corrector.remove(replace_range(where_clause)) + end + end + + def replace_range(child) + if (right_sibling = child.right_sibling) + range_between(child.loc.expression.begin_pos, right_sibling.loc.expression.begin_pos) + else + range_between(child.left_sibling.loc.expression.end_pos, child.loc.expression.end_pos) + end + end + + def remove_where_method(corrector, node, where_node) + range = range_between(where_node.loc.selector.begin_pos, where_node.loc.end.end_pos) + if node.multiline? && !same_line?(node, where_node) + range = range_by_whole_lines(range, include_final_newline: true) + else + corrector.remove(where_node.loc.dot) + end + + corrector.remove(range) + end + + def same_line?(left_joins_node, where_node) + left_joins_node.loc.selector.line == where_node.loc.selector.line + end + + def multi_condition?(where_arg) + where_arg.children.count > 1 + end + + def message(node, where_argument) + format(MSG, left_joins_association: node.first_argument.value, left_joins_method: node.method_name, + where_association: where_argument.value) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_not.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails/where_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails/where_not.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails_cops.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails_cops.rb index cf7c6c5769..8e0e555cc4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/cop/rails_cops.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/cop/rails_cops.rb @@ -8,12 +8,14 @@ require_relative 'mixin/index_method' require_relative 'mixin/migrations_helper' 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/active_record_aliases' require_relative 'rails/active_record_callbacks_order' require_relative 'rails/active_record_override' require_relative 'rails/active_support_aliases' +require_relative 'rails/active_support_on_load' require_relative 'rails/add_column_index' require_relative 'rails/after_commit_override' require_relative 'rails/application_controller' @@ -50,6 +52,7 @@ require_relative 'rails/file_path' require_relative 'rails/find_by' require_relative 'rails/find_by_id' require_relative 'rails/find_each' +require_relative 'rails/freeze_time' require_relative 'rails/has_and_belongs_to_many' require_relative 'rails/has_many_or_has_one_dependent' require_relative 'rails/helper_instance_variable' @@ -97,6 +100,7 @@ require_relative 'rails/require_dependency' require_relative 'rails/reversible_migration' require_relative 'rails/reversible_migration_method_definition' require_relative 'rails/root_join_chain' +require_relative 'rails/root_pathname_methods' require_relative 'rails/root_public_path' require_relative 'rails/safe_navigation' require_relative 'rails/safe_navigation_with_blank' @@ -111,6 +115,8 @@ require_relative 'rails/table_name_assignment' require_relative 'rails/time_zone' require_relative 'rails/time_zone_assignment' require_relative 'rails/to_formatted_s' +require_relative 'rails/to_s_with_argument' +require_relative 'rails/top_level_hash_with_indifferent_access' require_relative 'rails/transaction_exit_statement' require_relative 'rails/uniq_before_pluck' require_relative 'rails/unique_validation_without_index' @@ -119,4 +125,5 @@ require_relative 'rails/unused_ignored_columns' require_relative 'rails/validation' require_relative 'rails/where_equals' require_relative 'rails/where_exists' +require_relative 'rails/where_missing' require_relative 'rails/where_not' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/schema_loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/schema_loader.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/schema_loader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/schema_loader.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/schema_loader/schema.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/schema_loader/schema.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/schema_loader/schema.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/schema_loader/schema.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/version.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/lib/rubocop/rails/version.rb index 0b65ad0ee2..829beda4f4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.15.2/lib/rubocop/rails/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.16.0/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.15.2' + STRING = '2.16.0' def self.document_version STRING.match('\d+\.\d+').to_s