From dce02160d4f9464887664cdaf4332fcc5e7ec3f5 Mon Sep 17 00:00:00 2001 From: Neal Chambers Date: Fri, 21 Jul 2023 22:41:57 +0900 Subject: [PATCH] Safely autocorrect Layout/HashAlignment Inspecting 1478 files ...................................................................................................................................................C.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C......................................................................................................................................................................................................................................................C......................CC....................C...................................................... Offenses: app/controllers/spree/users_controller.rb:53:19: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ app/controllers/spree/users_controller.rb:53:101: C: Layout/LineLength: Line is too long. [107/100] message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) ^^^^^^^ spec/models/enterprise_spec.rb:906:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. permissions: [permission]) ^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/customers_spec.rb:19:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. code: nil, created_manually: true) ^^^^^^^^^ spec/system/admin/order_spec.rb:708:1: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. distributors: [distributor1]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:45:4: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. distributors: [distributor4, distributor5]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:249:9: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. line_items_count: 0) ^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:254:9: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. line_items_count: 1) ^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:259:9: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. distributor: distributor2, bill_address_id: nil, ship_address_id: nil) ^^^^^^^^^^^^^^^^^^^^^^^^^ spec/system/admin/orders_spec.rb:259:101: C: Layout/LineLength: Line is too long. [109/100] distributor: distributor2, bill_address_id: nil, ship_address_id: nil) ^^^^^^^^^ spec/system/admin/tag_rules_spec.rb:145:37: C: [Corrected] Layout/HashAlignment: Align the keys of a hash literal if they span more than one line. count: 4 ^^^^^^^^ 1478 files inspected, 11 offenses detected, 9 offenses corrected --- .rubocop_todo.yml | 15 --------------- app/controllers/spree/users_controller.rb | 2 +- spec/models/enterprise_spec.rb | 2 +- spec/system/admin/customers_spec.rb | 2 +- spec/system/admin/order_spec.rb | 2 +- spec/system/admin/orders_spec.rb | 8 ++++---- spec/system/admin/tag_rules_spec.rb | 2 +- 7 files changed, 9 insertions(+), 24 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index bd7e8d2bdd..2b63b15cb8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,21 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 9 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. -# SupportedHashRocketStyles: key, separator, table -# SupportedColonStyles: key, separator, table -# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit -Layout/HashAlignment: - Exclude: - - 'app/controllers/spree/users_controller.rb' - - 'spec/models/enterprise_spec.rb' - - 'spec/system/admin/customers_spec.rb' - - 'spec/system/admin/order_spec.rb' - - 'spec/system/admin/orders_spec.rb' - - 'spec/system/admin/tag_rules_spec.rb' - # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/app/controllers/spree/users_controller.rb b/app/controllers/spree/users_controller.rb index cba00ac922..4637dc5b12 100644 --- a/app/controllers/spree/users_controller.rb +++ b/app/controllers/spree/users_controller.rb @@ -50,7 +50,7 @@ module Spree "#signup-feedback", partial("layouts/alert", locals: { type: "success", - message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) + message: t('devise.user_registrations.spree_user.signed_up_but_unconfirmed') }) ) else render status: :unprocessable_entity, cable_ready: cable_car.morph( diff --git a/spec/models/enterprise_spec.rb b/spec/models/enterprise_spec.rb index fbe15221d5..a53c1b5ff9 100644 --- a/spec/models/enterprise_spec.rb +++ b/spec/models/enterprise_spec.rb @@ -903,7 +903,7 @@ describe Enterprise do distributor = create(:distributor_enterprise, is_primary_producer: false) permission = EnterpriseRelationshipPermission.create(name: "add_to_order_cycle") create(:enterprise_relationship, parent: distributor, child: supplier, -permissions: [permission]) + permissions: [permission]) product = create(:product) order_cycle = create( :simple_order_cycle, diff --git a/spec/system/admin/customers_spec.rb b/spec/system/admin/customers_spec.rb index acdd9497c3..94599e3e57 100644 --- a/spec/system/admin/customers_spec.rb +++ b/spec/system/admin/customers_spec.rb @@ -16,7 +16,7 @@ describe 'Customers' do describe "using the customers index" do let!(:customer1) { create(:customer, first_name: 'John', last_name: 'Doe', enterprise: managed_distributor1, -code: nil, created_manually: true) + code: nil, created_manually: true) } let!(:customer2) { create(:customer, enterprise: managed_distributor1, created_manually: true, code: nil) diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index c64b13e1bb..6c0cb60835 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -705,7 +705,7 @@ describe ' context "with different shipping methods" do let!(:different_shipping_method_for_distributor1) do create(:shipping_method_with, :flat_rate, name: "Different", amount: 15, -distributors: [distributor1]) + distributors: [distributor1]) end let!(:shipping_method_for_distributor2) do create(:shipping_method, name: "Other", distributors: [distributor2]) diff --git a/spec/system/admin/orders_spec.rb b/spec/system/admin/orders_spec.rb index cf6f31cd29..f6a0883953 100644 --- a/spec/system/admin/orders_spec.rb +++ b/spec/system/admin/orders_spec.rb @@ -42,7 +42,7 @@ describe ' } let!(:shipping_method2) { create(:shipping_method_with, :pickup, name: "delivery", - distributors: [distributor4, distributor5]) + distributors: [distributor4, distributor5]) } let(:order_cycle) do create(:simple_order_cycle, name: 'One', distributors: [distributor, distributor2, @@ -246,17 +246,17 @@ describe ' context "cart orders" do let!(:order_empty) { create(:order_with_line_items, user: customer2, distributor: distributor2, - line_items_count: 0) + line_items_count: 0) } let!(:order_not_empty) { create(:order_with_line_items, user: customer2, distributor: distributor2, - line_items_count: 1) + line_items_count: 1) } let!(:order_not_empty_no_address) { create(:order_with_line_items, line_items_count: 1, user: customer2, - distributor: distributor2, bill_address_id: nil, ship_address_id: nil) + distributor: distributor2, bill_address_id: nil, ship_address_id: nil) } before do diff --git a/spec/system/admin/tag_rules_spec.rb b/spec/system/admin/tag_rules_spec.rb index 788911f41e..01ad0741ee 100644 --- a/spec/system/admin/tag_rules_spec.rb +++ b/spec/system/admin/tag_rules_spec.rb @@ -142,7 +142,7 @@ describe 'Tag Rules' do it "saves changes to rules of each type" do # Tag groups exist expect(page).to have_selector '.customer_tag .header', text: "For customers tagged:", - count: 4 + count: 4 expect(page).to have_selector '.customer_tag .header tags-input .tag-list ti-tag-item', text: "member", count: 1 expect(page).to have_selector '.customer_tag .header tags-input .tag-list ti-tag-item',