mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-03 02:21:33 +00:00
Merge pull request #12589 from cyrillefr/FixRailsRedundantActiveRecordAllMethodIssue
Fixes Rails/RedundantActiveRecordAllMethod issues
This commit is contained in:
@@ -115,6 +115,11 @@ Rails/OutputSafety:
|
||||
Exclude:
|
||||
- spec/**/*
|
||||
|
||||
Rails/RedundantActiveRecordAllMethod:
|
||||
AllowedReceivers:
|
||||
- ActionMailer::Preview
|
||||
- ActiveSupport::TimeZone
|
||||
|
||||
Rails/SkipsModelValidations:
|
||||
AllowedMethods:
|
||||
- touch
|
||||
|
||||
@@ -654,17 +654,6 @@ Rails/PluckInWhere:
|
||||
Exclude:
|
||||
- 'app/models/spree/variant.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowedReceivers.
|
||||
# AllowedReceivers: ActionMailer::Preview, ActiveSupport::TimeZone
|
||||
Rails/RedundantActiveRecordAllMethod:
|
||||
Exclude:
|
||||
- 'app/models/spree/tax_rate.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/spree/variant.rb'
|
||||
- 'spec/system/admin/product_import_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Rails/RelativeDateConstant:
|
||||
|
||||
@@ -31,7 +31,7 @@ module Spree
|
||||
return [] if order.distributor && !order.distributor.charges_sales_tax
|
||||
return [] unless order.tax_zone
|
||||
|
||||
all.includes(zone: { zone_members: :zoneable }).load.select do |rate|
|
||||
includes(zone: { zone_members: :zoneable }).load.select do |rate|
|
||||
rate.potentially_applicable?(order.tax_zone)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ module Spree
|
||||
end
|
||||
|
||||
def build_enterprise_roles
|
||||
Enterprise.all.find_each do |enterprise|
|
||||
Enterprise.find_each do |enterprise|
|
||||
unless enterprise_roles.find_by enterprise_id: enterprise.id
|
||||
enterprise_roles.build(enterprise:)
|
||||
end
|
||||
|
||||
@@ -238,7 +238,7 @@ module Spree
|
||||
end
|
||||
|
||||
def create_stock_items
|
||||
StockLocation.all.find_each do |stock_location|
|
||||
StockLocation.find_each do |stock_location|
|
||||
stock_location.propagate_variant(self)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,7 +51,7 @@ RSpec.describe "Product Import" do
|
||||
count_on_hand: 96)
|
||||
}
|
||||
|
||||
let(:shipping_category_id_str) { Spree::ShippingCategory.all.first.id.to_s }
|
||||
let(:shipping_category_id_str) { Spree::ShippingCategory.first.id.to_s }
|
||||
|
||||
describe "when importing products from uploaded file" do
|
||||
before do
|
||||
|
||||
Reference in New Issue
Block a user