activemerchant/active_merchant

View on GitHub
lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb

Summary

Maintainability
C
1 day
Test Coverage

Class CecabankJsonGateway has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

    class CecabankJsonGateway < Gateway
      include CecabankCommon

      CECA_ACTIONS_DICTIONARY = {
        purchase: :REST_AUTORIZACION,
Severity: Minor
Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb - About 4 hrs to fix

    File cecabank_json.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'active_merchant/billing/gateways/cecabank/cecabank_common'
    
    module ActiveMerchant
      module Billing
        class CecabankJsonGateway < Gateway
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb - About 2 hrs to fix

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

            def add_stored_credentials(post, creditcard, options)
              return unless stored_credential = options[:stored_credential]
      
              return if options[:exemption_type].blank? && !(stored_credential[:reason_type] && stored_credential[:initiator])
      
      
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.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_auth_invoice_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def add_auth_invoice_data(action, post, money, authorization, options)
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb - About 35 mins to fix

        Method add_three_d_secure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_three_d_secure(post, options)
                params = post[:parametros] ||= {}
                return unless three_d_secure = options[:three_d_secure]
        
                params[:exencionSCA] ||= CECA_SCA_TYPES.fetch(options[:exemption_type]&.to_sym, :NONE)
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/cecabank/cecabank_json.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