Shopify/active_merchant

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

Summary

Maintainability
D
2 days
Test Coverage

Class PriorityGateway has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

    class PriorityGateway < Gateway
      # Sandbox and Production
      self.test_url = 'https://sandbox.api.mxmerchant.com/checkout/v3/payment'
      self.live_url = 'https://api.mxmerchant.com/checkout/v3/payment'

Severity: Minor
Found in lib/active_merchant/billing/gateways/priority.rb - About 6 hrs to fix

    Method add_purchases_data has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_purchases_data(params, options)
            return unless options[:purchases]
    
            params['purchases'] = []
    
    
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/priority.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

    File priority.rb has 311 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveMerchant #:nodoc:
      module Billing #:nodoc:
        class PriorityGateway < Gateway
          # Sandbox and Production
          self.test_url = 'https://sandbox.api.mxmerchant.com/checkout/v3/payment'
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/priority.rb - About 3 hrs to fix

      Method add_additional_data has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_additional_data(params, options)
              params['isAuth'] = options[:is_auth].present? ? options[:is_auth] : 'true'
              params['paymentType'] = options[:payment_type].present? ? options[:payment_type] : 'Sale'
              params['tenderType'] = options[:tender_type].present? ? options[:tender_type] : 'Card'
              params['taxExempt'] = options[:tax_exempt].present? ? options[:tax_exempt] : 'false'
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/priority.rb - About 2 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 commit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def commit(action, params: '', iid: '', card_number: nil, jwt: '')
              response =
                begin
                  case action
                  when 'void'
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/priority.rb - About 1 hr to fix

        Method commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def commit(action, params: '', iid: '', card_number: nil, jwt: '')
                response =
                  begin
                    case action
                    when 'void'
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/priority.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_credit_card has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_credit_card(params, credit_card, action, options)
                return unless credit_card&.is_a?(CreditCard)
        
                card_details = {}
                card_details['expiryMonth'] = format(credit_card.month, :two_digits).to_s
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/priority.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse(body)
                return {} if body.blank?
        
                parsed_response = JSON.parse(body)
                parsed_response.is_a?(String) ? { 'message' => parsed_response } : parsed_response
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/priority.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