mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-04 02:31:33 +00:00
Safely autocorrect Style/RedundantStringEscape
Inspecting 1513 files
..........................................................................................................................................................................................................................................................................................................................C...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C......................................................................................................................................................................................................................................................................................................................................................................................................................................................................C...........................................................................................................
Offenses:
app/models/spree/calculator.rb:31:48: C: [Corrected] Style/RedundantStringEscape: Redundant escape of / inside string literal.
self.class.name.titleize.gsub("Calculator\/", "")
^^
spec/controllers/spree/admin/shipping_methods_controller_spec.rb:40:78: C: [Corrected] Style/RedundantStringEscape: Redundant escape of ' inside string literal.
params[:shipping_method][:calculator_attributes][shipping_amount] = "\'20.0'"
^^
spec/system/admin/enterprise_fees_spec.rb:82:78: C: [Corrected] Style/RedundantStringEscape: Redundant escape of ' inside string literal.
fill_in("#{prefix}_calculator_attributes_preferred_flat_percent", with: "\'20.0'")
^^
spec/system/admin/enterprise_fees_spec.rb:140:42: C: [Corrected] Style/RedundantStringEscape: Redundant escape of ' inside string literal.
'preferred_flat_percent', with: "\'20.0'"
^^
1513 files inspected, 4 offenses detected, 4 offenses corrected
This commit is contained in:
@@ -937,20 +937,6 @@ Style/RedundantInterpolation:
|
||||
- 'lib/tasks/karma.rake'
|
||||
- 'spec/base_spec_helper.rb'
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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