Fixes some rubocop linting offenses - part II

This commit is contained in:
cyrillefr
2025-03-03 14:03:47 +01:00
parent 5bef8b7dde
commit 446b948889
6 changed files with 8 additions and 27 deletions

View File

@@ -39,24 +39,6 @@ Lint/FloatComparison:
Exclude:
- 'app/models/spree/gateway/pay_pal_express.rb'
# Offense count: 1
Lint/IneffectiveAccessModifier:
Exclude:
- 'app/models/spree/user.rb'
# Offense count: 1
Lint/NoReturnInBeginEndBlocks:
Exclude:
- 'app/controllers/payment_gateways/stripe_controller.rb'
# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/RedundantDirGlobSort:
Exclude:
- 'engines/catalog/spec/spec_helper.rb'
- 'engines/dfc_provider/spec/spec_helper.rb'
- 'spec/system_helper.rb'
# Offense count: 24
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
Metrics/AbcSize:

View File

@@ -68,11 +68,11 @@ module PaymentGateways
end
def valid_payment_intent?
@valid_payment_intent ||= begin
return false unless params["payment_intent"]&.starts_with?("pi_")
order_and_payment_valid?
end
@valid_payment_intent ||= if params["payment_intent"]&.starts_with?("pi_")
order_and_payment_valid?
else
false
end
end
def order_and_payment_valid?

View File

@@ -168,6 +168,7 @@ module Spree
def self.friendly_token
SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")
end
private_class_method :friendly_token
def limit_owned_enterprises
return unless owned_enterprises.size > enterprise_limit

View File

@@ -1,5 +1,3 @@
# frozen_string_literal: true
require '../../spec/spec_helper'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }

View File

@@ -2,7 +2,7 @@
require_relative '../../../spec/spec_helper'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
RSpec.configure do |config|
config.include AuthorizationHelper, type: :request

View File

@@ -3,4 +3,4 @@
require "base_spec_helper"
# system/support/ files contain system tests configurations and helpers
Dir[File.join(__dir__, "system/support/**/*.rb")].sort.each { |file| require file }
Dir[File.join(__dir__, "system/support/**/*.rb")].each { |file| require file }