mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-01 21:47:16 +00:00
Merge pull request #11820 from macanudo527/fix_autocorrect_rubocop2
Fix Style Rubocop Errors
This commit is contained in:
@@ -937,38 +937,6 @@ Style/RedundantInterpolation:
|
||||
- 'lib/tasks/karma.rake'
|
||||
- 'spec/base_spec_helper.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/RedundantRegexpArgument:
|
||||
Exclude:
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
- 'lib/spree/i18n.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowMultipleReturnValues.
|
||||
Style/RedundantReturn:
|
||||
Exclude:
|
||||
- 'app/models/product_import/entry_validator.rb'
|
||||
- 'app/models/spree/stock/availability_validator.rb'
|
||||
- 'lib/reporting/reports/enterprise_fee_summary/summarizer.rb'
|
||||
- 'lib/stripe/authorize_response_patcher.rb'
|
||||
- 'lib/tasks/data.rake'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/RedundantSelf:
|
||||
Exclude:
|
||||
- 'app/models/spree/order.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/RedundantStringEscape:
|
||||
Exclude:
|
||||
- 'app/models/spree/calculator.rb'
|
||||
- 'spec/controllers/spree/admin/shipping_methods_controller_spec.rb'
|
||||
- 'spec/system/admin/enterprise_fees_spec.rb'
|
||||
|
||||
# Offense count: 19
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
|
||||
@@ -197,7 +197,7 @@ module ProductImport
|
||||
end
|
||||
|
||||
def is_numeric(value)
|
||||
return true unless Float(value, exception: false).nil?
|
||||
true unless Float(value, exception: false).nil?
|
||||
end
|
||||
|
||||
def price_validation(entry)
|
||||
|
||||
@@ -28,7 +28,7 @@ module Spree
|
||||
end
|
||||
|
||||
def to_s
|
||||
self.class.name.titleize.gsub("Calculator\/", "")
|
||||
self.class.name.titleize.gsub("Calculator/", "")
|
||||
end
|
||||
|
||||
def description
|
||||
|
||||
@@ -205,7 +205,7 @@ module Spree
|
||||
end
|
||||
|
||||
def display_payment_total
|
||||
Spree::Money.new(self.payment_total, currency:)
|
||||
Spree::Money.new(payment_total, currency:)
|
||||
end
|
||||
|
||||
def to_param
|
||||
|
||||
@@ -66,7 +66,7 @@ module Spree
|
||||
end
|
||||
|
||||
def build_tracking_url(tracking)
|
||||
tracking_url.gsub(/:tracking/, tracking) unless tracking.blank? || tracking_url.blank?
|
||||
tracking_url.gsub(":tracking", tracking) unless tracking.blank? || tracking_url.blank?
|
||||
end
|
||||
|
||||
# Some shipping methods are only meant to be set via backend
|
||||
|
||||
@@ -28,7 +28,8 @@ module Spree
|
||||
|
||||
def line_item_shipment(line_item)
|
||||
return line_item.target_shipment if line_item.target_shipment
|
||||
return line_item.order.shipments.first if line_item.order&.shipments&.any?
|
||||
|
||||
line_item.order.shipments.first if line_item.order&.shipments&.any?
|
||||
end
|
||||
|
||||
# Overrides Spree v2.0.4 validate method version to:
|
||||
|
||||
@@ -39,7 +39,8 @@ module Reporting
|
||||
return DataRepresentations::ExchangeOrderFee if for_order_adjustment_source?
|
||||
return unless for_line_item_adjustment_source?
|
||||
return DataRepresentations::IncomingExchangeLineItemFee if for_incoming_exchange?
|
||||
return DataRepresentations::OutgoingExchangeLineItemFee if for_outgoing_exchange?
|
||||
|
||||
DataRepresentations::OutgoingExchangeLineItemFee if for_outgoing_exchange?
|
||||
end
|
||||
|
||||
def for_payment_method?
|
||||
|
||||
@@ -33,7 +33,7 @@ module Spree
|
||||
|
||||
return unless path
|
||||
|
||||
path.gsub(/spree/, '')
|
||||
path.gsub("spree", '')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ module Stripe
|
||||
return unless %w(authorize_with_url redirect_to_url).include?(next_action_type)
|
||||
|
||||
url = next_action[next_action_type]["url"]
|
||||
return url if url.match(%r{https?://\S+}) && url.include?("stripe.com")
|
||||
url if url.match(%r{https?://\S+}) && url.include?("stripe.com")
|
||||
end
|
||||
|
||||
# This field is used because the Spree code recognizes and stores it
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace :ofn do
|
||||
end
|
||||
|
||||
def is_integer?(value)
|
||||
return true if Integer(value)
|
||||
true if Integer(value)
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ describe Spree::Admin::ShippingMethodsController, type: :controller do
|
||||
].each do |shipping_amount|
|
||||
it "diplay error message on update if #{shipping_amount} input is invalid" do
|
||||
shipping_method.calculator = create(:calculator_flat_rate, calculable: shipping_method)
|
||||
params[:shipping_method][:calculator_attributes][shipping_amount] = "\'20.0'"
|
||||
params[:shipping_method][:calculator_attributes][shipping_amount] = "'20.0'"
|
||||
|
||||
spree_post :update, params
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ describe '
|
||||
expect(page).to have_selector "input[value='Hello!']"
|
||||
|
||||
# When I fill in the calculator fields and click update
|
||||
fill_in("#{prefix}_calculator_attributes_preferred_flat_percent", with: "\'20.0'")
|
||||
fill_in("#{prefix}_calculator_attributes_preferred_flat_percent", with: "'20.0'")
|
||||
click_button 'Update'
|
||||
|
||||
# Then I should see the flash error message
|
||||
@@ -137,7 +137,7 @@ describe '
|
||||
# When I fill in the calculator fields and click update
|
||||
fill_in(
|
||||
"#{prefix}_calculator_attributes_" \
|
||||
'preferred_flat_percent', with: "\'20.0'"
|
||||
'preferred_flat_percent', with: "'20.0'"
|
||||
)
|
||||
click_button 'Update'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user