Merge pull request #13930 from openfoodfoundation/dependabot/bundler/rubocop-1.84.1

Bump rubocop from 1.81.7 to 1.84.2
This commit is contained in:
Gaetan Craig-Riou
2026-02-20 09:05:41 +11:00
committed by GitHub
23 changed files with 64 additions and 65 deletions

View File

@@ -440,7 +440,7 @@ GEM
thor (>= 0.14, < 2.0)
jquery-ui-rails (4.2.1)
railties (>= 3.2.16)
json (2.15.2)
json (2.18.1)
json-canonicalization (1.0.0)
json-jwt (1.17.0)
activesupport (>= 4.2)
@@ -573,7 +573,7 @@ GEM
parallel (1.27.0)
paranoia (2.6.4)
activerecord (>= 5.1, < 7.2)
parser (3.3.10.1)
parser (3.3.10.2)
ast (~> 2.4.1)
racc
paypal-sdk-core (0.3.4)
@@ -772,7 +772,7 @@ GEM
rswag-ui (2.17.0)
actionpack (>= 5.2, < 8.2)
railties (>= 5.2, < 8.2)
rubocop (1.81.7)
rubocop (1.84.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
@@ -780,7 +780,7 @@ GEM
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.47.1, < 2.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)

View File

@@ -251,7 +251,7 @@ module Spree
transaction do
ExchangeVariant.
where(exchange_variants: { variant_id: variants.with_deleted.
select(:id) }).destroy_all
select(:id) }).destroy_all
yield
end

View File

@@ -35,8 +35,8 @@ module Spree
taxons
.pluck('spree_taxons.id, enterprises.id AS enterprise_id')
.each_with_object({}) do |(taxon_id, enterprise_id), collection|
collection[enterprise_id.to_i] ||= Set.new
collection[enterprise_id.to_i] << taxon_id
collection[enterprise_id.to_i] ||= Set.new
collection[enterprise_id.to_i] << taxon_id
end
end

View File

@@ -167,8 +167,8 @@ module Spree
# In Rails 3, merging two scopes on the same column will consider only the last scope.
def self.in_distributor(distributor)
where(id: ExchangeVariant.select(:variant_id).
joins(:exchange).
where('exchanges.incoming = ? AND exchanges.receiver_id = ?', false, distributor))
joins(:exchange).
where('exchanges.incoming = ? AND exchanges.receiver_id = ?', false, distributor))
end
def self.indexed
@@ -179,11 +179,11 @@ module Spree
# "where(id:" is necessary so that the returned relation has no includes
# The relation without includes will not be readonly and allow updates on it
where(spree_variants: { id: joins(:prices).
where(deleted_at: nil).
where('spree_prices.currency' =>
where(deleted_at: nil).
where('spree_prices.currency' =>
currency || CurrentConfig.get(:currency)).
where.not(spree_prices: { amount: nil }).
select("spree_variants.id") })
where.not(spree_prices: { amount: nil }).
select("spree_variants.id") })
end
def self.linked_to(semantic_id)

View File

@@ -60,8 +60,8 @@ class ProductScopeQuery
def product_query_includes
[
image: { attachment_attachment: :blob },
variants: [:default_price, :stock_items, :variant_overrides]
{ image: { attachment_attachment: :blob },
variants: [:default_price, :stock_items, :variant_overrides] }
]
end

View File

@@ -42,10 +42,10 @@ class DfcCatalogImporter
.includes(:semantic_links).references(:semantic_links)
.where.not(semantic_links: { semantic_id: present_ids })
.select do |variant|
# Variants that were in the same catalog before:
variant.semantic_links.map(&:semantic_id).any? do |semantic_id|
FdcUrlBuilder.new(semantic_id).catalog_url == catalog_url
end
# Variants that were in the same catalog before:
variant.semantic_links.map(&:semantic_id).any? do |semantic_id|
FdcUrlBuilder.new(semantic_id).catalog_url == catalog_url
end
end
end
end

View File

@@ -51,8 +51,8 @@ class LineItemSyncer
def destroy_obsolete_items(order)
order.line_items.
where(variant_id: subscription_line_items.
select(&:marked_for_destruction?).
map(&:variant_id)).
select(&:marked_for_destruction?).
map(&:variant_id)).
destroy_all
end

View File

@@ -130,12 +130,11 @@ module Orders
def order_cycle_fees
return @order_cycle_fees if defined? @order_cycle_fees
return [] unless order_cycle && distributor
@order_cycle_fees = begin
fees = []
return fees unless order_cycle && distributor
order_cycle.exchanges.supplying_to(distributor).each do |exchange|
exchange.enterprise_fees.per_item.each do |enterprise_fee|
fee_value = FeeValue.new(fee: enterprise_fee, role: exchange.role)

View File

@@ -14,12 +14,12 @@ module PermittedAttributes
def self.attributes
basic_permitted_attributes + [
group_ids: [], user_ids: [],
shipping_method_ids: [], payment_method_ids: [],
address_attributes: PermittedAttributes::Address.attributes,
business_address_attributes: PermittedAttributes::BusinessAddress.attributes,
producer_properties_attributes: [:id, :property_name, :value, :_destroy],
custom_tab_attributes: PermittedAttributes::CustomTab.attributes,
{ group_ids: [], user_ids: [],
shipping_method_ids: [], payment_method_ids: [],
address_attributes: PermittedAttributes::Address.attributes,
business_address_attributes: PermittedAttributes::BusinessAddress.attributes,
producer_properties_attributes: [:id, :property_name, :value, :_destroy],
custom_tab_attributes: PermittedAttributes::CustomTab.attributes },
]
end

View File

@@ -25,8 +25,8 @@ module PermittedAttributes
private
def attributes
self.class.basic_attributes + [incoming_exchanges: permitted_exchange_attributes,
outgoing_exchanges: permitted_exchange_attributes]
self.class.basic_attributes + [{ incoming_exchanges: permitted_exchange_attributes,
outgoing_exchanges: permitted_exchange_attributes }]
end
def permitted_exchange_attributes

View File

@@ -26,11 +26,11 @@ module PermittedAttributes
def other_permitted_attributes
[
subscription_line_items_attributes: [
:id, :quantity, :variant_id, :price_estimate, :_destroy
],
bill_address_attributes: PermittedAttributes::Address.attributes,
ship_address_attributes: PermittedAttributes::Address.attributes
{ subscription_line_items_attributes: [
:id, :quantity, :variant_id, :price_estimate, :_destroy
],
bill_address_attributes: PermittedAttributes::Address.attributes,
ship_address_attributes: PermittedAttributes::Address.attributes }
]
end
end

View File

@@ -36,7 +36,7 @@ RSpec.describe "CatalogItems", swagger_doc: "dfc.yaml" do
get "List CatalogItems" do
produces "application/json"
security [oidc_token: []]
security [{ oidc_token: [] }]
response "404", "not found" do
context "as platform user" do

View File

@@ -35,7 +35,7 @@ RSpec.describe "ProductGroups", swagger_doc: "dfc.yaml" do
get "Show ProductGroup" do
produces "application/json"
security [oidc_token: []]
security [{ oidc_token: [] }]
response "200", "success" do
let(:id) { product.id }

View File

@@ -15,7 +15,7 @@ module Reporting
@orders ||= search_orders
end
def list(line_item_includes = [variant: [:supplier, :product]])
def list(line_item_includes = [{ variant: [:supplier, :product] }])
line_items = order_permissions.visible_line_items.in_orders(orders.result)
.order(
"supplier.name",

View File

@@ -10,10 +10,10 @@ module Reporting
.complete.not_state(:canceled)
.order(:id))
.group_by do |order|
{
customer_id: order.customer_id || order.email,
hub_id: order.distributor_id,
}
{
customer_id: order.customer_id || order.email,
hub_id: order.distributor_id,
}
end.values
end

View File

@@ -44,11 +44,11 @@ module Reporting
.filter(&method(:filter_enterprise_fee_by_id))
.filter(&method(:filter_enterprise_fee_by_owner))
.map do |enterprise_fee_id, enterprise_fee_adjustment_ids|
{
enterprise_fee_id:,
enterprise_fee_adjustment_ids:,
order:
}
{
enterprise_fee_id:,
enterprise_fee_adjustment_ids:,
order:
}
end
end
end

View File

@@ -86,11 +86,11 @@ RSpec.describe Spree::Order do
(Spree::Shipment.state_machine.states.keys - [:pending, :backorder, :ready])
.each do |shipment_state|
it "should be false if shipment_state is #{shipment_state}" do
allow(order).to receive_messages completed?: true
order.shipment_state = shipment_state
expect(order.can_cancel?).to be_falsy
end
it "should be false if shipment_state is #{shipment_state}" do
allow(order).to receive_messages completed?: true
order.shipment_state = shipment_state
expect(order.can_cancel?).to be_falsy
end
end
end

View File

@@ -17,7 +17,7 @@ RSpec.describe Spree::User do
bill_address_attributes: new_bill_address.dup.attributes.merge(
'id' => old_bill_address.id
)
.except!('created_at', 'updated_at')
.except!('created_at', 'updated_at')
)
expect(user.bill_address.id).to eq old_bill_address.id

View File

@@ -10,7 +10,7 @@ RSpec.describe OutstandingBalanceQuery do
let(:normalized_sql_statement) { normalize(query.statement) }
it 'returns the CASE statement necessary to compute the order balance' do
expect(normalized_sql_statement).to eq(normalize(<<-SQL.squish))
expect(normalized_sql_statement).to eq(normalize(<<~SQL.squish))
CASE WHEN "spree_orders"."state" IN ('canceled', 'returned') THEN "spree_orders"."payment_total"
WHEN "spree_orders"."state" IS NOT NULL THEN "spree_orders"."payment_total" - "spree_orders"."total"
ELSE 0 END

View File

@@ -38,8 +38,8 @@ RSpec.shared_examples "attribute changes - tax total changes" do |boolean, type,
create(:order_with_taxes, product_price: 110, tax_rate_amount: 0.1,
included_in_price: included_boolean)
.tap do |order|
order.create_tax_charge!
order.update_shipping_fees!
order.create_tax_charge!
order.update_shipping_fees!
end
end

View File

@@ -144,7 +144,7 @@ module StripeStubs
customer_id = options[:customer_id] || "cus_A123"
{ status: 200,
body: JSON.generate(id: customer_id,
sources: { data: [id: customer_id] }) }
sources: { data: [{ id: customer_id }] }) }
end
def payment_successful_refund_mock

View File

@@ -1044,10 +1044,10 @@ RSpec.describe '
page.driver
.dismiss_modal :confirm,
text: "Unsaved changes exist and will be lost if you continue." do
within "tr#li_#{li1.id}" do
fill_in "quantity", with: (li1.quantity + 1)
find("a.edit-order").click
end
within "tr#li_#{li1.id}" do
fill_in "quantity", with: (li1.quantity + 1)
find("a.edit-order").click
end
end
# So we save the changes

View File

@@ -360,10 +360,10 @@ RSpec.describe "As a consumer, I want to checkout my order" do
# And fake the payment status to avoid user interaction.
allow_any_instance_of(Taler::Client)
.to receive(:fetch_order) do
payment = Spree::Payment.last
url = payment_gateways_confirm_taler_path(payment_id: payment.id)
payment = Spree::Payment.last
url = payment_gateways_confirm_taler_path(payment_id: payment.id)
{ "order_status_url" => url, "order_status" => "paid" }
{ "order_status_url" => url, "order_status" => "paid" }
end
end