Skip to content

Commit f991e63

Browse files
committed
Update RuboCop Configuration and lint code
Updated the .rubocop_todo.yml file to reflect the latest RuboCop version and adjusted exclusions for various cops. Added files with lint changes.
1 parent b5e3466 commit f991e63

File tree

11 files changed

+51
-20
lines changed

11 files changed

+51
-20
lines changed

.rubocop_todo.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,61 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2020-09-23 14:11:08 UTC using RuboCop version 0.91.1.
3+
# on 2025-02-27 09:58:25 UTC using RuboCop version 1.73.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 3
10+
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
11+
# SupportedStyles: Gemfile, gems.rb, gemspec
12+
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
13+
Gemspec/DevelopmentDependencies:
14+
Exclude:
15+
- 'solidus_easypost.gemspec'
16+
917
# Offense count: 1
18+
Lint/DuplicateMethods:
19+
Exclude:
20+
- 'lib/solidus_easypost.rb'
21+
22+
# Offense count: 1
23+
# Configuration parameters: IgnoredMetadata.
1024
RSpec/DescribeClass:
1125
Exclude:
12-
- 'spec/features/**/*'
1326
- 'spec/integration/order_shipping_spec.rb'
1427

15-
# Offense count: 3
28+
# Offense count: 1
29+
RSpec/LetSetup:
30+
Exclude:
31+
- 'spec/controllers/spree/admin/postage_labels_controller_spec.rb'
32+
33+
# Offense count: 13
1634
RSpec/MultipleExpectations:
1735
Max: 3
1836

1937
# Offense count: 4
38+
# Configuration parameters: AllowSubject.
39+
RSpec/MultipleMemoizedHelpers:
40+
Max: 6
41+
42+
# Offense count: 3
2043
# Configuration parameters: EnforcedStyle.
2144
# SupportedStyles: scientific, engineering, integral
2245
Style/ExponentialNotation:
2346
Exclude:
2447
- 'spec/integration/checkout_spec.rb'
2548

2649
# Offense count: 1
50+
# Configuration parameters: AllowedMethods.
51+
# AllowedMethods: respond_to_missing?
2752
Style/OptionalBooleanParameter:
2853
Exclude:
2954
- 'lib/solidus_easypost/estimator.rb'
3055

31-
# Offense count: 3
32-
# Cop supports --auto-correct.
33-
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
56+
# Offense count: 2
57+
# This cop supports safe autocorrection (--autocorrect).
58+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
3459
# URISchemes: http, https
3560
Layout/LineLength:
36-
Max: 137
61+
Max: 130

lib/generators/solidus_easypost/install/install_generator.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def add_javascripts
2020
end
2121

2222
def run_migrations
23-
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
23+
run_migrations = options[:auto_run_migrations] || ['', 'y',
24+
'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
2425
if run_migrations
2526
run 'bin/rails db:migrate'
2627
else

lib/solidus_easypost/tracker_webhook_handler.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ def self.call(payload)
88
carton = ::Spree::Carton.find_by(easy_post_tracker_id: payload['result']['id'])
99
return unless carton
1010

11-
::SolidusSupport::LegacyEventCompat::Bus.publish :'solidus_easypost.tracker.updated', carton: carton, payload: payload
11+
::SolidusSupport::LegacyEventCompat::Bus.publish :'solidus_easypost.tracker.updated', carton: carton,
12+
payload: payload
1213
end
1314
end
1415
end

spec/controllers/spree/admin/postage_labels_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
let(:shipment) { order.shipments.first }
66

77
let!(:easypost_setup) do
8-
easypost_config_setup(true)
8+
easypost_config_setup(purchase_labels: true)
99
end
1010

1111
before do

spec/features/admin/postage_labels_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22

3+
# rubocop:disable RSpec/DescribeClass
34
RSpec.describe 'Postage labels' do
45
stub_authorization!
56

@@ -16,3 +17,4 @@
1617
expect(page).to have_content(I18n.t('spree.open_postage_label'))
1718
end
1819
end
20+
# rubocop:enable RSpec/DescribeClass

spec/integration/checkout_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
RSpec.describe 'Checkout' do
22
it 'retrieves the rates from EasyPost', vcr: { cassette_name: 'integration/checkout' } do
3-
easypost_config_setup(true)
3+
easypost_config_setup(purchase_labels: true)
44

55
order = Spree::TestingSupport::OrderWalkthrough.up_to(:complete)
66
shipment = order.shipments.first

spec/integration/order_shipping_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
RSpec.describe 'Order shipping' do
2-
context 'with purchase_labels set to true', vcr: { cassette_name: 'integration/order_shipping/with_purchase_labels' } do
2+
context 'with purchase_labels set to true',
3+
vcr: { cassette_name: 'integration/order_shipping/with_purchase_labels' } do
34
it 'buys the rate in EasyPost' do
45
stub_easypost_config(purchase_labels: true)
56
stub_spree_preferences(require_payment_to_ship: false, track_inventory_levels: false)
@@ -15,7 +16,8 @@
1516
end
1617
end
1718

18-
context 'with purchase_labels set to false', vcr: { cassette_name: 'integration/order_shipping/without_purchase_labels' } do
19+
context 'with purchase_labels set to false',
20+
vcr: { cassette_name: 'integration/order_shipping/without_purchase_labels' } do
1921
it 'does not buy the rate in EasyPost' do
2022
stub_easypost_config(purchase_labels: false)
2123
stub_spree_preferences(require_payment_to_ship: false, track_inventory_levels: false)

spec/models/spree/shipment_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
context 'when a shipping rate was selected' do
2020
it 'returns the shipment associated with the shipping rate' do
2121
VCR.use_cassette('shipment/return_easypost_shipment') do
22-
easypost_config_setup(true)
22+
easypost_config_setup(purchase_labels: true)
2323
expect(shipment.easypost_shipment).to be_present
2424
end
2525
end
@@ -30,7 +30,7 @@
3030
context 'when purchase_labels is true' do
3131
it 'buys the selected rate' do
3232
VCR.use_cassette('shipment/with_selected_shipping_rates') do
33-
easypost_config_setup(true)
33+
easypost_config_setup(purchase_labels: true)
3434
shipment.ship!
3535
expect(shipment.easypost_shipment).to be_present
3636
expect(shipment.shipping_rates.where(selected: true).count).to eq(1)
@@ -41,7 +41,7 @@
4141
context 'when purchase_labels is false' do
4242
it 'does not buy rates automatically' do
4343
VCR.use_cassette('shipment/disabled_purchase_labels') do
44-
easypost_config_setup
44+
easypost_config_setup(purchase_labels: false)
4545
shipment.ship!
4646
selected_rate = shipment.shipping_rates.where(selected: true).last
4747
expect(shipment.easypost_shipment).to be_present

spec/solidus_easypost/shipping_method_selector_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
let(:selector) { described_class.new }
88

99
before do
10-
easypost_config_setup(true)
10+
easypost_config_setup(purchase_labels: true)
1111
end
1212

1313
describe '#shipping_method_for' do

spec/solidus_easypost/shipping_rate_calculator_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
let(:calculator) { described_class.new }
77

88
before do
9-
easypost_config_setup(true)
9+
easypost_config_setup(purchase_labels: true)
1010
end
1111

1212
it 'returns the amount on the EasyPost rate' do

0 commit comments

Comments
 (0)