Showing 999 of 1,496 total issues
Method generate_stored_credential_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_stored_credential_params(is_initial_transaction, reason = nil)
customer_or_merchant = reason == 'RECURRING' && is_initial_transaction ? 'customerInitiatedReason' : 'merchantInitiatedReason'
stored_credential_params = {}
stored_credential_params['usage'] = is_initial_transaction ? 'FIRST' : 'USED'
- 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_subsequent_auth_information
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_subsequent_auth_information(xml, options)
return unless options.dig(:stored_credential, :initiator) == 'merchant'
xml.subsequentAuthInformation do
xml.reason options[:stored_credential_reason_type_override] if options[:stored_credential_reason_type_override]
- 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_optional_data_level_two_and_three
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_optional_data_level_two_and_three(xml, data)
xml.shipFromPostalCode data[:ship_from_postal_code] if data.include?(:ship_from_postal_code)
xml.destinationPostalCode data[:destination_postal_code] if data.include?(:destination_postal_code)
xml.destinationCountryCode data[:destination_country_code] if data.include?(:destination_country_code)
add_date_element(xml, 'orderDate', data[:order_date].symbolize_keys) if data.include?(:order_date)
- 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 scrub
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def scrub(transcript)
ret_transcript = transcript
auth_origin = ret_transcript[/<authorization>(.*?)<\/authorization>/, 1]
unless auth_origin.nil?
auth_origin = auth_origin.gsub('\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_fund_source
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_fund_source(post, options)
return unless fund_source = options[:fund_source]
post[:fundSource] = {}
post[:fundSource][:additionalData] = fund_source[:additional_data] if fund_source[:additional_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_details
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_details(xml, options)
xml.hps :AdditionalTxnFields do
xml.hps :Description, options[:description] if options[:description]
xml.hps :InvoiceNbr, options[:order_id][0..59] if options[:order_id]
xml.hps :CustomerID, options[:customer_id] if options[:customer_id]
- 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(path, params)
response = api_request(path, params.to_json)
success = !response.key?('error')
message = (success ? 'Transaction succeeded' : response['error']['message'])
Response.new(
- 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_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_stored_credential_options(data, options)
return unless options[:stored_credential]
case options[:stored_credential][:initial_transaction]
when true
- 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_credit_card_or_check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_credit_card_or_check(soap, payment_method)
case
when payment_method[:method].kind_of?(ActiveMerchant::Billing::CreditCard)
build_tag soap, :string, 'CardNumber', payment_method[:method].number
build_tag soap, :string, 'CardExpiration', "#{'%02d' % payment_method[:method].month}#{payment_method[:method].year.to_s[-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 authorization_from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def authorization_from(action, response)
if %i[store unstore].include?(action)
response[:customercode]
elsif [:purchase_check].include?(action)
response[:transaction_id] ? "#{response[:transaction_id]}|check" : 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 store
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def store(creditcard, options = {})
card_params = {}
add_creditcard(card_params, creditcard, options)
card = card_params[:card]
- 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 legacy_parse_element
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def legacy_parse_element(response, node)
if node.has_elements?
node.elements.each{|e| legacy_parse_element(response, e) }
else
response[node.name.underscore.to_sym] = node.text
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def add_address(post, options)
address = options[:billing_address]
return unless address
post['params[address]'] = address[:address1] 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 add_payment_schedule
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_payment_schedule(xml, options)
return unless options[:interval] || options[:duration]
xml.tag!('paymentSchedule') do
# Contains information about the interval of time between payments
- 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_network_reference_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_network_reference_id(post, options)
return unless (options[:stored_credential] && options[:stored_credential][:reason_type] == 'recurring') || options[:network_transaction_id]
network_transaction_id = options[:network_transaction_id] || options[:stored_credential][:network_transaction_id]
post[:payment_method][:fields][:network_reference_id] = network_transaction_id unless network_transaction_id&.empty?
- 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_charges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_charges(lodging_options)
charges = []
lodging_options[:charges]&.each do |item|
charge = {}
charge['chargeAmount'] = item[:charge_amount] if item[:charge_amount]
- 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_optional_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_optional_fields(xml, optional_fields, options = {})
optional_fields.each do |optional_text_field|
if optional_text_field =~ /(\w+:)(\w+)/
ns = $1
field = $2
- 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 store
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def store(payment_method, options = {})
payment_method_details = PaymentMethodDetails.new(payment_method)
commit(:store, options, :post, payment_method_details) do |doc|
add_personal_info(doc, 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 add_addresses
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_addresses(xml, options)
if billing_address = options[:billing_address] || options[:address]
xml.tag! 'Billing' do
xml.tag! 'Address', [billing_address[:address1], billing_address[:address2]].compact.join(' ')
xml.tag! 'City', billing_address[:city]
- 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 post_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def post_data(action, parameters = {})
parameters[:command] = TRANSACTIONS[action]
parameters[:key] = @options[:login]
parameters[:software] = 'Active Merchant'
parameters[:testmode] = (@options[:test] ? 1 : 0) unless parameters.has_key?(:testmode)
- 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"