Shopify/active_merchant

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

Summary

Maintainability
F
1 wk
Test Coverage

File orbital.rb has 933 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'active_merchant/billing/gateways/orbital/orbital_soft_descriptors'
require 'rexml/document'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
Severity: Major
Found in lib/active_merchant/billing/gateways/orbital.rb - About 2 days to fix

    Class OrbitalGateway has 96 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class OrbitalGateway < Gateway
          include Empty
    
          API_VERSION = '9.0'
    
    
    Severity: Major
    Found in lib/active_merchant/billing/gateways/orbital.rb - About 1 day to fix

      Method build_customer_request_xml has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_customer_request_xml(credit_card, options = {})
              ActiveMerchant.deprecated 'Customer Profile support in Orbital is non-conformant to the ActiveMerchant API and will be removed in its current form in a future version. Please contact the ActiveMerchant maintainers if you have an interest in modifying it to conform to the store/unstore/update API.'
              xml = xml_envelope
              xml.tag! :Request do
                xml.tag! :Profile do
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/orbital.rb - About 5 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 build_new_order_xml has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

            def build_new_order_xml(action, money, payment_source, parameters = {})
              requires!(parameters, :order_id)
              @use_secondary_url = parameters[:use_secondary_url] if parameters[:use_secondary_url]
              xml = xml_envelope
              xml.tag! :Request do
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/orbital.rb - About 3 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_level2_purchase has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_level2_purchase(xml, options = {})
              if (level2 = options[:level_2_data])
                xml.tag! :PCOrderNum,       byte_limit(level2[:purchase_order], 17) if level2[:purchase_order]
                xml.tag! :PCDestZip,        byte_limit(format_address_field(level2[:zip]), 10) if level2[:zip]
                xml.tag! :PCDestName,       byte_limit(format_address_field(level2[:name]), 30) if level2[:name]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/orbital.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 build_new_order_xml has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def build_new_order_xml(action, money, payment_source, parameters = {})
              requires!(parameters, :order_id)
              @use_secondary_url = parameters[:use_secondary_url] if parameters[:use_secondary_url]
              xml = xml_envelope
              xml.tag! :Request do
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/orbital.rb - About 1 hr to fix

        Method add_ecp_details has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_ecp_details(xml, payment_source, parameters = {})
                requires!(payment_source.account_number) if parameters[:auth_method]&.eql?('A') || parameters[:auth_method]&.eql?('P')
                xml.tag! :ECPActionCode, parameters[:action_code] if parameters[:action_code]
                xml.tag! :ECPCheckSerialNumber, payment_source.account_number if parameters[:auth_method]&.eql?('A') || parameters[:auth_method]&.eql?('P')
                if parameters[:auth_method]&.eql?('P')
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/orbital.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_managed_billing has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_managed_billing(xml, options)
                return unless mb = options[:managed_billing]
        
                ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
        
        
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/orbital.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_level3_purchase has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_level3_purchase(xml, options = {})
                if (level3 = options[:level_3_data])
                  xml.tag! :PC3FreightAmt,    byte_limit(level3[:freight_amount], 12) if level3[:freight_amount]
                  xml.tag! :PC3DutyAmt,       byte_limit(level3[:duty_amount], 12) if level3[:duty_amount]
                  xml.tag! :PC3DestCountryCd, byte_limit(level3[:dest_country], 3) if level3[:dest_country]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/orbital.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 build_customer_request_xml has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def build_customer_request_xml(credit_card, options = {})
                ActiveMerchant.deprecated 'Customer Profile support in Orbital is non-conformant to the ActiveMerchant API and will be removed in its current form in a future version. Please contact the ActiveMerchant maintainers if you have an interest in modifying it to conform to the store/unstore/update API.'
                xml = xml_envelope
                xml.tag! :Request do
                  xml.tag! :Profile do
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/orbital.rb - About 1 hr to fix

          Method add_level2_advice_addendum has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_level2_advice_addendum(xml, options = {})
                  if (level2 = options[:level_2_data])
                    xml.tag! :AMEXTranAdvAddn1, byte_limit(level2[:advice_addendum_1], 40) if level2[:advice_addendum_1]
                    xml.tag! :AMEXTranAdvAddn2, byte_limit(level2[:advice_addendum_2], 40) if level2[:advice_addendum_2]
                    xml.tag! :AMEXTranAdvAddn3, byte_limit(level2[:advice_addendum_3], 40) if level2[:advice_addendum_3]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 55 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_echeck has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_echeck(xml, check, options = {})
                  return unless check
          
                  xml.tag! :CardBrand, 'EC'
                  add_currency_fields(xml, options[:currency])
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 55 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_level3_tax has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_level3_tax(xml, options = {})
                  if (level3 = options[:level_3_data])
                    xml.tag! :PC3VATtaxAmt, byte_limit(level3[:vat_tax], 12) if level3[:vat_tax]
                    xml.tag! :PC3VATtaxRate, byte_limit(level3[:vat_rate], 4) if level3[:vat_rate]
                    xml.tag! :PC3AltTaxInd, byte_limit(level3[:alt_ind], 15) if level3[:alt_ind]
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 55 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_address has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_address(xml, payment_source, options)
                  return unless (address = get_address(options))
          
                  if avs_supported?(address[:country]) || empty?(address[:country])
                    xml.tag! :AVSzip, byte_limit(format_address_field(address[:zip]), 10)
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

                def remote_url(url = :primary)
                  if url == :primary
                    (self.test? ? self.test_url : self.live_url)
                  else
                    (self.test? ? self.secondary_test_url : self.secondary_live_url)
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method add_ews_details has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_ews_details(xml, payment_source, parameters = {})
                  split_name = payment_source.first_name.split if payment_source.first_name
                  xml.tag! :EWSFirstName, split_name[0]
                  xml.tag! :EWSMiddleName, split_name[1..-1].join(' ')
                  xml.tag! :EWSLastName, payment_source.last_name
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 35 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_void_request_xml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def build_void_request_xml(authorization, parameters = {})
                  tx_ref_num, order_id = split_authorization(authorization)
                  xml = xml_envelope
                  xml.tag! :Request do
                    xml.tag! :Reversal do
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 35 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 get_msg_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def get_msg_type(parameters)
                  return parameters[:mit_msg_type] if parameters[:mit_msg_type]
                  return 'CSTO' if parameters[:stored_credential][:initial_transaction]
                  return unless parameters[:stored_credential][:initiator] && parameters[:stored_credential][:reason_type]
          
          
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 35 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_stored_credentials has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_stored_credentials(xml, parameters)
                  return unless parameters[:mit_stored_credential_ind] == 'Y' || parameters[:stored_credential] && !parameters[:stored_credential].values.all?(&:nil?)
          
                  if msg_type = get_msg_type(parameters)
                    xml.tag! :MITMsgType, msg_type
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.rb - About 35 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_digital_token_cryptogram has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_digital_token_cryptogram(xml, credit_card, three_d_secure)
                  return unless credit_card.is_a?(NetworkTokenizationCreditCard) || three_d_secure && credit_card.brand == 'discover'
          
                  cryptogram =
                    if three_d_secure && credit_card.brand == 'discover'
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.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_soft_descriptors_from_specialized_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_soft_descriptors_from_specialized_class(xml, soft_desc)
                  xml.tag! :SDMerchantName, soft_desc.merchant_name             if soft_desc.merchant_name
                  xml.tag! :SDProductDescription, soft_desc.product_description if soft_desc.product_description
                  xml.tag! :SDMerchantCity, soft_desc.merchant_city             if soft_desc.merchant_city
                  xml.tag! :SDMerchantPhone, soft_desc.merchant_phone           if soft_desc.merchant_phone
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.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_line_items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_line_items(xml, options = {})
                  xml.tag! :PC3LineItemCount, byte_limit(options[:line_items].count, 2)
                  xml.tag! :PC3LineItemArray do
                    options[:line_items].each_with_index do |line_item, index|
                      xml.tag! :PC3LineItem do
          Severity: Minor
          Found in lib/active_merchant/billing/gateways/orbital.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 2 locations. Consider refactoring.
          Open

                def add_level3_tax(xml, options = {})
                  if (level3 = options[:level_3_data])
                    xml.tag! :PC3VATtaxAmt, byte_limit(level3[:vat_tax], 12) if level3[:vat_tax]
                    xml.tag! :PC3VATtaxRate, byte_limit(level3[:vat_rate], 4) if level3[:vat_rate]
                    xml.tag! :PC3AltTaxInd, byte_limit(level3[:alt_ind], 15) if level3[:alt_ind]
          Severity: Major
          Found in lib/active_merchant/billing/gateways/orbital.rb and 1 other location - About 1 hr to fix
          lib/active_merchant/billing/gateways/orbital.rb on lines 449..454

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

          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_level2_advice_addendum(xml, options = {})
                  if (level2 = options[:level_2_data])
                    xml.tag! :AMEXTranAdvAddn1, byte_limit(level2[:advice_addendum_1], 40) if level2[:advice_addendum_1]
                    xml.tag! :AMEXTranAdvAddn2, byte_limit(level2[:advice_addendum_2], 40) if level2[:advice_addendum_2]
                    xml.tag! :AMEXTranAdvAddn3, byte_limit(level2[:advice_addendum_3], 40) if level2[:advice_addendum_3]
          Severity: Major
          Found in lib/active_merchant/billing/gateways/orbital.rb and 1 other location - About 1 hr to fix
          lib/active_merchant/billing/gateways/orbital.rb on lines 440..445

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

          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 3 locations. Consider refactoring.
          Open

                CURRENCY_CODES = {
                  'AUD' => '036',
                  'BRL' => '986',
                  'CAD' => '124',
                  'CLP' => '152',
          Severity: Major
          Found in lib/active_merchant/billing/gateways/orbital.rb and 2 other locations - About 45 mins to fix
          lib/active_merchant/billing/gateways/barclaycard_smartpay.rb on lines 134..153
          lib/active_merchant/billing/gateways/orbital.rb on lines 109..128

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

          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 3 locations. Consider refactoring.
          Open

                CURRENCY_EXPONENTS = {
                  'AUD' => '2',
                  'BRL' => '2',
                  'CAD' => '2',
                  'CLP' => '2',
          Severity: Major
          Found in lib/active_merchant/billing/gateways/orbital.rb and 2 other locations - About 45 mins to fix
          lib/active_merchant/billing/gateways/barclaycard_smartpay.rb on lines 134..153
          lib/active_merchant/billing/gateways/orbital.rb on lines 87..106

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

          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