activemerchant/active_merchant

View on GitHub

Showing 999 of 1,496 total issues

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

      def commit(action, params)
        params[action == 'add_customer' ? :customer_vault : :type] = action
        params[:username] = @options[:login] unless @options[:login].nil?
        params[:password] = @options[:password] unless @options[:password].nil?
        params[:security_key] = @options[:security_key] unless @options[:security_key].nil?
Severity: Minor
Found in lib/active_merchant/billing/gateways/nmi.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_payment_method has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_method(post, payment_method, options)
        if payment_method.is_a?(String)
          customer_vault_id, = split_authorization(payment_method)
          post[:customer_vault_id] = customer_vault_id
        elsif payment_method.is_a?(NetworkTokenizationCreditCard)
Severity: Minor
Found in lib/active_merchant/billing/gateways/nmi.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_3dsecure_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_3dsecure_params(post, options)
        post[:xid] = options[:xid] unless empty?(options[:xid])
        post[:cavv] = options[:cavv] unless empty?(options[:cavv])
        post[:ucaf_collection_ind] = options[:ucaf_collection_ind] unless empty?(options[:ucaf_collection_ind])
        post[:ucaf_auth_data] = options[:ucaf_auth_data] unless empty?(options[:ucaf_auth_data])
Severity: Minor
Found in lib/active_merchant/billing/gateways/merchant_e_solutions.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_level_three has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_level_three(post, options = {})
        level_three = {}

        level_three[:merchant_reference] = options[:merchant_reference] if options[:merchant_reference]
        level_three[:customer_reference] = options[:customer_reference] if options[:customer_reference]
Severity: Minor
Found in lib/active_merchant/billing/gateways/stripe_payment_intents.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 message_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def message_from(success, response)
        return response['status'] if success
        return response['message'] if response['message']

        message = nil
Severity: Minor
Found in lib/active_merchant/billing/gateways/decidir.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_basket_product has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_basket_product(post, basket_options)
        basket = []

        basket_options.each do |product|
          obj = {}
Severity: Minor
Found in lib/active_merchant/billing/gateways/moka.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 commit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def commit(action, money, fields, options = {})
        fields[:AMOUNT] = amount(money) unless fields[:TRANS_TYPE] == 'VOID' || action == 'rebill'
        fields[:MODE] = (test? ? 'TEST' : 'LIVE')
        fields[:ACCOUNT_ID] = @options[:login]
        fields[:CUSTOMER_IP] = options[:ip] if options[:ip]
Severity: Minor
Found in lib/active_merchant/billing/gateways/blue_pay.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 create_token has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def create_token(reusable, name, exp_month, exp_year, number, cvc)
Severity: Minor
Found in lib/active_merchant/billing/gateways/worldpay_online_payments.rb - About 45 mins to fix

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

          def url_for(action, post)
            if token?(post)
              [(test? ? TOKEN_TEST_URL : TOKEN_LIVE_URL), action].join('/')
            else
              (test? ? POST_TEST_URL : POST_LIVE_URL)
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/merchant_warrior.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 message_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def message_from(parsed)
            message = parsed[:message]
            if parsed[:response_code].to_i == 2
              if CARD_CODE_ERRORS.include?(parsed[:card_code])
                message = CVVResult.messages[parsed[:card_code]]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/blue_pay.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 commit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def commit(action, parameters, auth = nil)
            url = url_for(action, auth)
            authorization_secret_key = parameters[:authorization_secret_key] if parameters
            parameters.merge!(parameters[:payment][:credit_card].delete(:card)).delete(:payment) if action == 'store'
            response = if %w[refund void].include? action
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/mundipagg.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate
            errors = []
    
            %i[name routing_number account_number].each do |attr|
              errors << [attr, 'cannot be empty'] if empty?(self.send(attr))
    Severity: Minor
    Found in lib/active_merchant/billing/check.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 remote_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def remote_url(url = :primary)
            if url == :primary
              (self.test? ? self.test_url : self.live_url)
            else
              (self.test? ? self.secondary_test_url : self.secondary_live_url)
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/orbital.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 message_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def message_from(results)
            if results[:response_code] == DECLINED
              return CVVResult.messages[results[:card_code]] if CARD_CODE_ERRORS.include?(results[:card_code])
              return AVSResult.messages[results[:avs_result_code]] if AVS_REASON_CODES.include?(results[:response_reason_code]) && AVS_ERRORS.include?(results[:avs_result_code])
            end
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/secure_pay.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_mastercard_network_tokenization_ucaf_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_mastercard_network_tokenization_ucaf_data(xml, payment_method, options)
            return unless network_tokenization?(payment_method) && card_brand(payment_method).to_sym == :master
            return if payment_method.source == :network_token
    
            commerce_indicator = 'internet' if subsequent_nt_apple_pay_auth(payment_method.source, options)
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/cyber_source.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

    Avoid deeply nested control flow statements.
    Open

                    opt_element.add_element('name').text = option[:name] unless option[:name].blank?
    Severity: Major
    Found in lib/active_merchant/billing/gateways/linkpoint.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      opt_element.add_element('value').text = option[:value] unless option[:value].blank?
      Severity: Major
      Found in lib/active_merchant/billing/gateways/linkpoint.rb - About 45 mins to fix

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

              def add_address(doc, options)
                address = options[:billing_address] || {}
                doc.country(address[:country] ? lookup_country_code(address[:country]) : 'NA')
                doc.city(address[:city] || 'City')
                doc.line1(address[:address1] || 'Address')
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/telr.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 full_messages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                  def full_messages
                    result = []
        
                    self.each do |key, messages|
                      next unless messages && !messages.empty?
        Severity: Minor
        Found in lib/active_merchant/billing/compatibility.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 raw_ssl_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def raw_ssl_request(method, endpoint, data, headers = {})
              logger&.warn "#{self.class} using ssl_strict=false, which is insecure" unless ssl_strict
              logger&.warn "#{self.class} posting to plaintext endpoint, which is insecure" unless endpoint.to_s =~ /^https:/
        
              connection = new_connection(endpoint)
        Severity: Minor
        Found in lib/active_merchant/posts_data.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

        Severity
        Category
        Status
        Source
        Language