Skip to content

Commit

Permalink
Safely autocorrect Style/RedundantConstantBase
Browse files Browse the repository at this point in the history
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
  • Loading branch information
macanudo527 committed Nov 10, 2023
1 parent ef928aa commit c3b4781
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 27 deletions.
14 changes: 0 additions & 14 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -923,20 +923,6 @@ Style/RedundantArgument:
- 'engines/dfc_provider/app/services/authorization_control.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
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantDoubleSplatHashBraces:
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/split_checkout_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'open_food_network/address_finder'

class SplitCheckoutController < ::BaseController
class SplitCheckoutController < BaseController
layout 'darkswarm'

include OrderStockCheck
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/webhook_endpoints_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class WebhookEndpointsController < ::BaseController
class WebhookEndpointsController < BaseController
before_action :load_resource, only: :destroy

def create
Expand Down
2 changes: 1 addition & 1 deletion config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

# 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
2 changes: 1 addition & 1 deletion spec/helpers/checkout_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
end

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) {
create(:adjustment, originator: enterprise_fee, adjustable: order.line_items.first,
order:)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/spree/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@

describe "applying enterprise fees" do
subject { create(:order) }
let(:fee_handler) { ::OrderFeesHandler.new(subject) }
let(:fee_handler) { OrderFeesHandler.new(subject) }

before do
allow(subject).to receive(:fee_handler) { fee_handler }
Expand Down
4 changes: 2 additions & 2 deletions spec/models/spree/payment_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ class Spree::Gateway::Test < Spree::Gateway
expect(free_payment_method.compute_amount(order)).to eq 0

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

flat_percent_payment_method = create(:payment_method,
calculator: ::Calculator::FlatPercentItemTotal
calculator: Calculator::FlatPercentItemTotal
.new(preferred_flat_percent: 10))
expect(flat_percent_payment_method.compute_amount(order)).to eq 0

Expand Down
6 changes: 3 additions & 3 deletions spec/models/spree/payment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
context "if payment has any adjustment" do
let!(:order) { create(:order) }
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
Expand Down Expand Up @@ -999,7 +999,7 @@
let!(:shop) { create(:enterprise) }
let!(:payment_method) { create(:payment_method, calculator:) }
let!(:calculator) do
::Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10)
Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10)
end

context "when order complete" do
Expand Down Expand Up @@ -1036,7 +1036,7 @@
let(:payment) {
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
payment_method.calculator = calculator
Expand Down
2 changes: 1 addition & 1 deletion spec/queries/complete_visible_orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
describe '#query' do
let(:user) { create(:user) }
let(:enterprise) { create(:enterprise) }
let(:order_permissions) { ::Permissions::Order.new(user, filter_canceled) }
let(:order_permissions) { Permissions::Order.new(user, filter_canceled) }

before do
user.enterprises << enterprise
Expand Down
4 changes: 2 additions & 2 deletions spec/services/paypal_items_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
let!(:zone) { create(:zone_with_member) }
let!(:included_tax_rate) {
create(:tax_rate, amount: 12, included_in_price: true, zone:,
calculator: ::Calculator::DefaultTax.new)
calculator: Calculator::DefaultTax.new)
}
let!(:additional_tax_rate) {
create(:tax_rate, amount: 34, included_in_price: false, zone:,
calculator: ::Calculator::DefaultTax.new)
calculator: Calculator::DefaultTax.new)
}
let!(:included_tax_adjustment) {
create(:adjustment, label: "Included Tax Adjustment", order:,
Expand Down

0 comments on commit c3b4781

Please sign in to comment.