Showing 999 of 1,496 total issues
File safe_charge.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class SafeChargeGateway < Gateway
Method request
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def request(method, body, headers = {})
request_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
headers = headers.dup
headers['connection'] ||= 'close'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_address
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_address(params, options)
address = options[:billing_address] || options[:address]
if address
params[:address] = address[:address1] unless address[:address1].blank?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_3ds
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_3ds(post, options)
if three_ds_2_options = options[:three_ds_2]
device_channel = three_ds_2_options[:channel]
if device_channel == 'app'
post[:threeDS2RequestData] = { deviceChannel: device_channel }
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_aggregate_data
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_aggregate_data(post, options)
aggregate_data = {}
data = options[:aggregate_data]
aggregate_data[:indicator] = data[:indicator] if data[:indicator]
aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_aggregate_data
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_aggregate_data(post, options)
aggregate_data = {}
data = options[:aggregate_data]
aggregate_data[:indicator] = data[:indicator] if data[:indicator]
aggregate_data[:identification_number] = data[:identification_number] if data[:identification_number]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create_setup_intent
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create_setup_intent(payment_method, options = {})
MultiResponse.run do |r|
r.process do
post = {}
add_customer(post, options)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_transaction_data
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_transaction_data(trans_type, post, money, options)
currency = options[:currency] || currency(money)
post[:sg_TransType] = trans_type
post[:sg_Currency] = currency
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_billing_address
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_billing_address(post, type, options)
if address = (options[:billing_address] || options[:address])
billing = {}
address = options[:billing_address] || options[:address]
billing[:street] = address[:address1].match(/\D+/)[0].strip if address[:address1]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method validate_essential_attributes
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def validate_essential_attributes #:nodoc:
errors = []
if self.class.requires_name?
errors << [:first_name, 'cannot be empty'] if first_name.blank?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parse_normal
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_normal(action, body)
doc = Nokogiri::XML(body)
doc.remove_namespaces!
response = { action: action }
Class PaywayDotComGateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class PaywayDotComGateway < Gateway
self.test_url = 'https://paywaywsdev.com/PaywayWS/Payment/CreditCard'
self.live_url = 'https://paywayws.net/PaywayWS/Payment/CreditCard'
self.supported_countries = %w[US CA]
Class VposGateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class VposGateway < Gateway
self.test_url = 'https://vpos.infonet.com.py:8888'
self.live_url = 'https://vpos.infonet.com.py'
self.supported_countries = ['PY']
Class IridiumGateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class IridiumGateway < Gateway
self.live_url = self.test_url = 'https://gw1.iridiumcorp.net/'
# The countries the gateway supports merchants from as 2 digit ISO country codes
self.supported_countries = %w[GB ES]
Class CheckoutGateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CheckoutGateway < Gateway
self.default_currency = 'USD'
self.money_format = :cents
self.supported_countries = %w[AD AT BE BG CH CY CZ DE DK EE ES FO FI FR GB GI GL GR HR HU IE IS IL IT LI LT LU LV MC MT NL NO PL PT RO SE SI SM SK SJ TR VA]
Class InspireGateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class InspireGateway < Gateway
self.live_url = self.test_url = 'https://secure.inspiregateway.net/api/transact.php'
self.supported_countries = ['US']
self.supported_cardtypes = %i[visa master american_express]
Class MitGateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class MitGateway < Gateway
self.live_url = 'https://wpy.mitec.com.mx/ModuloUtilWS/activeCDP.htm'
self.test_url = 'https://scqa.mitec.com.mx/ModuloUtilWS/activeCDP.htm'
self.supported_countries = ['MX']
Class CamsGateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CamsGateway < Gateway
self.live_url = 'https://secure.centralams.com/gw/api/transact.php'
self.supported_countries = ['US']
self.default_currency = 'USD'
Class CC5Gateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CC5Gateway < Gateway
self.default_currency = 'TRY'
CURRENCY_CODES = {
'TRY' => 949,
Class WepayGateway
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class WepayGateway < Gateway
self.test_url = 'https://stage.wepayapi.com/v2'
self.live_url = 'https://wepayapi.com/v2'
self.supported_countries = %w[US CA]