Shopify/active_merchant

View on GitHub

Showing 984 of 1,463 total issues

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

      def add_ews_details(xml, payment_source, parameters = {})
        split_name = payment_source.first_name.split if payment_source.first_name
        xml.tag! :EWSFirstName, split_name[0]
        xml.tag! :EWSMiddleName, split_name[1..-1].join(' ')
        xml.tag! :EWSLastName, payment_source.last_name
Severity: Minor
Found in lib/active_merchant/billing/gateways/orbital.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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def process(ignore_result = false)
        return unless success?

        response = yield
        self << response
Severity: Minor
Found in lib/active_merchant/billing/response.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

Avoid too many return statements within this method.
Open

          return response[:szAuthorizationDeclinedMessage]
Severity: Major
Found in lib/active_merchant/billing/gateways/skip_jack.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return response_code if response_code
    Severity: Major
    Found in lib/active_merchant/billing/gateways/payu_latam.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return base + 'noaction'
      Severity: Major
      Found in lib/active_merchant/billing/gateways/deepstack.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return base + 'vault/payment-instrument/token'
        Severity: Major
        Found in lib/active_merchant/billing/gateways/deepstack.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return base + 'payments/refund'
          Severity: Major
          Found in lib/active_merchant/billing/gateways/deepstack.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return base + 'vault/token'
            Severity: Major
            Found in lib/active_merchant/billing/gateways/deepstack.rb - About 30 mins to fix

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

                    def acquire_access_token
                      post = {}
                      base_url = (test? ? test_url : live_url)
                      post[:grant_type] = 'password'
                      post[:username] = @options[:username]
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/pay_trace.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

              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

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

                    def cvv_code_from(response)
                      if response['errors'].present?
                        FRAUD_WARNING_CODES.include?(response['errors'].first['code']) ? 'I' : ''
                      else
                        success?(response) ? 'M' : ''
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/quickbooks.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

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

                    def error_code_from(action, response)
                      unless success_from(action, response)
                        if cause = response['cause']
                          cause.empty? ? nil : cause.first['code']
                        else
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/mercado_pago.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

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

                    def commit(action, post = nil)
                      url = (test? ? self.test_url : self.live_url) + action
              
                      begin
                        if post
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/first_giving.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

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

                    def base_url(soap_action)
                      if soap_action[:confined]
                        test? ? test_confined_url : live_confined_url
                      else
                        test? ? test_external_url : live_external_url
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/payex.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

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

                    def check_token_response(response, endpoint, body = {}, options = {})
                      return response unless @options[:refresh_token]
                      return response unless options[:allow_refresh]
                      return response unless response.params['code'] == 'AuthenticationFailed'
              
              
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/quickbooks.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

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

                    def parse(xml)
                      response = {}
              
                      doc = Nokogiri::XML(xml)
                      doc.xpath('//response/*').each do |node|
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/realex.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

              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

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

                    def amount(money)
                      return nil if money.nil?
              
                      cents =
                        if money.respond_to?(:cents)
              Severity: Minor
              Found in lib/active_merchant/billing/gateway.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

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

                    def post_data(params, use_profile_api)
                      params[:requestType] = 'BACKEND'
                      if use_profile_api
                        params[:merchantId] = @options[:login]
                        params[:passCode] = @options[:secure_profile_api_key]
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.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

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

                    def add_stored_credential(post, options)
                      return unless options[:stored_credential]
              
                      check_initiator = %w[merchant cardholder].any? { |item| item == options[:stored_credential][:initiator] }
                      check_reason_type = %w[recurring installment unscheduled].any? { |item| item == options[:stored_credential][:reason_type] }
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/simetrik.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

              Severity
              Category
              Status
              Source
              Language