diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 05ba089a58..d46ffcde13 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.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.24.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.12.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.12.4/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.13.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.7.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.5.1/lib" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/config/default.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/config/default.yml similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/config/default.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/config/default.yml index b20840459e..7073bd27b6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/config/default.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/config/default.yml @@ -180,6 +180,12 @@ Rails/BulkChangeTable: Include: - db/migrate/*.rb +Rails/CompactBlank: + Description: 'Checks if collection can be blank-compacted with `compact_blank`.' + Enabled: pending + Safe: false + VersionAdded: '2.13' + Rails/ContentTag: Description: 'Use `tag.something` instead of `tag(:something)`.' Reference: @@ -245,6 +251,12 @@ Rails/DelegateAllowBlank: Enabled: true VersionAdded: '0.44' +Rails/DurationArithmetic: + Description: 'Do not use duration as arithmetic operand with `Time.current`.' + StyleGuide: 'https://rails.rubystyle.guide#duration-arithmetic' + Enabled: pending + VersionAdded: '2.13' + Rails/DynamicFindBy: Description: 'Use `find_by` instead of dynamic `find_by_*`.' StyleGuide: 'https://rails.rubystyle.guide#find_by' @@ -612,6 +624,11 @@ Rails/RedundantForeignKey: Enabled: true VersionAdded: '2.6' +Rails/RedundantPresenceValidationOnBelongsTo: + Description: 'Checks for redundant presence validation on belongs_to association.' + Enabled: pending + VersionAdded: '2.13' + Rails/RedundantReceiverInWithOptions: Description: 'Checks for redundant receiver in `with_options`.' Enabled: true @@ -646,9 +663,9 @@ Rails/RefuteMethods: Rails/RelativeDateConstant: Description: 'Do not assign relative date to constants.' Enabled: true + SafeAutoCorrect: false VersionAdded: '0.48' - VersionChanged: '0.59' - AutoCorrect: false + VersionChanged: '2.13' Rails/RenderInline: Description: 'Prefer using a template over inline rendering.' @@ -695,6 +712,11 @@ Rails/ReversibleMigrationMethodDefinition: Include: - db/migrate/*.rb +Rails/RootJoinChain: + Description: 'Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`.' + Enabled: pending + VersionAdded: '2.13' + Rails/SafeNavigation: Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`." Enabled: true @@ -727,6 +749,13 @@ Rails/SaveBang: AllowedReceivers: [] SafeAutoCorrect: false +Rails/SchemaComment: + Description: >- + This cop enforces the use of the `comment` option when adding a new table or column + to the database during a migration. + Enabled: false + VersionAdded: '2.13' + Rails/ScopeArgs: Description: 'Checks the arguments of ActiveRecord scopes.' Enabled: true @@ -789,9 +818,9 @@ Rails/TimeZone: StyleGuide: 'https://rails.rubystyle.guide#time' Reference: 'http://danilenko.org/2012/7/6/rails_timezones' Enabled: true - Safe: false + SafeAutoCorrect: false VersionAdded: '0.30' - VersionChanged: '2.10' + VersionChanged: '2.13' # The value `strict` means that `Time` should be used with `zone`. # The value `flexible` allows usage of `in_time_zone` instead of `zone`. EnforcedStyle: flexible @@ -814,13 +843,12 @@ Rails/UniqBeforePluck: Description: 'Prefer the use of uniq or distinct before pluck.' Enabled: true VersionAdded: '0.40' - VersionChanged: '2.8' + VersionChanged: '2.13' EnforcedStyle: conservative SupportedStyles: - conservative - aggressive SafeAutoCorrect: false - AutoCorrect: false Rails/UniqueValidationWithoutIndex: Description: 'Uniqueness validation should have a unique index on the database column.' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/config/obsoletion.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/config/obsoletion.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/config/obsoletion.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/config/obsoletion.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop-rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop-rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop-rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop-rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/mixin/active_record_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/active_record_helper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/mixin/active_record_helper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/active_record_helper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb new file mode 100644 index 0000000000..0934d2693f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/active_record_migrations_helper.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + # A mixin to extend cops for Active Record features + module ActiveRecordMigrationsHelper + extend NodePattern::Macros + + RAILS_ABSTRACT_SCHEMA_DEFINITIONS = %i[ + 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 + POSTGRES_SCHEMA_DEFINITIONS = %i[ + bigserial bit bit_varying cidr citext daterange hstore inet interval + int4range int8range jsonb ltree macaddr money numrange oid point line + lseg box path polygon circle serial tsrange tstzrange tsvector uuid xml + ].freeze + MYSQL_SCHEMA_DEFINITIONS = %i[ + blob tinyblob mediumblob longblob tinytext mediumtext longtext + unsigned_integer unsigned_bigint unsigned_float unsigned_decimal + ].freeze + + def_node_matcher :create_table_with_block?, <<~PATTERN + (block + (send nil? :create_table ...) + (args (arg _var)) + _) + PATTERN + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/mixin/enforce_superclass.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/mixin/enforce_superclass.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/enforce_superclass.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/mixin/index_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/index_method.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/mixin/index_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/index_method.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/mixin/target_rails_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/mixin/target_rails_version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/mixin/target_rails_version.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/action_filter.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/action_filter.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/active_record_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/active_record_aliases.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/active_record_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/active_record_aliases.rb index fd6d7390f7..d48e184723 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/active_record_aliases.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/active_record_aliases.rb @@ -6,6 +6,10 @@ module RuboCop # Checks that ActiveRecord aliases are not used. The direct method names # are more clear and easier to read. # + # @safety + # This cop is unsafe because custom `update_attributes` method call was changed to + # `update` but the method name remained same in the method definition. + # # @example # #bad # book.update_attributes!(author: 'Alice') diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/active_record_callbacks_order.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/active_record_callbacks_order.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/active_record_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/active_record_override.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/active_record_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/active_record_override.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/active_support_aliases.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/active_support_aliases.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/active_support_aliases.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/add_column_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/add_column_index.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/add_column_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/add_column_index.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/after_commit_override.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/after_commit_override.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/after_commit_override.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_controller.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_controller.rb similarity index 70% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_controller.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_controller.rb index 968536e951..9bdde9de72 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_controller.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_controller.rb @@ -3,7 +3,11 @@ module RuboCop module Cop module Rails - # This cop checks that controllers subclass ApplicationController. + # This cop checks that controllers subclass `ApplicationController`. + # + # @safety + # This cop's autocorrection is unsafe because it may let the logic from `ApplicationController` + # sneak into a controller that is not purposed to inherit logic common among other controllers. # # @example # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_job.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_job.rb similarity index 76% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_job.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_job.rb index b2791a317b..48adfe0185 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_job.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_job.rb @@ -3,7 +3,11 @@ module RuboCop module Cop module Rails - # This cop checks that jobs subclass ApplicationJob with Rails 5.0. + # This cop checks that jobs subclass `ApplicationJob` with Rails 5.0. + # + # @safety + # This cop's autocorrection is unsafe because it may let the logic from `ApplicationJob` + # sneak into a job that is not purposed to inherit logic common among other jobs. # # @example # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_mailer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_mailer.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_mailer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_mailer.rb index 409424d761..1f66855213 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_mailer.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_mailer.rb @@ -3,7 +3,11 @@ module RuboCop module Cop module Rails - # This cop checks that mailers subclass ApplicationMailer with Rails 5.0. + # This cop checks that mailers subclass `ApplicationMailer` with Rails 5.0. + # + # @safety + # This cop's autocorrection is unsafe because it may let the logic from `ApplicationMailer` + # sneak into a mailer that is not purposed to inherit logic common among other mailers. # # @example # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_record.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_record.rb similarity index 69% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_record.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_record.rb index c2fe267076..0fba2a3e7b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/application_record.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/application_record.rb @@ -3,7 +3,12 @@ module RuboCop module Cop module Rails - # This cop checks that models subclass ApplicationRecord with Rails 5.0. + # This cop checks that models subclass `ApplicationRecord` with Rails 5.0. + # + # @safety + # This cop's autocorrection is unsafe because it may let the logic from `ApplicationRecord` + # sneak into an Active Record model that is not purposed to inherit logic common among other + # Active Record models. # # @example # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/arel_star.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/arel_star.rb similarity index 78% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/arel_star.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/arel_star.rb index 5af9f33642..6135c584ca 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/arel_star.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/arel_star.rb @@ -10,6 +10,12 @@ module RuboCop # database to look for a column named `*` (or `"*"`) as opposed # to expanding the column list as one would likely expect. # + # @safety + # This cop's autocorrection is unsafe because it turns a quoted `*` into + # an SQL `*`, unquoted. `*` is a valid column name in certain databases + # supported by Rails, and even though it is usually a mistake, + # it might denote legitimate access to a column named `*`. + # # @example # # bad # MyTable.arel_table["*"] diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/assert_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/assert_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/assert_not.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/attribute_default_block_value.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/attribute_default_block_value.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/belongs_to.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/belongs_to.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/blank.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/blank.rb index 40ba2a615c..14c54cd257 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/blank.rb @@ -6,15 +6,16 @@ module RuboCop # This cop checks for code that can be written with simpler conditionals # using `Object#blank?` defined by Active Support. # - # This cop is marked as unsafe auto-correction, because `' '.empty?` returns false, - # but `' '.blank?` returns true. Therefore, auto-correction is not compatible - # if the receiver is a non-empty blank string, tab, or newline meta characters. - # # Interaction with `Style/UnlessElse`: # The configuration of `NotPresent` will not produce an offense in the # context of `unless else` if `Style/UnlessElse` is inabled. This is # to prevent interference between the auto-correction of the two cops. # + # @safety + # This cop is unsafe auto-correction, because `' '.empty?` returns false, + # but `' '.blank?` returns true. Therefore, auto-correction is not compatible + # if the receiver is a non-empty blank string, tab, or newline meta characters. + # # @example NilOrEmpty: true (default) # # Converts usages of `nil? || empty?` to `blank?` # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/bulk_change_table.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/bulk_change_table.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/bulk_change_table.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/bulk_change_table.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/compact_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/compact_blank.rb new file mode 100644 index 0000000000..a7ca76f084 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/compact_blank.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Checks if collection can be blank-compacted with `compact_blank`. + # + # @safety + # It is unsafe by default because false positives may occur in the + # blank check of block arguments to the receiver object. + # + # For example, `[[1, 2], [3, nil]].reject { |first, second| second.blank? }` and + # `[[1, 2], [3, nil]].compact_blank` are not compatible. The same is true for `empty?`. + # This will work fine when the receiver is a hash object. + # + # @example + # + # # bad + # collection.reject(&:blank?) + # collection.reject(&:empty?) + # collection.reject { |_k, v| v.blank? } + # collection.reject { |_k, v| v.empty? } + # + # # good + # collection.compact_blank + # + # # bad + # collection.reject!(&:blank?) + # collection.reject!(&:empty?) + # collection.reject! { |_k, v| v.blank? } + # collection.reject! { |_k, v| v.empty? } + # + # # good + # collection.compact_blank! + # + class CompactBlank < Base + include RangeHelp + extend AutoCorrector + extend TargetRailsVersion + + MSG = 'Use `%s` instead.' + RESTRICT_ON_SEND = %i[reject reject!].freeze + + minimum_target_rails_version 6.1 + + def_node_matcher :reject_with_block?, <<~PATTERN + (block + (send _ {:reject :reject!}) + $(args ...) + (send + $(lvar _) {:blank? :empty?})) + PATTERN + + def_node_matcher :reject_with_block_pass?, <<~PATTERN + (send _ {:reject :reject!} + (block_pass + (sym {:blank? :empty?}))) + PATTERN + + def on_send(node) + return unless bad_method?(node) + + range = offense_range(node) + preferred_method = preferred_method(node) + add_offense(range, message: format(MSG, preferred_method: preferred_method)) do |corrector| + corrector.replace(range, preferred_method) + end + end + + private + + def bad_method?(node) + return true if reject_with_block_pass?(node) + + if (arguments, receiver_in_block = reject_with_block?(node.parent)) + return arguments.length == 1 || use_hash_value_block_argument?(arguments, receiver_in_block) + end + + false + end + + def use_hash_value_block_argument?(arguments, receiver_in_block) + arguments.length == 2 && arguments[1].source == receiver_in_block.source + end + + def offense_range(node) + end_pos = node.parent&.block_type? ? node.parent.loc.expression.end_pos : node.loc.expression.end_pos + + range_between(node.loc.selector.begin_pos, end_pos) + end + + def preferred_method(node) + node.method?(:reject) ? 'compact_blank' : 'compact_blank!' + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/content_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/content_tag.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/content_tag.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/content_tag.rb index 87c69f3a41..b212ef72aa 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/content_tag.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/content_tag.rb @@ -6,8 +6,8 @@ module RuboCop # This cop checks legacy syntax usage of `tag` # # NOTE: Allow `tag` when the first argument is a variable because - # `tag(name)` is simpler rather than `tag.public_send(name)`. - # And this cop will be renamed to something like `LegacyTag` in the future. (e.g. RuboCop Rails 2.0) + # `tag(name)` is simpler rather than `tag.public_send(name)`. + # And this cop will be renamed to something like `LegacyTag` in the future. (e.g. RuboCop Rails 2.0) # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/create_table_with_timestamps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/create_table_with_timestamps.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb index 486ebbc4b8..1d763127e7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/create_table_with_timestamps.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/create_table_with_timestamps.rb @@ -41,16 +41,11 @@ module RuboCop # t.datetime :updated_at, default: -> { 'CURRENT_TIMESTAMP' } # end class CreateTableWithTimestamps < Base + include ActiveRecordMigrationsHelper + MSG = 'Add timestamps when creating a new table.' RESTRICT_ON_SEND = %i[create_table].freeze - def_node_matcher :create_table_with_block?, <<~PATTERN - (block - (send nil? :create_table ...) - (args (arg _var)) - _) - PATTERN - def_node_matcher :create_table_with_timestamps_proc?, <<~PATTERN (send nil? :create_table (sym _) ... (block-pass (sym :timestamps))) PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/date.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/date.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/date.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/default_scope.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/default_scope.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/default_scope.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/delegate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/delegate.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/delegate.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/delegate.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/delegate_allow_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/delegate_allow_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/delegate_allow_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/duration_arithmetic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/duration_arithmetic.rb new file mode 100644 index 0000000000..d089a67727 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/duration_arithmetic.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # This cop checks if a duration is added to or subtracted from `Time.current`. + # + # @example + # # bad + # Time.current - 1.minute + # Time.current + 2.days + # + # # good - using relative would make it harder to express and read + # Date.yesterday + 3.days + # created_at - 1.minute + # 3.days - 1.hour + # + # # good + # 1.minute.ago + # 2.days.from_now + class DurationArithmetic < Base + extend AutoCorrector + + MSG = 'Do not add or subtract duration.' + + RESTRICT_ON_SEND = %i[+ -].freeze + + DURATIONS = Set[:second, :seconds, :minute, :minutes, :hour, :hours, + :day, :days, :week, :weeks, :fortnight, :fortnights] + + # @!method duration_arithmetic_argument?(node) + # Match duration subtraction or addition with current time. + # + # @example source that matches + # Time.current - 1.hour + # + # @example source that matches + # ::Time.zone.now + 1.hour + # + # @param node [RuboCop::AST::Node] + # @yield operator and duration + def_node_matcher :duration_arithmetic_argument?, <<~PATTERN + (send #time_current? ${ :+ :- } $#duration?) + PATTERN + + # @!method duration?(node) + # Match a literal Duration + # + # @example source that matches + # 1.hour + # + # @example source that matches + # 9.5.weeks + # + # @param node [RuboCop::AST::Node] + # @return [Boolean] true if matches + def_node_matcher :duration?, '(send { int float (send nil _) } DURATIONS)' + + # @!method time_current?(node) + # Match Time.current + # + # @example source that matches + # Time.current + # + # @example source that matches + # ::Time.zone.now + # + # @param node [RuboCop::AST::Node] + # @return [Boolean] true if matches + def_node_matcher :time_current?, <<~PATTERN + { + (send (const _ :Time) :current) + (send (send (const _ :Time) :zone) :now) + } + PATTERN + + def on_send(node) + duration_arithmetic_argument?(node) do |*operation| + add_offense(node) do |corrector| + corrector.replace(node.source_range, corrected_source(*operation)) + end + end + end + + private + + def corrected_source(operator, duration) + if operator == :- + "#{duration.source}.ago" + else + "#{duration.source}.from_now" + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/dynamic_find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/dynamic_find_by.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/dynamic_find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/dynamic_find_by.rb index 1ef798f9cc..2999c0d649 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/dynamic_find_by.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/dynamic_find_by.rb @@ -7,6 +7,10 @@ module RuboCop # Use `find_by` instead of dynamic method. # See. https://rails.rubystyle.guide#find_by # + # @safety + # It is certainly unsafe when not configured properly, i.e. user-defined `find_by_xxx` + # method is not added to cop's `AllowedMethods`. + # # @example # # bad # User.find_by_name(name) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/eager_evaluation_log_message.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/eager_evaluation_log_message.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/enum_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/enum_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/enum_hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/enum_uniqueness.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/enum_uniqueness.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/enum_uniqueness.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/enum_uniqueness.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/environment_comparison.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/environment_comparison.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/environment_comparison.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/environment_comparison.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/environment_variable_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/environment_variable_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/environment_variable_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/exit.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/exit.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/exit.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/exit.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/expanded_date_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/expanded_date_range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/expanded_date_range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/file_path.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/file_path.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/file_path.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/file_path.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/find_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/find_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/find_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/find_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/find_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/find_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/find_each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/find_each.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/find_each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/find_each.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/has_and_belongs_to_many.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/has_and_belongs_to_many.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/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.13.0/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/helper_instance_variable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/helper_instance_variable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/helper_instance_variable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/http_positional_arguments.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/http_positional_arguments.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/http_positional_arguments.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/http_positional_arguments.rb index 32536f4eda..31413a8d29 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/http_positional_arguments.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/http_positional_arguments.rb @@ -67,7 +67,7 @@ module RuboCop private def in_routing_block?(node) - !!node.each_ancestor(:block).detect { |block| ROUTING_METHODS.include?(block.send_node.method_name) } + !!node.each_ancestor(:block).detect { |block| ROUTING_METHODS.include?(block.method_name) } end def needs_conversion?(data) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/http_status.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/http_status.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/http_status.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/http_status.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/i18n_locale_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/i18n_locale_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/i18n_locale_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/index_by.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/index_by.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/index_by.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/index_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/index_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/index_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/inverse_of.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/inverse_of.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/inverse_of.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/inverse_of.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb index 851a4dab6d..266d57e0d2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb @@ -6,13 +6,14 @@ module RuboCop # This cop checks that methods specified in the filter's `only` or # `except` options are defined within the same class or module. # - # You can technically specify methods of superclass or methods added by - # mixins on the filter, but these can confuse developers. If you specify - # methods that are defined in other classes or modules, you should - # define the filter in that class or module. + # @safety + # You can technically specify methods of superclass or methods added by + # mixins on the filter, but these can confuse developers. If you specify + # methods that are defined in other classes or modules, you should + # define the filter in that class or module. # - # If you rely on behaviour defined in the superclass actions, you must - # remember to invoke `super` in the subclass actions. + # If you rely on behaviour defined in the superclass actions, you must + # remember to invoke `super` in the subclass actions. # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/link_to_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/link_to_blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/link_to_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/link_to_blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/mailer_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/mailer_name.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/mailer_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/mailer_name.rb index d55983d194..c5ab074ff5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/mailer_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/mailer_name.rb @@ -8,6 +8,10 @@ module RuboCop # Without the `Mailer` suffix it isn't immediately apparent what's a mailer # and which views are related to the mailer. # + # @safety + # This cop's autocorrection is unsafe because renaming a constant is + # always an unsafe operation. + # # @example # # bad # class User < ActionMailer::Base diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/match_route.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/match_route.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/match_route.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/negate_include.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/negate_include.rb similarity index 85% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/negate_include.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/negate_include.rb index f4442e0367..34bd3f7d57 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/negate_include.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/negate_include.rb @@ -6,8 +6,9 @@ module RuboCop # This cop enforces the use of `collection.exclude?(obj)` # over `!collection.include?(obj)`. # - # It is marked as unsafe by default because false positive will occur for - # a receiver object that do not have `exclude?` method. (e.g. `IPAddr`) + # @safety + # This cop is unsafe because false positive will occur for + # receiver objects that do not have an `exclude?` method. (e.g. `IPAddr`) # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/not_null_column.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/not_null_column.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/not_null_column.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/order_by_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/order_by_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/order_by_id.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/output.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/output.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/output.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/output.rb index a06b98b8e4..eff7b68c5c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/output.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/output.rb @@ -5,6 +5,10 @@ module RuboCop module Rails # This cop checks for the use of output calls like puts and print # + # @safety + # This cop's autocorrection is unsafe because depending on the Rails log level configuration, + # changing from `puts` to `Rails.logger.debug` could result in no output being shown. + # # @example # # bad # puts 'A debug message' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/output_safety.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/output_safety.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pick.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pick.rb similarity index 81% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pick.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pick.rb index 3cc8e7ddbe..f6ecd0a9e2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pick.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pick.rb @@ -9,6 +9,13 @@ module RuboCop # `pick` avoids. When called on an Active Record relation, `pick` adds a # limit to the query so that only one value is fetched from the database. # + # @safety + # This cop is unsafe because `pluck` is defined on both `ActiveRecord::Relation` and `Enumerable`, + # whereas `pick` is only defined on `ActiveRecord::Relation` in Rails 6.0. This was addressed + # in Rails 6.1 via rails/rails#38760, at which point the cop is safe. + # + # See: https://github.com/rubocop/rubocop-rails/pull/249 + # # @example # # bad # Model.pluck(:a).first diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluck.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluck.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluck_id.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluck_id.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluck_id.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluck_id.rb index c1740830bb..0193d5b284 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluck_id.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluck_id.rb @@ -5,6 +5,9 @@ module RuboCop module Rails # This cop enforces the use of `ids` over `pluck(:id)` and `pluck(primary_key)`. # + # @safety + # This cop is unsafe if the receiver object is not an Active Record object. + # # @example # # bad # User.pluck(:id) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluck_in_where.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluck_in_where.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluck_in_where.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluck_in_where.rb index 9db913b6fd..145b0bd4bd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluck_in_where.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluck_in_where.rb @@ -9,14 +9,15 @@ module RuboCop # Since `pluck` is an eager method and hits the database immediately, # using `select` helps to avoid additional database queries. # - # This cop has two different enforcement modes. When the EnforcedStyle - # is conservative (the default) then only calls to `pluck` on a constant + # This cop has two different enforcement modes. When the `EnforcedStyle` + # is `conservative` (the default) then only calls to `pluck` on a constant # (i.e. a model class) in the `where` is used as offenses. # - # When the EnforcedStyle is aggressive then all calls to `pluck` in the - # `where` is used as offenses. This may lead to false positives - # as the cop cannot replace to `select` between calls to `pluck` on an - # `ActiveRecord::Relation` instance vs a call to `pluck` on an `Array` instance. + # @safety + # When the `EnforcedStyle` is `aggressive` then all calls to `pluck` in the + # `where` is used as offenses. This may lead to false positives + # as the cop cannot replace to `select` between calls to `pluck` on an + # `ActiveRecord::Relation` instance vs a call to `pluck` on an `Array` instance. # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluralization_grammar.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluralization_grammar.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/pluralization_grammar.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/pluralization_grammar.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/presence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/presence.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/presence.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/presence.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/present.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/present.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/present.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/present.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/rake_environment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/rake_environment.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/rake_environment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/rake_environment.rb index 97f69830b0..f750732676 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/rake_environment.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/rake_environment.rb @@ -14,6 +14,11 @@ module RuboCop # * The task does not need application code. # * The task invokes the `:environment` task. # + # @safety + # Probably not a problem in most cases, but it is possible that calling `:environment` task + # will break a behavior. It's also slower. E.g. some task that only needs one gem to be + # loaded to run will run significantly faster without loading the whole application. + # # @example # # bad # task :foo do diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/read_write_attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/read_write_attribute.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/read_write_attribute.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/redundant_allow_nil.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_allow_nil.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/redundant_allow_nil.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_allow_nil.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/redundant_foreign_key.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_foreign_key.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/redundant_foreign_key.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_foreign_key.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb new file mode 100644 index 0000000000..8ddbb73668 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb @@ -0,0 +1,192 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Since Rails 5.0 the default for `belongs_to` is `optional: false` + # unless `config.active_record.belongs_to_required_by_default` is + # explicitly set to `false`. The presence validator is added + # automatically, and explicit presence validation is redundant. + # + # @example + # # bad + # belongs_to :user + # validates :user, presence: true + # + # # bad + # belongs_to :user + # validates :user_id, presence: true + # + # # bad + # belongs_to :author, foreign_key: :user_id + # validates :user_id, presence: true + # + # # good + # belongs_to :user + # + # # good + # belongs_to :author, foreign_key: :user_id + # + class RedundantPresenceValidationOnBelongsTo < Base + include RangeHelp + extend AutoCorrector + extend TargetRailsVersion + + MSG = 'Remove explicit presence validation for `%s`.' + RESTRICT_ON_SEND = %i[validates].freeze + + minimum_target_rails_version 5.0 + + # @!method presence_validation?(node) + # Match a `validates` statement with a presence check + # + # @example source that matches - by association + # validates :user, presence: true + # + # @example source that matches - with presence options + # validates :user, presence: { message: 'duplicate' } + # + # @example source that matches - by a foreign key + # validates :user_id, presence: true + def_node_matcher :presence_validation?, <<~PATTERN + $( + send nil? :validates + (sym $_) + ... + $(hash <$(pair (sym :presence) {true hash}) ...>) + ) + PATTERN + + # @!method optional_option?(node) + # Match a `belongs_to` association with an optional option in a hash + def_node_matcher :optional?, <<~PATTERN + (send nil? :belongs_to _ ... #optional_option?) + PATTERN + + # @!method optional_option?(node) + # Match an optional option in a hash + def_node_matcher :optional_option?, <<~PATTERN + { + (hash <(pair (sym :optional) true) ...>) # optional: true + (hash <(pair (sym :required) false) ...>) # required: false + } + PATTERN + + # @!method any_belongs_to?(node, association:) + # Match a class with `belongs_to` with no regard to `foreign_key` option + # + # @example source that matches + # belongs_to :user + # + # @example source that matches - regardless of `foreign_key` + # belongs_to :author, foreign_key: :user_id + # + # @param node [RuboCop::AST::Node] + # @param association [Symbol] + # @return [Array, nil] matching node + def_node_matcher :any_belongs_to?, <<~PATTERN + (begin + < + $(send nil? :belongs_to (sym %association) ...) + ... + > + ) + PATTERN + + # @!method belongs_to?(node, key:, fk:) + # Match a class with a matching association, either by name or an explicit + # `foreign_key` option + # + # @example source that matches - fk matches `foreign_key` option + # belongs_to :author, foreign_key: :user_id + # + # @example source that matches - key matches association name + # belongs_to :user + # + # @example source that does not match - explicit `foreign_key` does not match + # belongs_to :user, foreign_key: :account_id + # + # @param node [RuboCop::AST::Node] + # @param key [Symbol] e.g. `:user` + # @param fk [Symbol] e.g. `:user_id` + # @return [Array] matching nodes + def_node_matcher :belongs_to?, <<~PATTERN + (begin + < + ${ + #belongs_to_without_fk?(%key) # belongs_to :user + #belongs_to_with_a_matching_fk?(%fk) # belongs_to :author, foreign_key: :user_id + } + ... + > + ) + PATTERN + + # @!method belongs_to_without_fk?(node, fk) + # Match a matching `belongs_to` association, without an explicit `foreign_key` option + # + # @param node [RuboCop::AST::Node] + # @param key [Symbol] e.g. `:user` + # @return [Array] matching nodes + def_node_matcher :belongs_to_without_fk?, <<~PATTERN + { + (send nil? :belongs_to (sym %1)) # belongs_to :user + (send nil? :belongs_to (sym %1) !hash) # belongs_to :user, -> { not_deleted } + (send nil? :belongs_to (sym %1) !(hash <(pair (sym :foreign_key) _) ...>)) + } + PATTERN + + # @!method belongs_to_with_a_matching_fk?(node, fk) + # Match a matching `belongs_to` association with a matching explicit `foreign_key` option + # + # @example source that matches + # belongs_to :author, foreign_key: :user_id + # + # @param node [RuboCop::AST::Node] + # @param fk [Symbol] e.g. `:user_id` + # @return [Array] matching nodes + def_node_matcher :belongs_to_with_a_matching_fk?, <<~PATTERN + (send nil? :belongs_to ... (hash <(pair (sym :foreign_key) (sym %1)) ...>)) + PATTERN + + def on_send(node) + validation, key, options, presence = presence_validation?(node) + return unless validation + + belongs_to = belongs_to_for(node.parent, key) + return unless belongs_to + return if optional?(belongs_to) + + message = format(MSG, association: key.to_s) + + add_offense(presence, message: message) do |corrector| + remove_presence_validation(corrector, node, options, presence) + end + end + + private + + def belongs_to_for(model_class_node, key) + if key.to_s.end_with?('_id') + normalized_key = key.to_s.delete_suffix('_id').to_sym + belongs_to?(model_class_node, key: normalized_key, fk: key) + else + any_belongs_to?(model_class_node, association: key) + end + end + + def remove_presence_validation(corrector, node, options, presence) + if options.children.one? + corrector.remove(range_by_whole_lines(node.source_range, include_final_newline: true)) + else + range = range_with_surrounding_comma( + range_with_surrounding_space(range: presence.source_range, side: :left), + :left + ) + corrector.remove(range) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/redundant_travel_back.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/redundant_travel_back.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/redundant_travel_back.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/reflection_class_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/reflection_class_name.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/reflection_class_name.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/reflection_class_name.rb index c7504934da..69ffac76df 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/reflection_class_name.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/reflection_class_name.rb @@ -5,8 +5,10 @@ module RuboCop module Rails # This cop checks if the value of the option `class_name`, in # the definition of a reflection is a string. - # It is marked as unsafe because it cannot be determined whether - # constant or method return value specified to `class_name` is a string. + # + # @safety + # This cop is unsafe because it cannot be determined whether + # constant or method return value specified to `class_name` is a string. # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/refute_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/refute_methods.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/refute_methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/refute_methods.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/relative_date_constant.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/relative_date_constant.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/relative_date_constant.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/relative_date_constant.rb index a2fb5432dc..71488de21e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/relative_date_constant.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/relative_date_constant.rb @@ -6,6 +6,9 @@ module RuboCop # This cop checks whether constant value isn't relative date. # Because the relative date will be evaluated only once. # + # @safety + # This cop's autocorrection is unsafe because its dependence on the constant is not corrected. + # # @example # # bad # class SomeClass diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/render_inline.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/render_inline.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/render_inline.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/render_plain_text.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/render_plain_text.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/render_plain_text.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/request_referer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/request_referer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/request_referer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/request_referer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/require_dependency.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/require_dependency.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/require_dependency.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/reversible_migration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/reversible_migration.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/reversible_migration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/reversible_migration.rb index 9f8d27a22c..1b44954ff4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/reversible_migration.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/reversible_migration.rb @@ -179,7 +179,7 @@ module RuboCop MSG = '%s is not reversible.' def_node_matcher :irreversible_schema_statement_call, <<~PATTERN - (send nil? ${:execute :remove_belongs_to} ...) + (send nil? ${:change_column :execute :remove_belongs_to :remove_reference} ...) PATTERN def_node_matcher :drop_table_call, <<~PATTERN diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/reversible_migration_method_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/reversible_migration_method_definition.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/reversible_migration_method_definition.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/root_join_chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/root_join_chain.rb new file mode 100644 index 0000000000..fb28d0c2d3 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/root_join_chain.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`. + # + # @example + # # bad + # Rails.root.join('db').join('schema.rb') + # Rails.root.join('db').join(migrate).join('migration.rb') + # Rails.public_path.join('path').join('file.pdf') + # Rails.public_path.join('path').join(to).join('file.pdf') + # + # # good + # Rails.root.join('db', 'schema.rb') + # Rails.root.join('db', migrate, 'migration.rb') + # Rails.public_path.join('path', 'file.pdf') + # Rails.public_path.join('path', to, 'file.pdf') + # + class RootJoinChain < Base + extend AutoCorrector + include RangeHelp + + MSG = 'Use `%s.join(...)` instead of chaining `#join` calls.' + + RESTRICT_ON_SEND = %i[join].to_set.freeze + + # @!method rails_root?(node) + def_node_matcher :rails_root?, <<~PATTERN + (send (const {nil? cbase} :Rails) {:root :public_path}) + PATTERN + + # @!method join?(node) + def_node_matcher :join?, <<~PATTERN + (send _ :join $...) + PATTERN + + def on_send(node) + evidence(node) do |rails_node, args| + add_offense(node, message: format(MSG, root: rails_node.source)) do |corrector| + range = range_between(rails_node.loc.selector.end_pos, node.loc.expression.end_pos) + replacement = ".join(#{args.map(&:source).join(', ')})" + + corrector.replace(range, replacement) + end + end + end + + private + + def evidence(node) + # Are we at the *end* of the join chain? + return if join?(node.parent) + # Is there only one join? + return if rails_root?(node.receiver) + + all_args = [] + + while (args = join?(node)) + all_args = args + all_args + node = node.receiver + end + + rails_root?(node) do + yield(node, all_args) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/safe_navigation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/safe_navigation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/safe_navigation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/safe_navigation_with_blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb similarity index 72% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/safe_navigation_with_blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb index 960ca85846..99067f4d7e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/safe_navigation_with_blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/safe_navigation_with_blank.rb @@ -6,9 +6,18 @@ module RuboCop # This cop checks to make sure safe navigation isn't used with `blank?` in # a conditional. # - # While the safe navigation operator is generally a good idea, when - # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually - # do the opposite of what the author intends. + # @safety + # While the safe navigation operator is generally a good idea, when + # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually + # do the opposite of what the author intends. + # + # For example: + # + # [source,ruby] + # ---- + # foo&.blank? #=> nil + # foo.blank? #=> true + # ---- # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/save_bang.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/save_bang.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/save_bang.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/save_bang.rb index d9c7206a3a..c4d7cbc3b9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/save_bang.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/save_bang.rb @@ -25,6 +25,25 @@ module RuboCop # You can permit receivers that are giving false positives with # `AllowedReceivers: []` # + # @safety + # This cop's autocorrection is unsafe because a custom `update` method call would be changed to `update!`, + # but the method name in the definition would be unchanged. + # + # [source,ruby] + # ---- + # # Original code + # def update_attributes + # end + # + # update_attributes + # + # # After running rubocop --safe-auto-correct + # def update_attributes + # end + # + # update + # ---- + # # @example # # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/schema_comment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/schema_comment.rb new file mode 100644 index 0000000000..5920823d60 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/schema_comment.rb @@ -0,0 +1,104 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Rails + # This cop enforces the use of the `comment` option when adding a new table or column + # to the database during a migration. + # + # @example + # # bad (no comment for a new column or table) + # add_column :table, :column, :integer + # + # create_table :table do |t| + # t.type :column + # end + # + # # good + # add_column :table, :column, :integer, comment: 'Number of offenses' + # + # create_table :table, comment: 'Table of offenses data' do |t| + # t.type :column, comment: 'Number of offenses' + # end + # + class SchemaComment < Base + include ActiveRecordMigrationsHelper + + COLUMN_MSG = 'New database column without `comment`.' + TABLE_MSG = 'New database table without `comment`.' + RESTRICT_ON_SEND = %i[add_column create_table].freeze + CREATE_TABLE_COLUMN_METHODS = Set[ + *( + RAILS_ABSTRACT_SCHEMA_DEFINITIONS | + RAILS_ABSTRACT_SCHEMA_DEFINITIONS_HELPERS | + POSTGRES_SCHEMA_DEFINITIONS | + MYSQL_SCHEMA_DEFINITIONS + ) + ].freeze + + # @!method comment_present?(node) + def_node_matcher :comment_present?, <<~PATTERN + (hash <(pair {(sym :comment) (str "comment")} (_ [present?])) ...>) + PATTERN + + # @!method add_column?(node) + def_node_matcher :add_column?, <<~PATTERN + (send nil? :add_column _table _column _type _?) + PATTERN + + # @!method add_column_with_comment?(node) + def_node_matcher :add_column_with_comment?, <<~PATTERN + (send nil? :add_column _table _column _type #comment_present?) + PATTERN + + # @!method create_table?(node) + def_node_matcher :create_table?, <<~PATTERN + (send nil? :create_table _table _?) + PATTERN + + # @!method create_table?(node) + def_node_matcher :create_table_with_comment?, <<~PATTERN + (send nil? :create_table _table #comment_present? ...) + PATTERN + + # @!method t_column?(node) + def_node_matcher :t_column?, <<~PATTERN + (send _var CREATE_TABLE_COLUMN_METHODS ...) + PATTERN + + # @!method t_column_with_comment?(node) + def_node_matcher :t_column_with_comment?, <<~PATTERN + (send _var CREATE_TABLE_COLUMN_METHODS _column _type? #comment_present?) + PATTERN + + def on_send(node) + if add_column_without_comment?(node) + add_offense(node, message: COLUMN_MSG) + elsif create_table?(node) + if create_table_without_comment?(node) + add_offense(node, message: TABLE_MSG) + elsif create_table_column_call_without_comment?(node) + add_offense(node.parent.body, message: COLUMN_MSG) + end + end + end + + private + + def add_column_without_comment?(node) + add_column?(node) && !add_column_with_comment?(node) + end + + def create_table_without_comment?(node) + create_table?(node) && !create_table_with_comment?(node) + end + + def create_table_column_call_without_comment?(node) + create_table_with_block?(node.parent) && + t_column?(node.parent.body) && + !t_column_with_comment?(node.parent.body) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/scope_args.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/scope_args.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/scope_args.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/short_i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/short_i18n.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/short_i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/short_i18n.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/skips_model_validations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/skips_model_validations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/skips_model_validations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/skips_model_validations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/squished_sql_heredocs.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/squished_sql_heredocs.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb index 834969bc91..6a93980fbb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/squished_sql_heredocs.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/squished_sql_heredocs.rb @@ -5,8 +5,10 @@ module RuboCop module Rails # # Checks SQL heredocs to use `.squish`. - # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines - # to be preserved in order to work, thus auto-correction for this cop is not safe. + # + # @safety + # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines + # to be preserved in order to work, thus auto-correction for this cop is not safe. # # @example # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/time_zone.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/time_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/time_zone.rb index 90ef9d5ff9..4053b8a74a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/time_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/time_zone.rb @@ -14,6 +14,9 @@ module RuboCop # When EnforcedStyle is 'flexible' then it's also allowed # to use `Time#in_time_zone`. # + # @safety + # This cop's autocorrection is unsafe because it may change handling time. + # # @example # # bad # Time.now diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/time_zone_assignment.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/time_zone_assignment.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/time_zone_assignment.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/uniq_before_pluck.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/uniq_before_pluck.rb similarity index 55% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/uniq_before_pluck.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/uniq_before_pluck.rb index 290c30e158..bcbe1477e9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/uniq_before_pluck.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/uniq_before_pluck.rb @@ -3,47 +3,46 @@ module RuboCop module Cop module Rails - # Prefer the use of distinct, before pluck instead of after. + # Prefer using `distinct` before `pluck` instead of `uniq` after `pluck`. # - # The use of distinct before pluck is preferred because it executes within + # The use of distinct before pluck is preferred because it executes by # the database. # # This cop has two different enforcement modes. When the EnforcedStyle - # is conservative (the default) then only calls to pluck on a constant - # (i.e. a model class) before distinct are added as offenses. + # is `conservative` (the default), then only calls to `pluck` on a constant + # (i.e. a model class) before `uniq` are added as offenses. # - # When the EnforcedStyle is aggressive then all calls to pluck before + # When the EnforcedStyle is `aggressive` then all calls to `pluck` before # distinct are added as offenses. This may lead to false positives - # as the cop cannot distinguish between calls to pluck on an + # as the cop cannot distinguish between calls to `pluck` on an # ActiveRecord::Relation vs a call to pluck on an # ActiveRecord::Associations::CollectionProxy. # - # This cop is unsafe because the behavior may change depending on the - # database collation. - # Autocorrect is disabled by default for this cop since it may generate - # false positives. + # @safety + # This cop is unsafe for autocorrection because the behavior may change + # depending on the database collation. # # @example EnforcedStyle: conservative (default) - # # bad - # Model.pluck(:id).uniq + # # bad - redundantly fetches duplicate values + # Album.pluck(:band_name).uniq # # # good - # Model.distinct.pluck(:id) + # Album.distinct.pluck(:band_name) # # @example EnforcedStyle: aggressive - # # bad - # # this will return a Relation that pluck is called on - # Model.where(cond: true).pluck(:id).uniq + # # bad - redundantly fetches duplicate values + # Album.pluck(:band_name).uniq # - # # bad - # # an association on an instance will return a CollectionProxy - # instance.assoc.pluck(:id).uniq + # # bad - redundantly fetches duplicate values + # Album.where(year: 1985).pluck(:band_name).uniq # - # # bad - # Model.pluck(:id).uniq + # # bad - redundantly fetches duplicate values + # customer.favourites.pluck(:color).uniq # # # good - # Model.distinct.pluck(:id) + # Album.distinct.pluck(:band_name) + # Album.distinct.where(year: 1985).pluck(:band_name) + # customer.favourites.distinct.pluck(:color) # class UniqBeforePluck < Base include ConfigurableEnforcedStyle @@ -51,10 +50,9 @@ module RuboCop extend AutoCorrector MSG = 'Use `distinct` before `pluck`.' - RESTRICT_ON_SEND = %i[uniq distinct pluck].freeze + RESTRICT_ON_SEND = %i[uniq].freeze NEWLINE = "\n" - PATTERN = '[!^block (send (send %s :pluck ...) ' \ - '${:uniq :distinct} ...)]' + PATTERN = '[!^block (send (send %s :pluck ...) :uniq ...)]' def_node_matcher :conservative_node_match, format(PATTERN, type: 'const') @@ -63,13 +61,13 @@ module RuboCop format(PATTERN, type: '_') def on_send(node) - method = if style == :conservative - conservative_node_match(node) - else - aggressive_node_match(node) - end + uniq = if style == :conservative + conservative_node_match(node) + else + aggressive_node_match(node) + end - return unless method + return unless uniq add_offense(node.loc.selector) do |corrector| method = node.method_name @@ -81,10 +79,6 @@ module RuboCop private - def style_parameter_name - 'EnforcedStyle' - end - def dot_method_with_whitespace(method, node) range_between(dot_method_begin_pos(method, node), node.loc.selector.end_pos) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/unique_validation_without_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/unique_validation_without_index.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/unique_validation_without_index.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/unique_validation_without_index.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/unknown_env.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/unknown_env.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/unknown_env.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/unknown_env.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/unused_ignored_columns.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/unused_ignored_columns.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/unused_ignored_columns.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/validation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/validation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/validation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/validation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/where_equals.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/where_equals.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/where_equals.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/where_equals.rb index 515d4db25f..8dfb79120b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/where_equals.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/where_equals.rb @@ -6,6 +6,10 @@ module RuboCop # This cop identifies places where manually constructed SQL # in `where` can be replaced with `where(attribute: value)`. # + # @safety + # This cop's autocorrection is unsafe because is may change SQL. + # See: https://github.com/rubocop/rubocop-rails/issues/403 + # # @example # # bad # User.where('name = ?', 'Gabe') diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/where_exists.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/where_exists.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/where_exists.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/where_exists.rb index fb4146430c..71d33ff62d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/where_exists.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/where_exists.rb @@ -11,16 +11,17 @@ module RuboCop # When EnforcedStyle is 'where' then the cop enforces # `where(...).exists?` over `exists?(...)`. # - # This cop is unsafe for auto-correction because the behavior may change on the following case: + # @safety + # This cop is unsafe for auto-correction because the behavior may change on the following case: # - # [source,ruby] - # ---- - # Author.includes(:articles).where(articles: {id: id}).exists? - # #=> Perform `eager_load` behavior (`LEFT JOIN` query) and get result. + # [source,ruby] + # ---- + # Author.includes(:articles).where(articles: {id: id}).exists? + # #=> Perform `eager_load` behavior (`LEFT JOIN` query) and get result. # - # Author.includes(:articles).exists?(articles: {id: id}) - # #=> Perform `preload` behavior and `ActiveRecord::StatementInvalid` error occurs. - # ---- + # Author.includes(:articles).exists?(articles: {id: id}) + # #=> Perform `preload` behavior and `ActiveRecord::StatementInvalid` error occurs. + # ---- # # @example EnforcedStyle: exists (default) # # bad diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails/where_not.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/cop/rails/where_not.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails/where_not.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails_cops.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails_cops.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails_cops.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails_cops.rb index 7c00103b00..52042d81df 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/cop/rails_cops.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/cop/rails_cops.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative 'mixin/active_record_helper' +require_relative 'mixin/active_record_migrations_helper' require_relative 'mixin/enforce_superclass' require_relative 'mixin/index_method' require_relative 'mixin/target_rails_version' @@ -22,12 +23,14 @@ require_relative 'rails/attribute_default_block_value' require_relative 'rails/belongs_to' require_relative 'rails/blank' require_relative 'rails/bulk_change_table' +require_relative 'rails/compact_blank' require_relative 'rails/content_tag' require_relative 'rails/create_table_with_timestamps' require_relative 'rails/date' require_relative 'rails/default_scope' require_relative 'rails/delegate' require_relative 'rails/delegate_allow_blank' +require_relative 'rails/duration_arithmetic' require_relative 'rails/dynamic_find_by' require_relative 'rails/eager_evaluation_log_message' require_relative 'rails/enum_hash' @@ -71,6 +74,7 @@ require_relative 'rails/rake_environment' require_relative 'rails/read_write_attribute' require_relative 'rails/redundant_allow_nil' require_relative 'rails/redundant_foreign_key' +require_relative 'rails/redundant_presence_validation_on_belongs_to' require_relative 'rails/redundant_receiver_in_with_options' require_relative 'rails/redundant_travel_back' require_relative 'rails/reflection_class_name' @@ -82,9 +86,11 @@ require_relative 'rails/request_referer' 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/safe_navigation' require_relative 'rails/safe_navigation_with_blank' require_relative 'rails/save_bang' +require_relative 'rails/schema_comment' require_relative 'rails/scope_args' require_relative 'rails/short_i18n' require_relative 'rails/skips_model_validations' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails/inject.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails/inject.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails/inject.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails/inject.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails/schema_loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails/schema_loader.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails/schema_loader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails/schema_loader.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails/schema_loader/schema.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4/lib/rubocop/rails/schema_loader/schema.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails/schema_loader/schema.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails/version.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.0/lib/rubocop/rails/version.rb index bbeb58e65c..14f2158be3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.12.4/lib/rubocop/rails/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/rubocop-rails-2.13.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.12.4' + STRING = '2.13.0' def self.document_version STRING.match('\d+\.\d+').to_s