activemerchant/active_merchant

View on GitHub

Showing 984 of 1,463 total issues

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?
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.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 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
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.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_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'
Severity: Minor
Found in lib/active_merchant/billing/gateways/safe_charge.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_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?
Severity: Minor
Found in lib/active_merchant/billing/gateways/beanstream.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_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
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir_plus.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_fee has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_fee(post, options)
        if options[:application_fee] || options[:fee_payer]
          post[:fee] = {}
          post[:fee][:app_fee] = options[:application_fee] if options[:application_fee]
          post[:fee][:fee_payer] = options[:fee_payer] if options[:fee_payer]
Severity: Minor
Found in lib/active_merchant/billing/gateways/wepay.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_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 }
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.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_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
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_billing(post, card, options = {})
        return unless has_name_info?(card)

        billing = post['payment_method']['card']['billing'] || {}
        billing['email'] = options[:email] if options[:email]
Severity: Minor
Found in lib/active_merchant/billing/gateways/airwallex.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 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]

Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.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 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
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.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/trexle.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(action, params, options = {})
        begin
          response = parse(
            ssl_post(
              ((test? ? test_url : live_url) + action),
Severity: Minor
Found in lib/active_merchant/billing/gateways/wepay.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, 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]
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.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_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|
Severity: Minor
Found in lib/active_merchant/billing/gateways/paysafe.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(body)
        return {} if body.blank?

        parsed_response = JSON.parse(body)
        parsed_response.is_a?(String) ? { 'message' => parsed_response } : parsed_response
Severity: Minor
Found in lib/active_merchant/billing/gateways/priority.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_threeds_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_threeds_fields(post, options)
        return unless three_d_secure = options[:three_d_secure]

        add_pair(post, :threeDSEnrolled, formatted_enrollment(three_d_secure[:enrolled]))
        if three_d_secure[:enrolled] == 'true'
Severity: Minor
Found in lib/active_merchant/billing/gateways/card_stream.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 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
Severity: Minor
Found in lib/active_merchant/billing/gateways/blue_pay.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, creditcard, options)
        if address = options[:billing_address] || options[:address]
          post[:owner_name] = address[:name]
          post[:owner_street] = address[:address1]
          post[:owner_street2] = address[:address2] if address[:address2]
Severity: Minor
Found in lib/active_merchant/billing/gateways/first_pay/first_pay_xml.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(action, request)
          response = parse(
            @gateway.ssl_post(
              @live_url,
              build_soap_request(action, request),
Severity: Minor
Found in lib/active_merchant/billing/gateways/sage.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