Shopify/active_merchant

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

Summary

Maintainability
F
6 days
Test Coverage

File adyen.rb has 804 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class AdyenGateway < Gateway
      # we recommend setting up merchant-specific endpoints.
      # https://docs.adyen.com/developers/api-manual#apiendpoints
Severity: Major
Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 day to fix

    Class AdyenGateway has 76 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class AdyenGateway < Gateway
          # we recommend setting up merchant-specific endpoints.
          # https://docs.adyen.com/developers/api-manual#apiendpoints
          self.test_url = 'https://pal-test.adyen.com/pal/servlet/'
          self.live_url = 'https://pal-live.adyen.com/pal/servlet/'
    Severity: Major
    Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 day to fix

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

            def add_3ds(post, options)
              if three_ds_2_options = options[:three_ds_2]
                device_channel = three_ds_2_options[:channel]
                if device_channel == 'app'
                  post[:threeDS2RequestData] = { deviceChannel: device_channel }
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/adyen.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 add_address has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_address(post, options)
              if address = options[:shipping_address]
                post[:deliveryAddress] = {}
                post[:deliveryAddress][:street] = options[:address_override] == true ? address[:address2] : address[:address1] || 'NA'
                post[:deliveryAddress][:houseNumberOrName] = options[:address_override] == true ? address[:address1] : address[:address2] || 'NA'
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr 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_extra_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_extra_data(post, payment, options)
              post[:telephoneNumber] = (options[:billing_address][:phone_number] if options.dig(:billing_address, :phone_number)) || (options[:billing_address][:phone] if options.dig(:billing_address, :phone)) || ''
              post[:selectedBrand] = options[:selected_brand] if options[:selected_brand]
              post[:selectedBrand] ||= NETWORK_TOKENIZATION_CARD_SOURCE[payment.source.to_s] if payment.is_a?(NetworkTokenizationCreditCard)
              post[:deliveryDate] = options[:delivery_date] if options[:delivery_date]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr 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_data_airline has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def add_data_airline(post, options)
              return unless options[:additional_data_airline]
      
              mapper = %w[
                agency_invoice_number
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if response['refusalReason'] && response['additionalData'] && (response['additionalData']['merchantAdviceCode'] || response['additionalData']['refusalReasonRaw'])
                  "#{response['refusalReason']} | #{response['additionalData']['merchantAdviceCode'] || response['additionalData']['refusalReasonRaw']}"
                else
                  response['refusalReason'] || response['resultCode'] || response['message'] || response['result']
                end
        Severity: Critical
        Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr to fix

          Method credit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                def credit(money, payment, options = {})
                  action = options[:payout] ? 'payout' : 'refundWithData'
                  post = init_post(options)
                  add_invoice(post, money, options)
                  add_payment(post, payment, options, action)
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr 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_additional_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_additional_data(post, payment, options)
                  post[:additionalData] ||= {}
                  post[:additionalData][:overwriteBrand] = normalize(options[:overwrite_brand]) if options[:overwrite_brand]
                  post[:additionalData][:customRoutingFlag] = options[:custom_routing_flag] if options[:custom_routing_flag]
                  post[:additionalData]['paymentdatasource.type'] = NETWORK_TOKENIZATION_CARD_SOURCE[payment.source.to_s] if payment.is_a?(NetworkTokenizationCreditCard)
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr 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_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_merchant_data(post, options)
                  post[:additionalData][:subMerchantID] = options[:sub_merchant_id] if options[:sub_merchant_id]
                  post[:additionalData][:subMerchantName] = options[:sub_merchant_name] if options[:sub_merchant_name]
                  post[:additionalData][:subMerchantStreet] = options[:sub_merchant_street] if options[:sub_merchant_street]
                  post[:additionalData][:subMerchantCity] = options[:sub_merchant_city] if options[:sub_merchant_city]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/adyen.rb - About 1 hr 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_recurring_processing_model has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_recurring_processing_model(post, options)
                  return unless options.dig(:stored_credential, :reason_type) || options[:recurring_processing_model]
          
                  if options.dig(:stored_credential, :reason_type) == 'unscheduled'
                    if options.dig(:stored_credential, :initiator) == 'merchant'
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/adyen.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 success_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def success_from(action, response, options)
                  if %w[RedirectShopper ChallengeShopper].include?(response.dig('resultCode')) && !options[:execute_threed] && (!options[:threed_dynamic] || options[:ignore_threed_dynamic])
                    response['refusalReason'] = 'Received unexpected 3DS authentication response, but a 3DS initiation flag was not included in the request.'
                    return false
                  end
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/adyen.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

          Consider simplifying this complex logical expression.
          Open

                  if response['refusalReason'] && response['additionalData'] && response['additionalData']['refusalReasonRaw']
                    "#{response['refusalReason']} | #{response['additionalData']['refusalReasonRaw']}"
                  else
                    response['refusalReason'] || response['resultCode'] || response['message'] || response['result']
                  end
          Severity: Major
          Found in lib/active_merchant/billing/gateways/adyen.rb - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if  (options.dig(:stored_credential, :initial_transaction) && options.dig(:stored_credential, :initiator) == 'cardholder') ||
                        (payment.respond_to?(:verification_value) && payment.verification_value && options.dig(:stored_credential, :initial_transaction).nil?) ||
                        payment.is_a?(NetworkTokenizationCreditCard)
                      shopper_interaction = 'Ecommerce'
                    else
            Severity: Major
            Found in lib/active_merchant/billing/gateways/adyen.rb - About 40 mins to fix

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

                    def add_splits(post, options)
                      return unless split_data = options[:splits]
              
                      splits = []
                      split_data.each do |split|
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.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_shopper_interaction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def add_shopper_interaction(post, payment, options = {})
                      if  (options.dig(:stored_credential, :initial_transaction) && options.dig(:stored_credential, :initiator) == 'cardholder') ||
                          (payment.respond_to?(:verification_value) && payment.verification_value && options.dig(:stored_credential, :initial_transaction).nil?) ||
                          payment.is_a?(NetworkTokenizationCreditCard)
                        shopper_interaction = 'Ecommerce'
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.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_fund_source has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def add_fund_source(post, options)
                      return unless fund_source = options[:fund_source]
              
                      post[:fundSource] = {}
                      post[:fundSource][:additionalData] = fund_source[:additional_data] if fund_source[:additional_data]
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.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_payment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def add_payment(post, payment, options, action = nil)
                      if payment.is_a?(String)
                        _, _, recurring_detail_reference = payment.split('#')
                        post[:selectedRecurringDetailReference] = recurring_detail_reference
                        options[:recurring_contract_type] ||= 'RECURRING'
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.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 authorize_message_from has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def authorize_message_from(response, options = {})
                      return raw_authorize_error_message(response) if options[:raw_error_message]
              
                      if response['refusalReason'] && response['additionalData'] && (response['additionalData']['merchantAdviceCode'] || response['additionalData']['refusalReasonRaw'])
                        "#{response['refusalReason']} | #{response['additionalData']['merchantAdviceCode'] || response['additionalData']['refusalReasonRaw']}"
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.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 store has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def store(credit_card, options = {})
                      requires!(options, :order_id)
                      post = init_post(options)
                      add_invoice(post, 0, options)
                      add_payment(post, credit_card, options)
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.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(post, options, address)
                      post[:billingAddress] = {}
                      post[:billingAddress][:street] = options[:address_override] == true ? address[:address2] : address[:address1] || 'NA'
                      post[:billingAddress][:houseNumberOrName] = options[:address_override] == true ? address[:address1] : address[:address2] || 'NA'
                      post[:billingAddress][:postalCode] = address[:zip] if address[:zip]
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.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_recurring_contract has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def add_recurring_contract(post, options = {})
                      return unless options[:recurring_contract_type]
              
                      post[:recurring] = {}
                      post[:recurring][:contract] = options[:recurring_contract_type]
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                    AVS_MAPPING = {
                      '0'  => 'R',  # Unknown
                      '1'  => 'A',  # Address matches, postal code doesn't
                      '2'  => 'N',  # Neither postal code nor address match
                      '3'  => 'R',  # AVS unavailable
              Severity: Major
              Found in lib/active_merchant/billing/gateways/adyen.rb and 2 other locations - About 1 hr to fix
              lib/active_merchant/billing/gateways/blue_snap.rb on lines 34..61
              lib/active_merchant/billing/gateways/payway_dot_com.rb on lines 24..51

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 56.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                    self.supported_countries = %w(AT AU BE BG BR CH CY CZ DE DK EE ES FI FR GB GI GR HK HU IE IS IT LI LT LU LV MC MT MX NL NO PL PT RO SE SG SK SI US)
              Severity: Major
              Found in lib/active_merchant/billing/gateways/adyen.rb and 4 other locations - About 50 mins to fix
              lib/active_merchant/billing/gateways/commercegate.rb on lines 6..9
              lib/active_merchant/billing/gateways/monei.rb on lines 16..16
              lib/active_merchant/billing/gateways/securion_pay.rb on lines 7..8
              lib/active_merchant/billing/gateways/wirecard.rb on lines 30..30

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 42.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                    def add_browser_info(browser_info, post)
                      return unless browser_info
              
                      post[:browserInfo] = {
                        acceptHeader: browser_info[:accept_header],
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.rb and 1 other location - About 45 mins to fix
              lib/active_merchant/billing/gateways/barclaycard_smartpay.rb on lines 381..393

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 41.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    def add_3ds_authenticated_data(post, options)
                      if options[:three_d_secure] && options[:three_d_secure][:eci] && options[:three_d_secure][:xid]
                        add_3ds1_authenticated_data(post, options)
                      elsif options[:three_d_secure]
                        add_3ds2_authenticated_data(post, options)
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.rb and 1 other location - About 20 mins to fix
              lib/active_merchant/billing/gateways/monei.rb on lines 256..261

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                        if device_channel == 'app'
                          post[:threeDS2RequestData] = { deviceChannel: device_channel }
                        else
                          add_browser_info(three_ds_2_options[:browser_info], post)
                          post[:threeDS2RequestData] = { deviceChannel: device_channel, notificationURL: three_ds_2_options[:notification_url] }
              Severity: Minor
              Found in lib/active_merchant/billing/gateways/adyen.rb and 1 other location - About 15 mins to fix
              lib/active_merchant/billing/gateways/barclaycard_smartpay.rb on lines 361..365

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 26.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status