activemerchant/active_merchant

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

Summary

Maintainability
F
5 days
Test Coverage

File authorize_net_cim.rb has 554 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    # ==== Customer Information Manager (CIM)
    #
    # The Authorize.Net Customer Information Manager (CIM) is an optional additional service that allows you to store sensitive payment information on
Severity: Major
Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 1 day to fix

    Class AuthorizeNetCimGateway has 56 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class AuthorizeNetCimGateway < Gateway
          self.test_url = 'https://apitest.authorize.net/xml/v1/request.api'
          self.live_url = 'https://api2.authorize.net/xml/v1/request.api'
    
          AUTHORIZE_NET_CIM_NAMESPACE = 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
    Severity: Major
    Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 1 day to fix

      Method add_transaction has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_transaction(xml, transaction)
              raise StandardError, "Invalid Customer Information Manager Transaction Type: #{transaction[:type]}" unless CIM_TRANSACTION_TYPES.include?(transaction[:type])
      
              xml.tag!('transaction') do
                xml.tag!(CIM_TRANSACTION_TYPES[transaction[:type]]) do
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 6 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_payment_profile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_payment_profile(xml, payment_profile)
              # 'individual' or 'business' (optional)
              xml.tag!('customerType', payment_profile[:customer_type]) if payment_profile[:customer_type]
      
              if payment_profile[:bill_to]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/authorize_net_cim.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 parse_direct_response has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def parse_direct_response(params)
              delimiter = @options[:delimiter] || ','
              direct_response = { 'raw' => params }
              direct_response_fields = params.split(delimiter)
              direct_response.merge(
      Severity: Major
      Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 2 hrs to fix

        Method add_profile has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_profile(xml, profile, update = false)
                xml.tag!('profile') do
                  # Merchant assigned ID for the customer. Up to 20 characters. (optional)
                  xml.tag!('merchantCustomerId', profile[:merchant_customer_id]) if profile[:merchant_customer_id]
                  # Description of the customer. Up to 255 Characters (optional)
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/authorize_net_cim.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 parse_element has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_element(node)
                if node.has_elements?
                  response = {}
                  node.elements.each { |e|
                    key = e.name.underscore
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/authorize_net_cim.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_transaction has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def add_transaction(xml, transaction)
                raise StandardError, "Invalid Customer Information Manager Transaction Type: #{transaction[:type]}" unless CIM_TRANSACTION_TYPES.include?(transaction[:type])
        
                xml.tag!('transaction') do
                  xml.tag!(CIM_TRANSACTION_TYPES[transaction[:type]]) do
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb - About 1 hr to fix

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

                def commit(action, request)
                  url = test? ? test_url : live_url
                  xml = ssl_post(url, request, 'Content-Type' => 'text/xml')
          
                  response_params = parse(action, xml)
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.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 create_customer_profile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def create_customer_profile(options)
                  requires!(options, :profile)
                  requires!(options[:profile], :email) unless options[:profile][:merchant_customer_id] || options[:profile][:description]
                  requires!(options[:profile], :description) unless options[:profile][:email] || options[:profile][:merchant_customer_id]
                  requires!(options[:profile], :merchant_customer_id) unless options[:profile][:description] || options[:profile][:email]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.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_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 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 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 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 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

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

                def parse_element(node)
                  if node.has_elements?
                    response = {}
                    node.elements.each { |e|
                      key = e.name.underscore
          Severity: Major
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 1 other location - About 1 hr to fix
          lib/active_merchant/billing/gateways/usa_epay_advanced.rb on lines 1589..1609

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

          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 4 locations. 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: Major
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 3 other locations - About 40 mins to fix
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 704..708
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 720..724
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 728..732

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

          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 4 locations. 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: Major
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 3 other locations - About 40 mins to fix
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 712..716
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 720..724
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 728..732

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

          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 4 locations. 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: Major
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 3 other locations - About 40 mins to fix
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 704..708
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 712..716
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 720..724

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

          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 4 locations. 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: Major
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 3 other locations - About 40 mins to fix
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 704..708
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 712..716
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 728..732

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

          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 build_create_customer_payment_profile_request(xml, options)
                  xml.tag!('customerProfileId', options[:customer_profile_id])
          
                  xml.tag!('paymentProfile') do
                    add_payment_profile(xml, options[:payment_profile])
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 1 other location - About 25 mins to fix
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 595..604

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

          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 build_update_customer_payment_profile_request(xml, options)
                  xml.tag!('customerProfileId', options[:customer_profile_id])
          
                  xml.tag!('paymentProfile') do
                    add_payment_profile(xml, options[:payment_profile])
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/authorize_net_cim.rb and 1 other location - About 25 mins to fix
          lib/active_merchant/billing/gateways/authorize_net_cim.rb on lines 525..534

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

          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