activemerchant/active_merchant

View on GitHub

Showing 1,005 of 1,501 total issues

Method list has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def self.list
    hosts = Set.new
    invalid_lines = Set.new

    Dir['lib/**/*.rb'].each do |file|
Severity: Minor
Found in lib/support/outbound_hosts.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 perform_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def perform_request(action, post, options, authorization = nil, method = :post)
        begin
          raw_response = ssl_request(method, url(action, authorization), post.nil? || post.empty? ? nil : post.to_json, headers(action, options))
          response = parse(raw_response)
          response['id'] = response['_links']['payment']['href'].split('/')[-1] if action == :capture && response.key?('_links')
Severity: Minor
Found in lib/active_merchant/billing/gateways/checkout_v2.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_address has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def build_address(xml, addr)
        if addr[:name]
          first_name, last_name = split_names(addr[:name])
          xml.tag! 'firstName', first_name
          xml.tag! 'lastName', last_name
Severity: Minor
Found in lib/active_merchant/billing/gateways/optimal_payment.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_address has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(xml, address)
        return if address.nil?

        xml.tag! 'CORPTRUSTCENTER_DATA' do
          xml.tag! 'ADDRESS' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/wirecard.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_merchant_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_merchant_data(doc, options = {})
        if options[:affiliate] || options[:campaign] || options[:merchant_grouping_id]
          doc.merchantData do
            doc.affiliate(options[:affiliate]) if options[:affiliate]
            doc.campaign(options[:campaign]) if options[:campaign]
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 errors_to_string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def errors_to_string(root)
        # Get context error messages (can be 0..*)
        errors = []
        REXML::XPath.each(root, '//ERROR') do |error_elem|
          error = {}
Severity: Minor
Found in lib/active_merchant/billing/gateways/wirecard.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 11 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, request)
        url = test? ? test_url : live_url
        xml = ssl_post(url, request, 'Content-Type' => 'text/xml')

        response_params = parse(action, xml)
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_authorization_options has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_authorization_options(post, payment, options)
        initiator = options.dig(:stored_credential, :initiator) == 'cardholder' ? 'customer' : 'merchant'
        authorization_options = {
          authorizationOptions: {
            initiator: {
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 credit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def credit(money, payment, options = {})
        action = options[:payout] ? 'payout' : 'refundWithData'
        post = init_post(options)
        add_invoice(post, money, options)
        add_payment(post, payment, options, action)
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 add_customerdetails has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_customerdetails(xml, creditcard, address, options, shipTo = false)
        xml.tag! 'CustomerDetails' do
          if address
            country_code = Country.find(address[:country]).code(:numeric) unless address[:country].blank?
            xml.tag! 'BillingAddress' do
Severity: Minor
Found in lib/active_merchant/billing/gateways/iridium.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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(body)
        top = JSON.parse(body)

        if result = top.delete('result')
          result.split('&').inject({}) do |hash, string|
Severity: Minor
Found in lib/active_merchant/billing/gateways/payu_in.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_address has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, options)
        return unless billing_address = options[:billing_address]

        post[:streetaddress] = billing_address[:address1] if billing_address[:address1]
        post[:streetaddress2] = billing_address[:address2] if billing_address[:address2]
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_customer_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_customer_data(post, options, payment = nil)
        if payment
          post['order']['customer']['personalInformation']['name']['firstName'] = payment.first_name[0..14] if payment.first_name
          post['order']['customer']['personalInformation']['name']['surname'] = payment.last_name[0..69] if payment.last_name
        end
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 add_network_token_info has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_network_token_info(post, payment_method, options)
        # wallet_type is only passed for non-tokenized GooglePay which acts as a CreditCard
        if options[:wallet_type]
          post[:metadata] ||= {}
          post[:metadata][:input_method] = 'GooglePay'
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.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_customer_with_credit_card has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_customer_with_credit_card(creditcard, options)
        commit do
          if options[:payment_method_nonce]
            credit_card_params = { payment_method_nonce: options[:payment_method_nonce] }
          else
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.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_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credential_data(post, payment_method, options)
        post['order.ECI'] = options[:eci] || eci(options)
        if (stored_credential = options[:stored_credential]) && %w(visa master).include?(payment_method.brand)
          post['card.posEntryMode'] = stored_credential[:initial_transaction] ? 'MANUAL' : 'STORED_CREDENTIAL'
          stored_credential_usage(post, payment_method, options) unless stored_credential[:initiator] && stored_credential[:initiator] == 'cardholder'
Severity: Minor
Found in lib/active_merchant/billing/gateways/qvalent.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_transaction_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credential_transaction_type(post, options = {})
        return unless options[:stored_credential_transaction_type]

        stored_credential = options[:stored_credential]
        # Do not add anything unless these are present.
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.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_address has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, address, prefix = '')
        prefix += '_' unless prefix.blank?
        unless address.blank? || address.values.blank?
          post[prefix + 'address1']    = address[:address1].to_s
          post[prefix + 'address2']    = address[:address2].to_s unless address[:address2].blank?
Severity: Minor
Found in lib/active_merchant/billing/gateways/smart_ps.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_purchase_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_purchase_data(xml, money = 0, include_grand_total = false, options = {})
        xml.tag! 'purchaseTotals' do
          xml.tag! 'currency', options[:currency] || currency(money)
          xml.tag!('discountManagementIndicator', options[:discount_management_indicator]) if options[:discount_management_indicator]
          xml.tag!('taxAmount', options[:purchase_tax_amount]) if options[:purchase_tax_amount]
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source.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_managed_billing has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def add_managed_billing(xml, options)
        return unless mb = options[:managed_billing]

        ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE

Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.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