Merge pull request #13186 from cyrillefr/FixRubocopLintIssuesII

Fixes some rubocop linting offenses - part II
This commit is contained in:
David Cook
2025-03-06 11:33:56 +11:00
committed by GitHub
6 changed files with 4 additions and 32 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,8 @@ 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 ||= params["payment_intent"]&.starts_with?("pi_") &&
order_and_payment_valid?
end
def order_and_payment_valid?

View File

@@ -164,11 +164,6 @@ module Spree
self.login ||= email if email
end
# Generate a friendly string randomically to be used as token.
def self.friendly_token
SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")
end
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 }