activemerchant/active_merchant

View on GitHub

Showing 1,501 of 1,501 total issues

Method build_reference_transaction_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def build_reference_transaction_request(action, money, options)
        currency_code = options[:currency] || currency(money)

        # I am not sure why it's set like this for express gateway
        # but I don't want to break the existing behavior
Severity: Minor
Found in lib/active_merchant/billing/gateways/paypal_express.rb - About 55 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_line_items_into_level_three_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_line_items_into_level_three_data(xml, item, data)
        xml.item do
          xml.description item[:description] if item[:description]
          xml.productCode item[:product_code] if item[:product_code]
          xml.commodityCode item[:commodity_code] if item[:commodity_code]
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_address(post, options)
        if address = options[:billing_address] || options[:address]
          post[:address1] = address[:address1].to_s
          post[:address2] = address[:address2].to_s
          post[:city]     = address[:city].to_s
Severity: Minor
Found in lib/active_merchant/billing/gateways/payscout.rb - About 55 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 amount_for_verify has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def amount_for_verify(options)
        return 100 unless options[:verify_amount].present?

        amount = options[:verify_amount]
        raise ArgumentError.new 'verify_amount value must be an integer' unless amount.is_a?(Integer) && !amount.negative? || amount.is_a?(String) && amount.match?(/^\d+$/) && !amount.to_i.negative?
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 55 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_additional_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_additional_data(post, payment, options)
        post[:additionalData] ||= {}
        post[:additionalData][:overwriteBrand] = normalize(options[:overwrite_brand]) if options[:overwrite_brand]
        post[:additionalData][:customRoutingFlag] = options[:custom_routing_flag] if options[:custom_routing_flag]
        post[:additionalData][:authorisationType] = options[:authorisation_type] if options[:authorisation_type]
Severity: Minor
Found in lib/active_merchant/billing/gateways/adyen.rb - About 55 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_aft_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def build_aft_request(money, payment_method, options)
        build_request do |xml|
          xml.submit do
            xml.order order_tag_attributes(options) do
              xml.description(options[:description].blank? ? 'Account Funding Transaction' : options[:description])
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, request, *success_criteria, options)
        xml = ssl_post(url, request, headers(options))
        raw = parse(action, xml)

        if options[:execute_threed]
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(body)
        reply = {}
        xml = REXML::Document.new(body)
        if root = REXML::XPath.first(xml, '//soap:Fault') then
          reply = parse_fault(root)
Severity: Minor
Found in lib/active_merchant/billing/gateways/eway_managed.rb - About 55 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 create_customer_profile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def create_customer_profile(credit_card, options)
        commit(:cim_store, options) do |xml|
          xml.profile do
            xml.merchantCustomerId(truncate(options[:merchant_customer_id], 20) || SecureRandom.hex(10))
            xml.description(truncate(options[:description], 255)) unless empty?(options[:description])
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net.rb - About 55 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_stored_credentials has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credentials(xml, options)
        return unless options[:stored_credential]

        xml.hps :CardOnFileData do
          if options[:stored_credential][:initiator] == 'customer'
Severity: Minor
Found in lib/active_merchant/billing/gateways/hps.rb - About 55 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_elements has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_elements(node, response)
        node_name = node.name.underscore
        node.attributes.each do |k, v|
          response["#{node_name}_#{k.underscore}".to_sym] = v.value
        end
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay.rb - About 55 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_3d_secure_1_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_3d_secure_1_data(post, options)
        if three_d_secure_options = options[:three_d_secure]
          post[:i8] = build_i8(
            three_d_secure_options[:eci],
            three_d_secure_options[:cavv],
Severity: Minor
Found in lib/active_merchant/billing/gateways/credorax.rb - About 55 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 url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def url(action, url_override = nil)
        if url_override.to_s == 'payment_redirect' && action == 'payments'
          (self.test? ? self.payment_redirect_test : self.payment_redirect_live) + action.to_s
        else
          (self.test? ? self.test_url : self.live_url) + action.to_s
Severity: Minor
Found in lib/active_merchant/billing/gateways/rapyd.rb - About 55 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_stored_credential_used has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_stored_credential_used(post, options)
        post[:payment_information] ||= '2'
        post[:issuer_id] = options[:stored_credential][:network_transaction_id] if options[:issuer_id].blank?
        if options[:stored_credential][:initiator] == 'merchant'
          case options[:stored_credential][:reason_type]
Severity: Minor
Found in lib/active_merchant/billing/gateways/moneris.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

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

        doc.country(address[:country]) if address[:country]
Severity: Minor
Found in lib/active_merchant/billing/gateways/blue_snap.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(response)
        params = {}

        lines = response.split("\n")

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

      def add_stored_credential_initial(post, options)
        post[:payment_information] ||= '0'
        post[:issuer_id] ||= ''
        if options[:stored_credential][:initiator] == 'merchant'
          case options[:stored_credential][:reason_type]
Severity: Minor
Found in lib/active_merchant/billing/gateways/moneris.rb - About 55 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_eci has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def add_credit_card_eci(xml, credit_card, options)
        eci = if credit_card.is_a?(NetworkTokenizationCreditCard) && credit_card.source == :apple_pay && card_brand(credit_card) == 'discover'
                # Payeezy requires an ECI of 5 for apple pay transactions
                # See: https://support.payeezy.com/hc/en-us/articles/203730589-Ecommerce-Flag-Values
                '05'
Severity: Minor
Found in lib/active_merchant/billing/gateways/firstdata_e4_v27.rb - About 55 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 purchase has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def purchase(money, payment, options = {})
        if ach?(payment)
          direct_bank_error = 'Direct bank account transactions are not supported. Bank accounts must be stored and verified before use.'
          return Response.new(false, direct_bank_error)
        end
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe.rb - About 55 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 transaction_hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def transaction_hash(result)
        unless result.success?
          return { 'processor_response_code' => response_code_from_result(result),
                   'additional_processor_response' => additional_processor_response_from_result(result),
                   'payment_instrument_type' => payment_instrument_type(result.transaction),
Severity: Minor
Found in lib/active_merchant/billing/gateways/braintree_blue.rb - About 55 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