activemerchant/active_merchant

View on GitHub

Showing 1,005 of 1,501 total issues

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

      def stored_credential_usage(post, payment_method, options)
        return unless payment_method.brand == 'visa'

        stored_credential = options[:stored_credential]
        if stored_credential[:reason_type] == 'unscheduled'
Severity: Minor
Found in lib/active_merchant/billing/gateways/qvalent.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_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_payment_method_data(payment_method, options = {})
        post = {
          type: 'card',
          card: {
            exp_month: payment_method.month,
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 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_authorization has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def message_from_authorization(response)
        if response[:success]
          return SUCCESS_MESSAGE
        else
          return CARD_CODE_MESSAGES[response[:szCVV2ResponseCode]] if CARD_CODE_ERRORS.include?(response[:szCVV2ResponseCode])
Severity: Minor
Found in lib/active_merchant/billing/gateways/skip_jack.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, 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_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

Avoid deeply nested control flow statements.
Open

              card[:fallback_reason] = 'chip_error' if creditcard.read_method == 'fallback_chip_error'
Severity: Major
Found in lib/active_merchant/billing/gateways/stripe.rb - About 45 mins to fix

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

          def initialize(options = {})
            requires!(options, :merchant_id, :public_key, :private_key)
            @merchant_account_id = options[:merchant_account_id]
    
            super
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/braintree_blue.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 map_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def map_address(address)
            mapped = {
              street_address: address[:address1],
              extended_address: address[:address2],
              company: address[:company],
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/braintree_blue.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, 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 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, 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 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

      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 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

      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

      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
        Severity
        Category
        Status
        Source
        Language