Shopify/active_merchant

View on GitHub
lib/active_merchant/billing/gateways/elavon.rb

Summary

Maintainability
D
2 days
Test Coverage

File elavon.rb has 405 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'active_merchant/billing/gateways/viaklix'
require 'nokogiri'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
Severity: Minor
Found in lib/active_merchant/billing/gateways/elavon.rb - About 5 hrs to fix

    Class ElavonGateway has 42 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class ElavonGateway < Gateway
          include Empty
    
          class_attribute :test_url, :live_url, :delimiter, :actions
    
    
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/elavon.rb - About 5 hrs to fix

      Method add_level_3_fields has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_level_3_fields(xml, options)
              level_3_data = options[:level_3_data]
              xml.ssl_customer_code           level_3_data[:customer_code] if level_3_data[:customer_code]
              xml.ssl_salestax                level_3_data[:salestax] if level_3_data[:salestax]
              xml.ssl_salestax_indicator      level_3_data[:salestax_indicator] if level_3_data[:salestax_indicator]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/elavon.rb - About 3 hrs 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_auth_purchase_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_auth_purchase_params(xml, options)
              xml.ssl_dynamic_dba                     options[:dba] if options.has_key?(:dba)
              xml.ssl_merchant_initiated_unscheduled  merchant_initiated_unscheduled(options) if merchant_initiated_unscheduled(options)
              xml.ssl_add_token                       options[:add_recurring_token] if options.has_key?(:add_recurring_token)
              xml.ssl_token                           options[:ssl_token] if options[:ssl_token]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/elavon.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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_stored_credential(xml, options)
              network_transaction_id = options.dig(:stored_credential, :network_transaction_id)
              case
              when network_transaction_id.nil?
                return
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/elavon.rb - About 45 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 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def purchase(money, payment_method, options = {})
              request = build_xml_request do |xml|
                xml.ssl_vendor_id         @options[:ssl_vendor_id] || options[:ssl_vendor_id]
                xml.ssl_transaction_type  self.actions[:purchase]
                xml.ssl_amount            amount(money)
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/elavon.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

      There are no issues that match your filters.

      Category
      Status