Shopify/active_merchant

View on GitHub

Showing 984 of 1,463 total issues

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

      def add_shipping_address(post, options)
        address = options[:shipping_address] || {}

        post[:ship_name1], post[:ship_name2] = split_names(address[:name])
        post[:ship_street] = address[:address1] if address[:address1]
Severity: Minor
Found in lib/active_merchant/billing/gateways/ezic.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_details_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_details_data(post, options)
        details = {}
        details[:name] = options[:customer] || (options[:billing_address][:name] if options[:billing_address])
        details[:phone] = options[:phone] || (options[:billing_address][:phone] if options[:billing_address])
        details[:email] = options[:email] if options[:email]
Severity: Minor
Found in lib/active_merchant/billing/gateways/conekta.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 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
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_network_tokenization_card has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_network_tokenization_card(post, payment_method, options)
        post[:b21] = NETWORK_TOKENIZATION_CARD_SOURCE[payment_method.source.to_s]
        post[:token_eci] = post[:b21] == 'vts_mdes_token' ? '07' : nil
        post[:token_eci] = options[:eci] || payment_method&.eci || (payment_method.brand.to_s == 'master' ? '00' : '07')
        post[:token_crypto] = payment_method&.payment_cryptogram if payment_method.source.to_s == 'network_token'
Severity: Minor
Found in lib/active_merchant/billing/gateways/credorax.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(response)
        return response['detail'] if response['detail'].present?

        if !success_from(response) && response['error']
          response['error'] && response['error']['type']
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 recursively_parse_element has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def recursively_parse_element(node, response)
        if node.has_elements?
          node.elements.each { |n| recursively_parse_element(n, response) }
        else
          response[dexmlize_param_name(node.name)] = (node.text ? node.text.strip : nil)
Severity: Minor
Found in lib/active_merchant/billing/gateways/iats_payments.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_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]
Severity: Minor
Found in lib/active_merchant/billing/gateways/global_collect.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_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?
Severity: Minor
Found in lib/active_merchant/billing/gateways/rapyd.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 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_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]
Severity: Minor
Found in lib/active_merchant/billing/gateways/jetpay_v2.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(creditcard, options = {})
        card_params = {}
        add_creditcard(card_params, creditcard, options)
        card = card_params[:card]

Severity: Minor
Found in lib/active_merchant/billing/gateways/openpay.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, credit_card_reference, options = {})
        post[:card] ||= {}
        if credit_card_reference.is_a?(String)
          post[:card][:paymentToken] = credit_card_reference
        else
Severity: Minor
Found in lib/active_merchant/billing/gateways/netbanx.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

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

      def add_payment_method_data(payment_method, options = {})
        post = {
          type: 'card',
          card: {
            exp_month: payment_method.month,
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_claim_without_transaction_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_claim_without_transaction_id(post, options = {})
        return if options[:stored_credential] || options[:network_transaction_id] || options[:ds_transaction_id]
        return unless options[:claim_without_transaction_id]

        post[:payment_method_options] ||= {}
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_connected_account has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_connected_account(post, options = {})
        post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of]

        return unless options[:transfer_destination]

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

Severity
Category
Status
Source
Language