mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
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:
@@ -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:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'open_food_network/address_finder'
|
||||
|
||||
class SplitCheckoutController < ::BaseController
|
||||
class SplitCheckoutController < BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
include OrderStockCheck
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WebhookEndpointsController < ::BaseController
|
||||
class WebhookEndpointsController < BaseController
|
||||
before_action :load_resource, only: :destroy
|
||||
|
||||
def create
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -165,7 +165,7 @@ describe CheckoutHelper, type: :helper do
|
||||
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:)
|
||||
|
||||
@@ -616,7 +616,7 @@ describe Spree::Order do
|
||||
|
||||
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 }
|
||||
|
||||
@@ -147,11 +147,11 @@ describe Spree::PaymentMethod do
|
||||
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
|
||||
|
||||
|
||||
@@ -426,7 +426,7 @@ describe Spree::Payment do
|
||||
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
|
||||
@@ -999,7 +999,7 @@ describe Spree::Payment do
|
||||
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
|
||||
@@ -1036,7 +1036,7 @@ describe Spree::Payment do
|
||||
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
|
||||
|
||||
@@ -9,7 +9,7 @@ describe CompleteVisibleOrders do
|
||||
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
|
||||
|
||||
@@ -31,11 +31,11 @@ describe PaypalItemsBuilder do
|
||||
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:,
|
||||
|
||||
Reference in New Issue
Block a user