mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #12363 from cyrillefr/FixRailsWhereExistsOffenses
Fix Rails/WhereExists rubocop offenses
This commit is contained in:
@@ -124,6 +124,9 @@ Rails/SkipsModelValidations:
|
||||
- update_column
|
||||
- update_columns
|
||||
|
||||
Rails/WhereExists:
|
||||
EnforcedStyle: where # Cf. conversion https://github.com/openfoodfoundation/openfoodnetwork/pull/12363
|
||||
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
|
||||
@@ -773,21 +773,6 @@ Rails/UnusedRenderContent:
|
||||
- 'app/controllers/api/v0/taxons_controller.rb'
|
||||
- 'app/controllers/api/v0/variants_controller.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: exists, where
|
||||
Rails/WhereExists:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/overview_controller.rb'
|
||||
- 'app/controllers/spree/admin/tax_rates_controller.rb'
|
||||
- 'app/controllers/spree/user_sessions_controller.rb'
|
||||
- 'app/models/spree/preferences/store.rb'
|
||||
- 'lib/tasks/sample_data/customer_factory.rb'
|
||||
- 'lib/tasks/sample_data/group_factory.rb'
|
||||
- 'lib/tasks/sample_data/order_cycle_factory.rb'
|
||||
- 'lib/tasks/sample_data/taxon_factory.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Security/Open:
|
||||
Exclude:
|
||||
|
||||
@@ -152,7 +152,7 @@ module Spree
|
||||
end
|
||||
|
||||
def default_missing?
|
||||
!user.credit_cards.exists?(is_default: true)
|
||||
!user.credit_cards.where(is_default: true).exists?
|
||||
end
|
||||
|
||||
def default_card_needs_updating?
|
||||
|
||||
@@ -694,7 +694,7 @@ module Spree
|
||||
end
|
||||
|
||||
def registered_email?
|
||||
Spree::User.exists?(email:)
|
||||
Spree::User.where(email:).exists?
|
||||
end
|
||||
|
||||
def adjustments_fetcher
|
||||
|
||||
@@ -246,7 +246,7 @@ module Spree
|
||||
# and this is it. Related to #1998.
|
||||
# See https://github.com/spree/spree/issues/1998#issuecomment-12869105
|
||||
def set_unique_identifier
|
||||
self.identifier = generate_identifier while self.class.exists?(identifier:)
|
||||
self.identifier = generate_identifier while self.class.where(identifier:).exists?
|
||||
end
|
||||
|
||||
def generate_identifier
|
||||
|
||||
@@ -66,8 +66,8 @@ module Reporting
|
||||
|
||||
enterprise_fee_id = arg.first
|
||||
|
||||
EnterpriseFee.exists?(id: enterprise_fee_id,
|
||||
enterprise_id: ransack_params[:enterprise_fee_owner_id_in] )
|
||||
EnterpriseFee.where(id: enterprise_fee_id,
|
||||
enterprise_id: ransack_params[:enterprise_fee_owner_id_in] ).exists?
|
||||
end
|
||||
|
||||
def filter_enterprise_fee_by_id_active?
|
||||
|
||||
Reference in New Issue
Block a user