diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3a3a852f27..d8b0f45ccc 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -668,16 +668,6 @@ Rails/LexicallyScopedActionFilter: - 'app/controllers/spree/admin/zones_controller.rb' - 'app/controllers/spree/users_controller.rb' -# Offense count: 5 -# This cop supports unsafe autocorrection (--autocorrect-all). -Rails/NegateInclude: - Exclude: - - 'app/controllers/admin/resource_controller.rb' - - 'app/models/calculator/weight.rb' - - 'app/models/product_import/spreadsheet_entry.rb' - - 'lib/spree/localized_number.rb' - - 'spec/support/matchers/table_matchers.rb' - # Offense count: 32 # This cop supports unsafe autocorrection (--autocorrect-all). Rails/Pluck: diff --git a/app/controllers/admin/resource_controller.rb b/app/controllers/admin/resource_controller.rb index b7764d7d50..b47336f0d1 100644 --- a/app/controllers/admin/resource_controller.rb +++ b/app/controllers/admin/resource_controller.rb @@ -229,7 +229,7 @@ module Admin end def member_action? - !collection_actions.include? action + collection_actions.exclude? action end def new_actions diff --git a/app/models/calculator/weight.rb b/app/models/calculator/weight.rb index c4b6534ef8..4fdebf72d3 100644 --- a/app/models/calculator/weight.rb +++ b/app/models/calculator/weight.rb @@ -10,7 +10,7 @@ module Calculator end def set_preference(name, value) - if name == :unit_from_list && !["kg", "lb"].include?(value) + if name == :unit_from_list && ["kg", "lb"].exclude?(value) calculable.errors.add(:preferred_unit_from_list, I18n.t(:calculator_preferred_unit_error)) else __send__ self.class.preference_setter_method(name), value diff --git a/app/models/product_import/spreadsheet_entry.rb b/app/models/product_import/spreadsheet_entry.rb index 2dd9a42418..a46d061ee7 100644 --- a/app/models/product_import/spreadsheet_entry.rb +++ b/app/models/product_import/spreadsheet_entry.rb @@ -94,7 +94,7 @@ module ProductImport units = UnitConverter.new(attrs) units.converted_attributes.each do |attr, value| - if respond_to?("#{attr}=") && !NON_PRODUCT_ATTRIBUTES.include?(attr) + if respond_to?("#{attr}=") && NON_PRODUCT_ATTRIBUTES.exclude?(attr) public_send("#{attr}=", value) end end diff --git a/lib/spree/localized_number.rb b/lib/spree/localized_number.rb index 112fb26471..11e572c1a8 100644 --- a/lib/spree/localized_number.rb +++ b/lib/spree/localized_number.rb @@ -77,7 +77,7 @@ module Spree private def non_activerecord_attribute?(attribute) - table_exists? && !column_names.include?(attribute.to_s) + table_exists? && column_names.exclude?(attribute.to_s) rescue ::ActiveRecord::NoDatabaseError # This class is now loaded during `rake db:create` (since Rails 5.2), and not only does the # table not exist, but the database does not even exist yet, and throws a fatal error. diff --git a/spec/support/matchers/table_matchers.rb b/spec/support/matchers/table_matchers.rb index aaee09ed83..1cf1f0deba 100644 --- a/spec/support/matchers/table_matchers.rb +++ b/spec/support/matchers/table_matchers.rb @@ -8,7 +8,7 @@ RSpec::Matchers.define :have_table_row do |row| match_when_negated do |node| @row = row - !rows_under(node).include? row # Robust check of columns + rows_under(node).exclude? row # Robust check of columns end failure_message do |text|