activemerchant/active_merchant

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

Summary

Maintainability
C
1 day
Test Coverage

Class PlexoGateway has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

    class PlexoGateway < Gateway
      self.test_url = 'https://api.testing.plexo.com.uy/v1/payments'
      self.live_url = 'https://api.plexo.com.uy/v1/payments'

      self.supported_countries = ['UY']
Severity: Minor
Found in lib/active_merchant/billing/gateways/plexo.rb - About 4 hrs to fix

    File plexo.rb has 254 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveMerchant #:nodoc:
      module Billing #:nodoc:
        class PlexoGateway < Gateway
          self.test_url = 'https://api.testing.plexo.com.uy/v1/payments'
          self.live_url = 'https://api.plexo.com.uy/v1/payments'
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/plexo.rb - About 2 hrs to fix

      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_payment_method has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_payment_method(post, payment, options)
              post[:paymentMethod] = {}
      
              if payment&.is_a?(CreditCard)
                post[:paymentMethod][:type] = 'card'
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/plexo.rb - About 35 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_amount_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_amount_details(amount_details, options)
              return unless options
      
              amount_details[:TaxedAmount] = options[:taxed_amount] if options[:taxed_amount]
              amount_details[:TipAmount] = options[:tip_amount] if options[:tip_amount]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/plexo.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