activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

Method add_items has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_items(post, items)
        return unless items&.kind_of?(Array)

        post[:Items] = []

Severity: Minor
Found in lib/active_merchant/billing/gateways/plexo.rb - About 1 hr 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_card has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_card(post, card, action, options = {})
        post[:card] = {}
        if card.is_a?(NetworkTokenizationCreditCard)
          post[:card][:network_token] = card.number
          post[:card][:cryptogram] = card.payment_cryptogram
Severity: Minor
Found in lib/active_merchant/billing/gateways/d_local.rb - About 1 hr 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_authorized_request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def build_authorized_request(action, money, authorization, credit_card, options)
        xml = Builder::XmlMarkup.new

        invoice_no, ref_no, auth_code, acq_ref_data, process_data, record_no, amount = split_authorization(authorization)
        ref_no = '1' if ref_no.blank?
Severity: Minor
Found in lib/active_merchant/billing/gateways/mercury.rb - About 1 hr 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_level_three_information_tags_visa has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_level_three_information_tags_visa(doc, payment_method, level_3_data)
        doc.discountAmount(level_3_data[:discount_amount]) if level_3_data[:discount_amount]
        doc.shippingAmount(level_3_data[:shipping_amount]) if level_3_data[:shipping_amount]
        doc.dutyAmount(level_3_data[:duty_amount]) if level_3_data[:duty_amount]
        doc.detailTax do
Severity: Minor
Found in lib/active_merchant/billing/gateways/litle.rb - About 1 hr 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 url has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def url(endpoint, options = {})
        case endpoint
        when 'settle', 'credit', 'cancel'
          "#{test? ? test_url : live_url}transactions/#{options[:transaction_id]}/#{endpoint}"
        when 'tokenize'
Severity: Minor
Found in lib/active_merchant/billing/gateways/datatrans.rb - About 1 hr 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_element has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_element(node)
        if node.has_elements?
          response = {}
          node.elements.each { |e|
            key = e.name.underscore
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

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

        post[:consumerAuthenticationInformation] ||= {}
        if payment_method.brand == 'master'
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source_rest.rb - About 1 hr 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_element has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_element(node)
        if node.has_elements?
          response = {}
          node.elements.each do |e|
            key = e.name.underscore
Severity: Minor
Found in lib/active_merchant/billing/gateways/usa_epay_advanced.rb - About 1 hr 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_url has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def build_url(action)
        case action
        when 'store'
          "#{test? ? self.test_url : self.live_url}/Recurring/#{API_VERSION}/storeToken"
        when 'finalize3ds'
Severity: Minor
Found in lib/active_merchant/billing/gateways/barclaycard_smartpay.rb - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_recurring_contract(post, options = {}, payment = nil)
        return unless options[:recurring_contract_type] || (payment.try(:network_token?) && options[:switch_cryptogram_mapping_nt])

        post[:recurring] ||= {}
        post[:recurring][:contract] = options[:recurring_contract_type] if options[:recurring_contract_type]
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr 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_raw has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def commit_raw(object, action, parameters)
        if action == 'inquire'
          url = "#{test? ? test_url : live_url}#{object}/#{parameters}"
          begin
            raw_response = ssl_get(url, headers)
Severity: Minor
Found in lib/active_merchant/billing/gateways/paymentez.rb - About 1 hr 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_airline_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_airline_data(post, options)
        return unless airline_options = options[:airline_data]

        airline_data = {}

Severity: Minor
Found in lib/active_merchant/billing/gateways/global_collect.rb - About 1 hr 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 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def authorize(money, payment_method, options = {})
        MultiResponse.run do |r|
          if payment_method.is_a?(CreditCard)
            response = r.process { tokenize(payment_method, options) }
            card_token = response.params['token']
Severity: Minor
Found in lib/active_merchant/billing/gateways/hi_pay.rb - About 1 hr 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 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credential(post, options)
        add_transaction_type(post, options)
        # if :transaction_type option is not passed, then check for :stored_credential options
        return unless (stored_credential = options[:stored_credential]) && options.dig(:transaction_type).nil?

Severity: Minor
Found in lib/active_merchant/billing/gateways/credorax.rb - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_billing_address(post, payment, options)
        return unless billing = options[:billing_address]

        billing_address = {}
        name_from_address(billing_address, billing) || name_from_payment(billing_address, payment)
Severity: Minor
Found in lib/active_merchant/billing/gateways/commerce_hub.rb - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_method_id(credit_card, options)
        if options[:payment_method_id]
          options[:payment_method_id].to_i
        elsif options[:debit]
          if CreditCard.brand?(credit_card.number) == 'visa'
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir.rb - About 1 hr 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 error_code_from has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def error_code_from(response)
        return if success_from(response)

        error_code = nil
        if error = response.dig('status_details', 'error')
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir_plus.rb - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment(post, payment, options = {})
        if payment.is_a?(String)
          token, bin = payment.split('|')
          post[:token] = token
          post[:bin] = bin
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir_plus.rb - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

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

      def post_data(money, creditcard, options)
        params = parameters(money, creditcard, options)

        xml = REXML::Document.new
        order = xml.add_element('order')
Severity: Minor
Found in lib/active_merchant/billing/gateways/linkpoint.rb - About 1 hr 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