activemerchant/active_merchant

View on GitHub

Showing 1,450 of 1,450 total issues

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 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 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(body)
        response = {}
        xml = Nokogiri::XML(body)

        node = xml.xpath('//Response/TransactionDetails')
Severity: Minor
Found in lib/active_merchant/billing/gateways/creditcall.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(path, parameters, xml = true)
        raw = parse(ssl_get(build_url(path, parameters)), xml)

        success = false
        authorization = (raw['TransactionId'] || parameters[:transactionId])
Severity: Minor
Found in lib/active_merchant/billing/gateways/netaxept.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_bank_account has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_bank_account(xml, bank_account)
        raise StandardError, "Invalid Bank Account Type: #{bank_account[:account_type]}" unless BANK_ACCOUNT_TYPES.include?(bank_account[:account_type])
        raise StandardError, "Invalid eCheck Type: #{bank_account[:echeck_type]}" unless ECHECK_TYPES.include?(bank_account[:echeck_type])

        xml.tag!('bankAccount') do
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_cim.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 validate_three_ds_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_three_ds_params(three_ds)
        errors = {}
        supported_version = %w{1.0.2 2.1.0 2.2.0}.include?(three_ds[:version])
        supported_auth_response = ['Y', 'N', 'U', 'R', 'E', 'A', nil].include?(three_ds[:status])

Severity: Minor
Found in lib/active_merchant/billing/gateways/securion_pay.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_merchant_description has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_merchant_description(post, options)
        return unless options[:merchant_descriptor_name] || options[:merchant_descriptor_address1] || options[:merchant_descriptor_locality]

        merchant = post[:merchantInformation][:merchantDescriptor] = {}
        merchant[:name] = options[:merchant_descriptor_name] if options[:merchant_descriptor_name]
Severity: Minor
Found in lib/active_merchant/billing/gateways/cyber_source_rest.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_order_source has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_order_source(doc, payment_method, options)
        if order_source = options[:order_source]
          doc.orderSource(order_source)
        elsif payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source == :apple_pay
          doc.orderSource('applepay')
Severity: Minor
Found in lib/active_merchant/billing/gateways/litle.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_order has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_order(xml, order)
        xml.tag!('order') do
          xml.tag!('invoiceNumber', order[:invoice_number]) if order[:invoice_number]
          xml.tag!('description', order[:description]) if order[:description]
          xml.tag!('purchaseOrderNumber', order[:purchase_order_number]) if order[:purchase_order_number]
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_cim.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 hash_from_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def hash_from_xml(response)
        hsh = {}
        %w(confirmationNumber authCode
           decision code description
           actionCode avsResponse cvdResponse
Severity: Minor
Found in lib/active_merchant/billing/gateways/optimal_payment.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)
        code = response['result'].first&.dig('transaction', 'responseCode')
        primary_code = response['result'].first['error'].present?
        return unless code == 'D' || primary_code == true || success_from(action, response)

Severity: Minor
Found in lib/active_merchant/billing/gateways/shift4.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_shipping has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_shipping(xml, shipping)
        xml.tag!('shipping') do
          xml.tag!('amount', shipping[:amount]) if shipping[:amount]
          xml.tag!('name', shipping[:name]) if shipping[:name]
          xml.tag!('description', shipping[:description]) if shipping[:description]
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_cim.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_amount_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_amount_details(amount_details, options)
        return unless options

        amount_details[:TaxedAmount] = options[:taxed_amount] if options[:taxed_amount]
        amount_details[:TipAmount] = options[:tip_amount] if options[:tip_amount]
Severity: Minor
Found in lib/active_merchant/billing/gateways/plexo.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 build_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def build_request(action, options = {})
        raise StandardError, "Invalid Customer Information Manager Action: #{action}" unless CIM_ACTIONS.include?(action)

        xml = Builder::XmlMarkup.new(indent: 2)
        xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_cim.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 url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def url(action)
        if action == :store
          test? ? SERVICE_TEST_URL : SERVICE_LIVE_URL
        else
          test? ? test_url : live_url
Severity: Minor
Found in lib/active_merchant/billing/gateways/vantiv_express.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_billing_address has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_billing_address(doc, payment_method, options)
        return if payment_method.is_a?(String)

        doc.billToAddress do
          if check?(payment_method)
Severity: Minor
Found in lib/active_merchant/billing/gateways/litle.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_purchase_card has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_purchase_card(post, options)
        return unless options[:customer_reference] || options[:destination_postal_code] || options[:product_descriptors]

        post[:purchaseCard] = {}
        post[:purchaseCard][:customerReference] = options[:customer_reference] if options[:customer_reference]
Severity: Minor
Found in lib/active_merchant/billing/gateways/shift4.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_tax has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_tax(xml, tax)
        xml.tag!('tax') do
          xml.tag!('amount', tax[:amount]) if tax[:amount]
          xml.tag!('name', tax[:name]) if tax[:name]
          xml.tag!('description', tax[:description]) if tax[:description]
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_cim.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_duty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_duty(xml, duty)
        xml.tag!('duty') do
          xml.tag!('amount', duty[:amount]) if duty[:amount]
          xml.tag!('name', duty[:name]) if duty[:name]
          xml.tag!('description', duty[:description]) if duty[:description]
Severity: Minor
Found in lib/active_merchant/billing/gateways/authorize_net_cim.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