From 4d79dcdd2dbe0b74e9a01af51c03636809ac78dc Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 2 Apr 2026 13:07:28 +1100 Subject: [PATCH] Regenerate rubocop todo I made quite a few changes here to appease Rubocop, good changes. But there were some indentation suggestions which would make reading the code harder. One example: ``` --- a/app/models/spree/taxon.rb +++ b/app/models/spree/taxon.rb @@ -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 ``` Ideally, we wouldn't mix multi-line method chains with blocks as argument. So I added this to the todo file for now. --- .rubocop_todo.yml | 45 ++++++++++++++++++++++----------------- app/models/spree/taxon.rb | 4 ++-- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 130d414236..7ccb3c4e31 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,11 +1,26 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400 --no-auto-gen-timestamp` -# using RuboCop version 1.81.7. +# using RuboCop version 1.86.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns. +# SupportedStylesAlignWith: start_of_line, relative_to_receiver +Layout/IndentationWidth: + Exclude: + - 'app/models/spree/taxon.rb' + - 'app/services/dfc_catalog_importer.rb' + - 'lib/reporting/reports/customers/base.rb' + - 'lib/reporting/reports/enterprise_fee_summary/enterprise_fees_with_tax_report_by_order.rb' + - 'spec/models/spree/order/state_machine_spec.rb' + - 'spec/services/orders/compare_invoice_service_spec.rb' + - 'spec/system/admin/bulk_order_management_spec.rb' + - 'spec/system/consumer/checkout/payment_spec.rb' + # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: RequireParenthesesForMethodChains. @@ -35,6 +50,7 @@ Lint/UselessConstantScoping: - 'lib/reporting/report_metadata_builder.rb' # Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). Lint/UselessOr: Exclude: - 'app/models/product_import/entry_validator.rb' @@ -62,14 +78,13 @@ Metrics/AbcSize: - 'lib/spree/core/controller_helpers/order.rb' - 'spec/services/orders/checkout_restart_service_spec.rb' -# Offense count: 9 +# Offense count: 7 # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # AllowedMethods: refine Metrics/BlockLength: Exclude: - 'app/models/spree/order/checkout.rb' - 'app/models/spree/payment.rb' - - 'app/models/spree/payment/processing.rb' - 'app/models/spree/shipment.rb' - 'lib/spree/core/controller_helpers/common.rb' - 'lib/tasks/data.rake' @@ -80,7 +95,7 @@ Metrics/BlockNesting: Exclude: - 'app/models/spree/payment/processing.rb' -# Offense count: 49 +# Offense count: 48 # Configuration parameters: CountComments, Max, CountAsOne. Metrics/ClassLength: Exclude: @@ -105,7 +120,6 @@ Metrics/ClassLength: - 'app/models/product_import/product_importer.rb' - 'app/models/spree/ability.rb' - 'app/models/spree/address.rb' - - 'app/models/spree/credit_card.rb' - 'app/models/spree/gateway/stripe_sca.rb' - 'app/models/spree/line_item.rb' - 'app/models/spree/order.rb' @@ -134,11 +148,12 @@ Metrics/ClassLength: - 'lib/reporting/reports/enterprise_fee_summary/scope.rb' - 'lib/reporting/reports/xero_invoices/base.rb' -# Offense count: 37 +# Offense count: 33 # Configuration parameters: AllowedMethods, AllowedPatterns, Max. Metrics/CyclomaticComplexity: Exclude: - 'app/controllers/admin/enterprises_controller.rb' + - 'app/controllers/concerns/respond_with.rb' - 'app/controllers/spree/admin/payments_controller.rb' - 'app/controllers/spree/orders_controller.rb' - 'app/helpers/checkout_helper.rb' @@ -159,16 +174,12 @@ Metrics/CyclomaticComplexity: - 'lib/open_food_network/enterprise_issue_validator.rb' - 'lib/reporting/reports/orders_and_fulfillment/order_cycle_customer_totals.rb' - 'lib/reporting/reports/orders_and_fulfillment/order_cycle_supplier_totals.rb' - - 'lib/reporting/reports/payments/itemised_payment_totals.rb' - - 'lib/reporting/reports/payments/payment_totals.rb' - - 'lib/reporting/reports/sales_tax/sales_tax_totals_by_producer.rb' - 'lib/reporting/reports/xero_invoices/base.rb' - 'lib/spree/core/controller_helpers/order.rb' - - 'lib/spree/core/controller_helpers/respond_with.rb' - 'lib/spree/localized_number.rb' - 'spec/models/product_importer_spec.rb' -# Offense count: 22 +# Offense count: 20 # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Exclude: @@ -178,7 +189,6 @@ Metrics/MethodLength: - 'app/models/spree/ability.rb' - 'app/models/spree/gateway/pay_pal_express.rb' - 'app/models/spree/order/checkout.rb' - - 'app/models/spree/payment/processing.rb' - 'app/models/spree/preferences/preferable_class_methods.rb' - 'lib/open_food_network/order_cycle_form_applicator.rb' - 'lib/open_food_network/order_cycle_permissions.rb' @@ -187,12 +197,11 @@ Metrics/MethodLength: - 'lib/spree/localized_number.rb' - 'lib/tasks/sample_data/product_factory.rb' -# Offense count: 10 +# Offense count: 9 # Configuration parameters: CountComments, Max, CountAsOne. Metrics/ModuleLength: Exclude: - 'app/helpers/admin/injection_helper.rb' - - 'app/helpers/checkout_helper.rb' - 'app/helpers/injection_helper.rb' - 'app/helpers/spree/admin/base_helper.rb' - 'app/helpers/spree/admin/navigation_helper.rb' @@ -238,7 +247,7 @@ Naming/MethodParameterName: # Offense count: 60 # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates. # AllowedMethods: call -# WaywardPredicates: nonzero? +# WaywardPredicates: infinite?, nonzero? Naming/PredicateMethod: Exclude: - 'app/controllers/admin/product_import_controller.rb' @@ -336,16 +345,14 @@ Rails/OrderArguments: - 'spec/services/orders/generate_invoice_service_spec.rb' - 'spec/system/admin/order_cycles/simple_spec.rb' -# Offense count: 3 +# Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Rails/Presence: Exclude: - - 'app/controllers/admin/enterprises_controller.rb' - 'app/models/spree/product.rb' # Offense count: 6 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Severity. Rails/RedirectBackOrTo: Exclude: - 'app/controllers/admin/order_cycles_controller.rb' @@ -373,7 +380,7 @@ Style/BitwisePredicate: Exclude: - 'app/helpers/admin/enterprises_helper.rb' -# Offense count: 23 +# Offense count: 22 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules. # SupportedStyles: nested, compact diff --git a/app/models/spree/taxon.rb b/app/models/spree/taxon.rb index a663a05922..09c772fdf0 100644 --- a/app/models/spree/taxon.rb +++ b/app/models/spree/taxon.rb @@ -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