Showing 1,005 of 1,501 total issues
Method store
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def store(payment_method, options = {})
post = {}
MultiResponse.run do |r|
if payment_method.is_a?(NetworkTokenizationCreditCard)
r.process { verify(payment_method, 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 test_gateways
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def test_gateways
success, failed, missing, errored, disabled = [], [], [], [], []
puts "Verifying #{@gateways.count} SSL certificates\n\n"
- 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_card
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_card(post, card, action, options = {})
post[:card] = {}
if card.is_a?(NetworkTokenizationCreditCard)
post[:card][:network_token] = card.number
post[:card][:cryptogram] = card.payment_cryptogram
- 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 url
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def url(endpoint, options = {})
case endpoint
when 'settle', 'credit', 'cancel'
"#{test? ? test_url : live_url}transactions/#{options[:transaction_id]}/#{endpoint}"
when 'tokenize'
- 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 build_authorized_request
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def build_authorized_request(action, money, authorization, credit_card, options)
xml = Builder::XmlMarkup.new
invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = split_authorization(authorization)
ref_no = '1' if ref_no.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_element
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_element(node)
if node.has_elements?
response = {}
node.elements.each { |e|
key = e.name.underscore
- 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_level_three_information_tags_visa
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_level_three_information_tags_visa(doc, payment_method, level_3_data)
doc.discountAmount(level_3_data[:discount_amount]) if level_3_data[:discount_amount]
doc.shippingAmount(level_3_data[:shipping_amount]) if level_3_data[:shipping_amount]
doc.dutyAmount(level_3_data[:duty_amount]) if level_3_data[:duty_amount]
doc.detailTax do
- 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_items
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_items(post, items)
return unless items&.kind_of?(Array)
post[:Items] = []
- 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 build_url
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def build_url(action)
case action
when 'store'
"#{test? ? self.test_url : self.live_url}/Recurring/#{API_VERSION}/storeToken"
when 'finalize3ds'
- 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_three_ds
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_three_ds(post, payment_method, options)
return unless three_d_secure = options[:three_d_secure]
post[:consumerAuthenticationInformation] ||= {}
if payment_method.brand == 'master'
- 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_element
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_element(node)
if node.has_elements?
response = {}
node.elements.each do |e|
key = e.name.underscore
- 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_recurring_contract
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_recurring_contract(post, options = {}, payment = nil)
return unless options[:recurring_contract_type] || (payment.try(:network_token?) && options[:switch_cryptogram_mapping_nt])
post[:recurring] ||= {}
post[:recurring][:contract] = options[:recurring_contract_type] if options[:recurring_contract_type]
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def add_billing_address(post, payment, options)
return unless billing = options[:billing_address]
billing_address = {}
name_from_address(billing_address, billing) || name_from_payment(billing_address, payment)
- 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 authorize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def authorize(money, payment_method, options = {})
MultiResponse.run do |r|
if payment_method.is_a?(CreditCard)
response = r.process { tokenize(payment_method, options) }
card_token = response.params['token']
- 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 commit_raw
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def commit_raw(object, action, parameters)
if action == 'inquire'
url = "#{test? ? test_url : live_url}#{object}/#{parameters}"
begin
raw_response = ssl_get(url, headers)
- 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_airline_data
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_airline_data(post, options)
return unless airline_options = options[:airline_data]
airline_data = {}
- 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_stored_credential
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_stored_credential(post, options)
add_transaction_type(post, options)
# if :transaction_type option is not passed, then check for :stored_credential options
return unless (stored_credential = options[:stored_credential]) && options.dig(:transaction_type).nil?
- 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_payment
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_payment(post, payment, options = {})
if payment.is_a?(String)
token, bin = payment.split('|')
post[:token] = token
post[:bin] = bin
- 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_payment_method_id
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_payment_method_id(credit_card, options)
if options[:payment_method_id]
options[:payment_method_id].to_i
elsif options[:debit]
if CreditCard.brand?(credit_card.number) == 'visa'
- 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 error_code_from
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def error_code_from(response)
return if success_from(response)
error_code = nil
if error = response.dig('status_details', 'error')
- 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"