Showing 984 of 1,463 total issues
Method post_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def post_data(params)
return nil unless params
params.map do |key, value|
next if value != false && value.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 refund
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def refund(*args)
# legacy signature: #refund(transaction_id, options = {})
# new signature: #refund(money, transaction_id, options = {})
money, transaction_id, options = extract_refund_args(args)
money = localized_amount(money, options[:currency] || default_currency).to_s if money
- 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_external_mpi_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_external_mpi_data(post, options)
post[:sg_ECI] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
post[:sg_CAVV] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
post[:sg_dsTransID] = options[:three_d_secure][:ds_transaction_id] if options[:three_d_secure][:ds_transaction_id]
post[:sg_threeDSProtocolVersion] = options[:three_d_secure][:ds_transaction_id] ? '2' : '1'
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def add_billing_address(post, payment_method, options = {})
return if payment_method.nil? || payment_method.is_a?(StripePaymentToken) || payment_method.is_a?(String)
post[:payment_method_data] ||= {}
if billing = options[:billing_address] || options[:address]
- 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 purchase
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def purchase(money, payment_method, options = {})
request = build_xml_request do |xml|
xml.ssl_vendor_id @options[:ssl_vendor_id] || options[:ssl_vendor_id]
xml.ssl_transaction_type self.actions[:purchase]
xml.ssl_amount amount(money)
- 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_split_pay_details
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_split_pay_details(post, options)
return unless options[:split_pay]
split_pay = []
options[:split_pay].each do |pmnt|
- 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 copy_when_present
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_when_present(dest, dest_path, source, source_path = nil)
source_path ||= dest_path
source_path.each do |key|
return nil unless source[key]
- 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 stored_credentials_v1
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def stored_credentials_v1(parameters, stored_credential)
if stored_credential[:initiator] == 'merchant'
if stored_credential[:reason_type] == 'installment'
parameters[:transaction_source] = 'recurring'
else
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def add_three_ds(post, options)
return unless three_d_secure = options[:three_d_secure]
post[:SecureXID] = (three_d_secure[:ds_transaction_id] || three_d_secure[:xid]) if three_d_secure.slice(:ds_transaction_id, :xid).values.any?
post[:SecureECI] = formatted_three_ds_eci(three_d_secure[:eci]) if three_d_secure[:eci].present?
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def commit(action, params, options = {})
begin
response = parse(
ssl_post(
((test? ? test_url : live_url) + action),
- 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_for_card_tokenization
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_billing_address_for_card_tokenization(post, options = {})
return unless (billing = options[:billing_address] || options[:address])
billing = add_address(billing, options)
billing[:address].transform_keys! { |k| k == :postal_code ? :address_zip : k.to_s.prepend('address_').to_sym }
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(vault_id, creditcard, options = {})
braintree_credit_card = nil
commit do
braintree_credit_card = @braintree_gateway.customer.find(vault_id).credit_cards.detect(&:default?)
return Response.new(false, 'Braintree::NotFoundError') if braintree_credit_card.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_charge_details
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_charge_details(post, money, payment, options)
if emv_payment?(payment)
add_statement_address(post, options)
add_emv_metadata(post, payment)
else
- 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_creditcard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_creditcard(post, creditcard)
if creditcard.respond_to?(:number)
post[:card] ||= {}
post[:card].merge!(
- 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 message_from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def message_from(response)
if success_from(response)
case response['status']
when 'paid'
'Transação aprovada'
- 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_fraud_detection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_fraud_detection(post, options)
return unless fraud_detection = options[:fraud_detection]
{}.tap do |hsh|
hsh[:send_to_cs] = fraud_detection[:send_to_cs] == 'true' # true/false
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse(body)
return {} if body.blank?
parsed_response = JSON.parse(body)
parsed_response.is_a?(String) ? { 'message' => parsed_response } : parsed_response
- 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 message_from_transaction_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def message_from_transaction_response(success, response)
response_code = response.dig('transactionResponse', 'responseCode') || response.dig('transactionResponse', 'pendingReason')
return response_code if success
return response_code + ' | ' + response.dig('transactionResponse', 'paymentNetworkResponseErrorMessage') if response.dig('transactionResponse', 'paymentNetworkResponseErrorMessage')
return response.dig('transactionResponse', 'responseMessage') if response.dig('transactionResponse', 'responseMessage')
- 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 refund
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def refund(money, identification, options = {})
if identification && !identification.kind_of?(String)
ActiveMerchant.deprecated 'refund should only be used to refund a referenced transaction'
return credit(money, identification, options)
end
- 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_invoice
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_invoice(post, credit_card_or_reference, money, options)
add_pair(post, :transactionUnique, options[:order_id], required: true)
add_pair(post, :orderRef, options[:description] || options[:order_id], required: true)
add_pair(post, :statementNarrative1, options[:merchant_name]) if options[:merchant_name]
add_pair(post, :statementNarrative2, options[:dynamic_descriptor]) if options[:dynamic_descriptor]
- 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"