Safely autocorrect Style/RedundantRegexpArgument

Inspecting 1513 files
...........................................................................................................................................................................................................................................................................................................................................................C....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Offenses:

app/models/spree/shipping_method.rb:69:25: C: [Corrected] Style/RedundantRegexpArgument: Use string ":tracking" as argument instead of regexp /:tracking/.
      tracking_url.gsub(/:tracking/, tracking) unless tracking.blank? || tracking_url.blank?
                        ^^^^^^^^^^^
lib/spree/i18n.rb:36:17: C: [Corrected] Style/RedundantRegexpArgument: Use string "spree" as argument instead of regexp /spree/.
      path.gsub(/spree/, '')
                ^^^^^^^

1513 files inspected, 2 offenses detected, 2 offenses corrected
This commit is contained in:
Neal Chambers
2023-11-17 08:59:27 +09:00
parent 8347557bea
commit 85fef7ac4b
3 changed files with 2 additions and 9 deletions

View File

@@ -937,13 +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.

View File

@@ -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

View File

@@ -33,7 +33,7 @@ module Spree
return unless path
path.gsub(/spree/, '')
path.gsub("spree", '')
end
end
end