activemerchant/active_merchant

View on GitHub

Showing 1,450 of 1,450 total issues

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

      def add_three_d_secure(xml, options)
        return unless three_d_secure = options[:three_d_secure]

        xml.info3DSecure do
          xml.threeDSVersion three_d_secure[:version]
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_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 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_fraud_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_fraud_details(post, options)
        details = {}

        details[:customer_ip] = options[:ip] if options[:ip]
        details[:customer_email] = options[:email] if options[:email]
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 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_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 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

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

      def store(credit_card, options = {})
        requires!(options, :order_id)
        post = init_post(options)
        add_invoice(post, 0, options)
        add_payment(post, credit_card, options)
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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(response)
        return bad_authentication_response if response.code.to_i == 401
        return generic_error_response(response.body) if [403, 405, 429].include?(response.code.to_i)

        parsed = {}
Severity: Minor
Found in lib/active_merchant/billing/gateways/blue_snap.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_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_method(xml, payment_method, options, action = nil)
        return unless payment_method

        case payment_method
        when String
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_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_invoice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_invoice(xml, transaction_type, options)
        xml.order do
          xml.invoiceNumber(truncate(options[:order_id], 20))
          xml.description(truncate(options[:description], 255))
          xml.purchaseOrderNumber(options[:po_number]) if options[:po_number] && transaction_type.start_with?('profileTrans')
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_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
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal/paypal_common_api.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(params, credit_card, options)
        return unless credit_card

        params['Customer'] ||= {}
        if credit_card.respond_to? :number
Severity: Minor
Found in lib/active_merchant/billing/gateways/eway_rapid.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_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]
Severity: Minor
Found in lib/active_merchant/billing/gateways/micropayment.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_customer_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_customer_data(post, options)
        requires!(options, :user_id)
        post[:user] ||= {}
        post[:user][:id] = options[:user_id]
        post[:user][:email] = options[:email] if options[:email]
Severity: Minor
Found in lib/active_merchant/billing/gateways/paymentez.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_external_mpi_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_external_mpi_fields(extra_params, options)
        three_d_secure_options = options[:three_d_secure]
        return unless three_d_secure_options

        reference_id = options[:new_reference_id_field] ? three_d_secure_options[:ds_transaction_id] : three_d_secure_options[:three_ds_server_trans_id]
Severity: Minor
Found in lib/active_merchant/billing/gateways/paymentez.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_details_items_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_details_items_xml(xml, options, currency_code)
        options[:items].each do |item|
          xml.tag! 'n2:PaymentDetailsItem' do
            xml.tag! 'n2:Name', item[:name]
            xml.tag! 'n2:Number', item[:number]
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal/paypal_common_api.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 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)
Severity: Minor
Found in lib/active_merchant/billing/gateways/usa_epay_transaction.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