Safely autocorrect Style/RedundantConstantBase

Inspecting 1509 files
.........................................................................................................C.........................................C......................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.......................................................................................................................................................................................................................................................................................................................................................................................................................C.........................................................................................................................................................................CCC........................................C......................................................................................C......................................................................................................................................................................................................

Offenses:

app/controllers/split_checkout_controller.rb:5:33: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
class SplitCheckoutController < ::BaseController
                                ^^
app/controllers/webhook_endpoints_controller.rb:3:36: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
class WebhookEndpointsController < ::BaseController
                                   ^^
config.ru:5:9: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
require ::File.expand_path('config/environment', __dir__)
        ^^
spec/helpers/checkout_helper_spec.rb:168:68: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
      let!(:tax_rate) { create(:tax_rate, amount: 0.1, calculator: ::Calculator::DefaultTax.new) }
                                                                   ^^
spec/models/spree/order_spec.rb:619:25: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
    let(:fee_handler) { ::OrderFeesHandler.new(subject) }
                        ^^
spec/models/spree/payment_method_spec.rb:150:51: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
                                      calculator: ::Calculator::FlatRate.new(preferred_amount: 10))
                                                  ^^
spec/models/spree/payment_method_spec.rb:154:54: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
                                         calculator: ::Calculator::FlatPercentItemTotal
                                                     ^^
spec/models/spree/payment_spec.rb:429:49: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
            create(:payment_method, calculator: ::Calculator::FlatRate.new(preferred_amount: 10))
                                                ^^
spec/models/spree/payment_spec.rb:1002:11: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
          ::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10)
          ^^
spec/models/spree/payment_spec.rb:1039:28: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
        let(:calculator) { ::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) }
                           ^^
spec/queries/complete_visible_orders_spec.rb:12:31: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
    let(:order_permissions) { ::Permissions::Order.new(user, filter_canceled) }
                              ^^
spec/services/paypal_items_builder_spec.rb:34:37: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
                        calculator: ::Calculator::DefaultTax.new)
                                    ^^
spec/services/paypal_items_builder_spec.rb:38:37: C: [Corrected] Style/RedundantConstantBase: Remove redundant ::.
                        calculator: ::Calculator::DefaultTax.new)
                                    ^^

1509 files inspected, 13 offenses detected, 13 offenses corrected
This commit is contained in:
Neal Chambers
2023-11-09 09:40:29 +09:00
parent ef928aa6fe
commit c3b4781a28
10 changed files with 13 additions and 27 deletions

View File

@@ -923,20 +923,6 @@ Style/RedundantArgument:
- 'engines/dfc_provider/app/services/authorization_control.rb' - 'engines/dfc_provider/app/services/authorization_control.rb'
- 'spec/support/query_counter.rb' - 'spec/support/query_counter.rb'
# Offense count: 13
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantConstantBase:
Exclude:
- 'app/controllers/split_checkout_controller.rb'
- 'app/controllers/webhook_endpoints_controller.rb'
- 'config.ru'
- 'spec/helpers/checkout_helper_spec.rb'
- 'spec/models/spree/order_spec.rb'
- 'spec/models/spree/payment_method_spec.rb'
- 'spec/models/spree/payment_spec.rb'
- 'spec/queries/complete_visible_orders_spec.rb'
- 'spec/services/paypal_items_builder_spec.rb'
# Offense count: 1 # Offense count: 1
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
Style/RedundantDoubleSplatHashBraces: Style/RedundantDoubleSplatHashBraces:

View File

@@ -2,7 +2,7 @@
require 'open_food_network/address_finder' require 'open_food_network/address_finder'
class SplitCheckoutController < ::BaseController class SplitCheckoutController < BaseController
layout 'darkswarm' layout 'darkswarm'
include OrderStockCheck include OrderStockCheck

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class WebhookEndpointsController < ::BaseController class WebhookEndpointsController < BaseController
before_action :load_resource, only: :destroy before_action :load_resource, only: :destroy
def create def create

View File

@@ -2,5 +2,5 @@
# This file is used by Rack-based servers to start the application. # This file is used by Rack-based servers to start the application.
require ::File.expand_path('config/environment', __dir__) require File.expand_path('config/environment', __dir__)
run Openfoodnetwork::Application run Openfoodnetwork::Application

View File

@@ -165,7 +165,7 @@ describe CheckoutHelper, type: :helper do
end end
context "tax rate adjustments" do context "tax rate adjustments" do
let!(:tax_rate) { create(:tax_rate, amount: 0.1, calculator: ::Calculator::DefaultTax.new) } let!(:tax_rate) { create(:tax_rate, amount: 0.1, calculator: Calculator::DefaultTax.new) }
let!(:line_item_fee_adjustment) { let!(:line_item_fee_adjustment) {
create(:adjustment, originator: enterprise_fee, adjustable: order.line_items.first, create(:adjustment, originator: enterprise_fee, adjustable: order.line_items.first,
order:) order:)

View File

@@ -616,7 +616,7 @@ describe Spree::Order do
describe "applying enterprise fees" do describe "applying enterprise fees" do
subject { create(:order) } subject { create(:order) }
let(:fee_handler) { ::OrderFeesHandler.new(subject) } let(:fee_handler) { OrderFeesHandler.new(subject) }
before do before do
allow(subject).to receive(:fee_handler) { fee_handler } allow(subject).to receive(:fee_handler) { fee_handler }

View File

@@ -147,11 +147,11 @@ describe Spree::PaymentMethod do
expect(free_payment_method.compute_amount(order)).to eq 0 expect(free_payment_method.compute_amount(order)).to eq 0
flat_rate_payment_method = create(:payment_method, flat_rate_payment_method = create(:payment_method,
calculator: ::Calculator::FlatRate.new(preferred_amount: 10)) calculator: Calculator::FlatRate.new(preferred_amount: 10))
expect(flat_rate_payment_method.compute_amount(order)).to eq 10 expect(flat_rate_payment_method.compute_amount(order)).to eq 10
flat_percent_payment_method = create(:payment_method, flat_percent_payment_method = create(:payment_method,
calculator: ::Calculator::FlatPercentItemTotal calculator: Calculator::FlatPercentItemTotal
.new(preferred_flat_percent: 10)) .new(preferred_flat_percent: 10))
expect(flat_percent_payment_method.compute_amount(order)).to eq 0 expect(flat_percent_payment_method.compute_amount(order)).to eq 0

View File

@@ -426,7 +426,7 @@ describe Spree::Payment do
context "if payment has any adjustment" do context "if payment has any adjustment" do
let!(:order) { create(:order) } let!(:order) { create(:order) }
let!(:payment_method) { let!(:payment_method) {
create(:payment_method, calculator: ::Calculator::FlatRate.new(preferred_amount: 10)) create(:payment_method, calculator: Calculator::FlatRate.new(preferred_amount: 10))
} }
it "should create another adjustment and revoke the previous one" do it "should create another adjustment and revoke the previous one" do
@@ -999,7 +999,7 @@ describe Spree::Payment do
let!(:shop) { create(:enterprise) } let!(:shop) { create(:enterprise) }
let!(:payment_method) { create(:payment_method, calculator:) } let!(:payment_method) { create(:payment_method, calculator:) }
let!(:calculator) do let!(:calculator) do
::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10)
end end
context "when order complete" do context "when order complete" do
@@ -1036,7 +1036,7 @@ describe Spree::Payment do
let(:payment) { let(:payment) {
create(:payment, order:, payment_method:, amount: order.total) create(:payment, order:, payment_method:, amount: order.total)
} }
let(:calculator) { ::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) } let(:calculator) { Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) }
before do before do
payment_method.calculator = calculator payment_method.calculator = calculator

View File

@@ -9,7 +9,7 @@ describe CompleteVisibleOrders do
describe '#query' do describe '#query' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:enterprise) { create(:enterprise) } let(:enterprise) { create(:enterprise) }
let(:order_permissions) { ::Permissions::Order.new(user, filter_canceled) } let(:order_permissions) { Permissions::Order.new(user, filter_canceled) }
before do before do
user.enterprises << enterprise user.enterprises << enterprise

View File

@@ -31,11 +31,11 @@ describe PaypalItemsBuilder do
let!(:zone) { create(:zone_with_member) } let!(:zone) { create(:zone_with_member) }
let!(:included_tax_rate) { let!(:included_tax_rate) {
create(:tax_rate, amount: 12, included_in_price: true, zone:, create(:tax_rate, amount: 12, included_in_price: true, zone:,
calculator: ::Calculator::DefaultTax.new) calculator: Calculator::DefaultTax.new)
} }
let!(:additional_tax_rate) { let!(:additional_tax_rate) {
create(:tax_rate, amount: 34, included_in_price: false, zone:, create(:tax_rate, amount: 34, included_in_price: false, zone:,
calculator: ::Calculator::DefaultTax.new) calculator: Calculator::DefaultTax.new)
} }
let!(:included_tax_adjustment) { let!(:included_tax_adjustment) {
create(:adjustment, label: "Included Tax Adjustment", order:, create(:adjustment, label: "Included Tax Adjustment", order:,