activemerchant/active_merchant

View on GitHub

Showing 992 of 1,478 total issues

Method stored_credentials_v2 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def stored_credentials_v2(parameters, stored_credential)
        # Differences between v1 and v2 are
        # initial_transaction + recurring/installment should be labeled {{reason_type}}_first
        # unscheduled in AM should map to '' at BT because unscheduled here means not on a fixed timeline or fixed amount
        case stored_credential[:reason_type]
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 35 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_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_method_id(options)
        return options[:payment_method_id].to_i if options[:payment_method_id]

        if options[:debit]
          case options[:card_brand]
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir_plus.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(method, url, parameters = nil, options = {})
        add_expand_parameters(parameters, options) if parameters
        return Response.new(false, 'Invalid API Key provided') unless key_valid?(options)

        response = api_request(method, url, parameters, options)
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.rb - About 35 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 success_from has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def success_from(entity_name, raw_response)
        entity = (raw_response[entity_name] || []).first
        if !entity
          false
        elsif (entity_name == 'refunds') && entity.include?('status')
Severity: Minor
Found in lib/active_merchant/billing/gateways/balanced.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def message_from(response)
        return response['error'] if response['error']
        return 'Failed' unless response.key?('result')

        if response['result'].key?('pgwResponseCode')
Severity: Minor
Found in lib/active_merchant/billing/gateways/latitude19.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment(post, payment, options)
        post[:customer][:name] = payment.name if post[:customer]
        post[:customer_id] = parse_auth(payment)[0] if payment.is_a?(String)
        post[:payment] = {}
        affiliation = options[:gateway_affiliation_id] || @options[:gateway_id]
Severity: Minor
Found in lib/active_merchant/billing/gateways/mundipagg.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, post)
        add_auth(post)
        post['order.type'] = TRANSACTIONS[action]

        request = post.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
Severity: Minor
Found in lib/active_merchant/billing/gateways/payway.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, params: '', iid: '', card_number: nil, jwt: '')
        response =
          begin
            case action
            when 'void'
Severity: Minor
Found in lib/active_merchant/billing/gateways/priority.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_invoice(doc, money, options)
        doc.amount amount(money) unless money.nil?
        doc.currency_code(options[:currency] || currency(money) || default_currency)
        doc.order_id(options[:order_id])
        doc.ip(options[:ip]) if options[:ip]
Severity: Minor
Found in lib/active_merchant/billing/gateways/spreedly_core.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def message_from(response)
        if response[:faultcode] && response[:faultstring]
          response[:faultstring]
        elsif response[:error_number] && response[:error_number] != '0'
          response[:error_description]
Severity: Minor
Found in lib/active_merchant/billing/gateways/firstdata_e4.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(body)
        # The bp20api has max one value per form field.
        response_fields = CGI::parse(body).map { |k, v| [k.upcase, v.first] }.to_h

        return parse_recurring(response_fields) if response_fields.include? 'REBILL_ID'
Severity: Minor
Found in lib/active_merchant/billing/gateways/blue_pay.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_customer_data(post, options)
        post[:meta] ||= {}

        add_shipping(post, options) if options.key?(:shipping_address)
        post[:meta][:client_customer_id] = options[:customer] if options[:customer]
Severity: Minor
Found in lib/active_merchant/billing/gateways/deepstack.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_credit_card(params, credit_card, action, options)
        return unless credit_card&.is_a?(CreditCard)

        card_details = {}
        card_details['expiryMonth'] = format(credit_card.month, :two_digits).to_s
Severity: Minor
Found in lib/active_merchant/billing/gateways/priority.rb - About 35 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 avs_result_code has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def avs_result_code(xml)
        billing_address_elem = validation_result_element(xml, 'Billing Address')
        zip_code_elem = validation_result_element(xml, 'Zip Code')

        return nil unless billing_address_elem && zip_code_elem
Severity: Minor
Found in lib/active_merchant/billing/gateways/cenpos.rb - About 35 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 build_soap_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def build_soap_request(action, body)
        xml = Builder::XmlMarkup.new(indent: 2)
        xml.tag!('soapenv:Envelope', envelope_namespaces) do
          xml.tag!('soapenv:Header')
          xml.tag!('soapenv:Body') do
Severity: Minor
Found in lib/active_merchant/billing/gateways/ipg.rb - About 35 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_contact_details has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_contact_details(post, contact_details_options)
        contact_details = {}
        contact_details[:documentType] = contact_details_options[:document_type] if contact_details_options[:document_type]
        contact_details[:documentNumber] = contact_details_options[:document_number] if contact_details_options[:document_number]
        contact_details[:email] = contact_details_options[:email] if contact_details_options[:email]
Severity: Minor
Found in lib/active_merchant/billing/gateways/kushki.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, params)
        raw_response = ssl_post(url, post_data(params), headers)
        response = parse(raw_response)
      rescue ResponseError => e
        raw_response = e.response.body
Severity: Minor
Found in lib/active_merchant/billing/gateways/payu_latam.rb - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(request, action, amount, options)
        begin
          raw_response = ssl_post(test? ? self.test_url : self.live_url, build_request(request, options))
        rescue ResponseError => e
          raw_response = e.response.body
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source.rb - About 35 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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def process(ignore_result = false)
        return unless success?

        response = yield
        self << response
Severity: Minor
Found in lib/active_merchant/billing/response.rb - About 35 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_network_token has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_network_token(xml, payment_method, options)
        return unless network_tokenization?(payment_method)

        transaction_type = payment_method.source == :network_token ? '3' : '1'
        xml.tag! 'paymentNetworkToken' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source.rb - About 35 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