activemerchant/active_merchant

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

Summary

Maintainability
C
1 day
Test Coverage

Class EbanxGateway has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

    class EbanxGateway < Gateway
      self.test_url = 'https://sandbox.ebanxpay.com/ws/'
      self.live_url = 'https://api.ebanxpay.com/ws/'

      self.supported_countries = %w(BR MX CO CL AR PE BO EC)
Severity: Minor
Found in lib/active_merchant/billing/gateways/ebanx.rb - About 4 hrs to fix

    File ebanx.rb has 288 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveMerchant #:nodoc:
      module Billing #:nodoc:
        class EbanxGateway < Gateway
          self.test_url = 'https://sandbox.ebanxpay.com/ws/'
          self.live_url = 'https://api.ebanxpay.com/ws/'
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/ebanx.rb - About 2 hrs to fix

      Method add_customer_responsible_person has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_customer_responsible_person(post, payment, options)
              post[:payment][:person_type] = options[:person_type] if options[:person_type]
              if options[:person_type]&.casecmp('business')&.zero?
                post[:payment][:responsible] = {}
                post[:payment][:responsible][:name] = options[:responsible_name] if options[:responsible_name]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/ebanx.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 add_address has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_address(post, options)
              if address = options[:billing_address] || options[:address]
                post[:payment][:address] = address[:address1].split[1..-1].join(' ') if address[:address1]
                post[:payment][:street_number] = address[:address1].split.first if address[:address1]
                post[:payment][:city] = address[:city]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/ebanx.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