activemerchant/active_merchant

View on GitHub

Showing 992 of 1,478 total issues

Method add_shopper_interaction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_shopper_interaction(post, payment, options = {})
        if  (options.dig(:stored_credential, :initial_transaction) && options.dig(:stored_credential, :initiator) == 'cardholder') ||
            (payment.respond_to?(:verification_value) && payment.verification_value && options.dig(:stored_credential, :initial_transaction).nil?) ||
            payment.is_a?(NetworkTokenizationCreditCard)
          shopper_interaction = 'Ecommerce'
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 25 mins to fix

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
Severity: Minor
Found in lib/active_merchant/billing/gateways/redsys.rb - About 25 mins to fix

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', '')
Severity: Minor
Found in lib/active_merchant/billing/gateways/mit.rb - About 25 mins to fix

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 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'
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.rb - About 25 mins to fix

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]
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 25 mins to fix

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 root_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def root_for(action)
        if action == :cim_store
          'createCustomerProfileRequest'
        elsif action == :cim_store_update
          'createCustomerPaymentProfileRequest'
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 25 mins to fix

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_message_from has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def authorize_message_from(response, options = {})
        return raw_authorize_error_message(response) if options[:raw_error_message]

        if response['refusalReason'] && response['additionalData'] && (response['additionalData']['merchantAdviceCode'] || response['additionalData']['refusalReasonRaw'])
          "#{response['refusalReason']} | #{response['additionalData']['merchantAdviceCode'] || response['additionalData']['refusalReasonRaw']}"
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 25 mins to fix

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
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_arb.rb - About 25 mins to fix

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_merchant_description has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_merchant_description(post, options)
        return unless options[:merchant_descriptor_name] || options[:merchant_descriptor_address1] || options[:merchant_descriptor_locality]

        merchant = post[:merchantInformation][:merchantDescriptor] = {}
        merchant[:name] = options[:merchant_descriptor_name] if options[:merchant_descriptor_name]
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source_rest.rb - About 25 mins to fix

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!(
Severity: Minor
Found in lib/active_merchant/billing/gateways/pin.rb - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment(post, payment, options, action = nil)
        if payment.is_a?(String)
          _, _, recurring_detail_reference = payment.split('#')
          post[:selectedRecurringDetailReference] = recurring_detail_reference
          options[:recurring_contract_type] ||= 'RECURRING'
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 25 mins to fix

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 eci_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def eci_value(payment_method, options)
        eci = payment_method.respond_to?(:eci) ? format(payment_method.eci, :two_digits) : ''

        return eci unless eci.empty?

Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.rb - About 25 mins to fix

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)
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.rb - About 25 mins to fix

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_credit_card has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_credit_card(xml, credit_card, action)
        if credit_card.track_data
          add_swipe_data(xml, credit_card)
        else
          xml.payment do
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 25 mins to fix

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, options, address)
        post[:billingAddress] = {}
        post[:billingAddress][:street] = options[:address_override] == true ? address[:address2] : address[:address1] || 'NA'
        post[:billingAddress][:houseNumberOrName] = options[:address_override] == true ? address[:address1] : address[:address2] || 'NA'
        post[:billingAddress][:postalCode] = address[:zip] if address[:zip]
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 25 mins to fix

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(action, response, avs_result, cvv_result)
        if response[:response_code] == DECLINED
          if CARD_CODE_ERRORS.include?(cvv_result.code)
            return cvv_result.message
          elsif AVS_REASON_CODES.include?(response[:response_reason_code]) && AVS_ERRORS.include?(avs_result.code)
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 25 mins to fix

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(
Severity: Minor
Found in lib/active_merchant/billing/gateways/komoju.rb - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_recurring_contract(post, options = {})
        return unless options[:recurring_contract_type]

        post[:recurring] = {}
        post[:recurring][:contract] = options[:recurring_contract_type]
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 25 mins to fix

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]
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 25 mins to fix

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_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_options(post, options)
        post[:createRegistration] = options[:create_registration] if options[:create_registration] && !options[:registrationId]
        post[:testMode] = options[:test_mode] if test? && options[:test_mode]
        options.each { |key, value| post[key] = value if key.to_s =~ /'customParameters\[[a-zA-Z0-9\._]{3,64}\]'/ }
        post['customParameters[SHOPPER_pluginId]'] = 'activemerchant'
Severity: Minor
Found in lib/active_merchant/billing/gateways/opp.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language