Shopify/active_merchant

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

Summary

Maintainability
F
6 days
Test Coverage

File litle.rb has 543 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'nokogiri'

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class LitleGateway < Gateway
Severity: Major
Found in lib/active_merchant/billing/gateways/litle.rb - About 1 day to fix

    Method add_line_item_information_for_level_three_visa has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_line_item_information_for_level_three_visa(doc, payment_method, level_3_data)
            doc.lineItemData do
              level_3_data[:line_items].each do |line_item|
                doc.itemSequenceNumber(line_item[:item_sequence_number]) if line_item[:item_sequence_number]
                doc.commodityCode(line_item[:commodity_code]) if line_item[:commodity_code]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/litle.rb - About 7 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

    Class LitleGateway has 49 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class LitleGateway < Gateway
          SCHEMA_VERSION = '9.14'
    
          class_attribute :postlive_url, :prelive_url
    
    
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/litle.rb - About 6 hrs to fix

      Method add_level_two_data has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_level_two_data(doc, payment_method, options = {})
              level_2_data = options[:level_2_data]
              if level_2_data
                doc.enhancedData do
                  case payment_method.brand
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/litle.rb - About 4 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_level_three_information_tags_master has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_level_three_information_tags_master(doc, payment_method, level_3_data)
              doc.customerReference :customerReference, level_3_data[:customer_code] if level_3_data[:customer_code]
              doc.salesTax(level_3_data[:total_tax_amount]) if level_3_data[:total_tax_amount]
              doc.detailTax do
                doc.taxIncludedInTotal(level_3_data[:tax_included_in_total]) if level_3_data[:tax_included_in_total]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/litle.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_payment_method has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_payment_method(doc, payment_method, options)
              if payment_method.is_a?(String)
                doc.token do
                  doc.litleToken(payment_method)
                  doc.expDate(format_exp_date(options[:basis_expiration_month], options[:basis_expiration_year])) if options[:basis_expiration_month] && options[:basis_expiration_year]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/litle.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_address has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_address(doc, address)
              return unless address
      
              doc.companyName(address[:company]) unless address[:company].blank?
              doc.addressLine1(truncate(address[:address1], 35)) unless address[:address1].blank?
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/litle.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_level_three_information_tags_visa has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

            def add_level_three_information_tags_visa(doc, payment_method, level_3_data)
              doc.discountAmount(level_3_data[:discount_amount]) if level_3_data[:discount_amount]
              doc.shippingAmount(level_3_data[:shipping_amount]) if level_3_data[:shipping_amount]
              doc.dutyAmount(level_3_data[:duty_amount]) if level_3_data[:duty_amount]
              doc.detailTax do
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/litle.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_payment_method has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def add_payment_method(doc, payment_method, options)
              if payment_method.is_a?(String)
                doc.token do
                  doc.litleToken(payment_method)
                  doc.expDate(format_exp_date(options[:basis_expiration_month], options[:basis_expiration_year])) if options[:basis_expiration_month] && options[:basis_expiration_year]
      Severity: Minor
      Found in lib/active_merchant/billing/gateways/litle.rb - About 1 hr to fix

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

              def add_merchant_data(doc, options = {})
                if options[:affiliate] || options[:campaign] || options[:merchant_grouping_id]
                  doc.merchantData do
                    doc.affiliate(options[:affiliate]) if options[:affiliate]
                    doc.campaign(options[:campaign]) if options[:campaign]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.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 refund has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def refund(money, payment, options = {})
                request = build_xml_request do |doc|
                  add_authentication(doc)
                  add_descriptor(doc, options)
                  doc.send(refund_type(payment), transaction_attributes(options)) do
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.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 store has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def store(payment_method, options = {})
                request = build_xml_request do |doc|
                  add_authentication(doc)
                  doc.registerTokenRequest(transaction_attributes(options)) do
                    doc.orderId(truncate(options[:order_id], 24))
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.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_descriptor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_descriptor(doc, options)
                if options[:descriptor_name] || options[:descriptor_phone]
                  doc.customBilling do
                    doc.phone(options[:descriptor_phone]) if options[:descriptor_phone]
                    doc.descriptor(options[:descriptor_name]) if options[:descriptor_name]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.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_stored_credential_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_stored_credential_params(doc, options = {})
                return unless stored_credential = options[:stored_credential]
        
                if stored_credential[:initial_transaction]
                  add_stored_credential_for_initial_txn(doc, options)
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.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_billing_address has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_billing_address(doc, payment_method, options)
                return if payment_method.is_a?(String)
        
                doc.billToAddress do
                  if check?(payment_method)
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb - About 25 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

              def add_order_source(doc, payment_method, options)
                if order_source = options[:order_source]
                  doc.orderSource(order_source)
                elsif payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source == :apple_pay
                  doc.orderSource('applepay')
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb - About 25 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

                doc.detailTax do
                  doc.taxIncludedInTotal(level_3_data[:tax_included_in_total]) if level_3_data[:tax_included_in_total]
                  doc.taxAmount(level_3_data[:tax_amount]) if level_3_data[:tax_amount]
                  doc.taxRate(level_3_data[:tax_rate]) if level_3_data[:tax_rate]
                  doc.taxTypeIdentifier(level_3_data[:tax_type_identifier]) if level_3_data[:tax_type_identifier]
        Severity: Major
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 1 hr to fix
        lib/active_merchant/billing/gateways/litle.rb on lines 122..127

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

        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

                    doc.detailTax do
                      doc.taxIncludedInTotal(line_item[:tax_included_in_total]) if line_item[:tax_included_in_total]
                      doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
                      doc.taxRate(line_item[:tax_rate]) if line_item[:tax_rate]
                      doc.taxTypeIdentifier(line_item[:tax_type_identifier]) if line_item[:tax_type_identifier]
        Severity: Major
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 1 hr to fix
        lib/active_merchant/billing/gateways/litle.rb on lines 81..86

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

        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 purchase(money, payment_method, options = {})
                request = build_xml_request do |doc|
                  add_authentication(doc)
                  if check?(payment_method)
                    doc.echeckSale(transaction_attributes(options)) do
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 55 mins to fix
        lib/active_merchant/billing/gateways/litle.rb on lines 133..147

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

        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 authorize(money, payment_method, options = {})
                request = build_xml_request do |doc|
                  add_authentication(doc)
                  if check?(payment_method)
                    doc.echeckVerification(transaction_attributes(options)) do
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 55 mins to fix
        lib/active_merchant/billing/gateways/litle.rb on lines 27..41

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

        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

                  if node.elements.empty?
                    parsed[node.name.to_sym] = node.text
                  else
                    node.elements.each do |childnode|
                      name = "#{node.name}_#{childnode.name}"
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 30 mins to fix
        lib/active_merchant/billing/gateways/bpoint.rb on lines 223..228

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

        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

              AVS_RESPONSE_CODE = {
                '00' => 'Y',
                '01' => 'X',
                '02' => 'D',
                '10' => 'Z',
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 30 mins to fix
        lib/active_merchant/billing/gateways/paybox_direct.rb on lines 23..38

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

        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

                      doc.detailTax do
                        doc.taxIncludedInTotal(level_2_data[:tax_included_in_total]) if level_2_data[:tax_included_in_total]
                        doc.taxAmount(level_2_data[:tax_amount]) if level_2_data[:tax_amount]
                        doc.cardAcceptorTaxId(level_2_data[:card_acceptor_tax_id]) if level_2_data[:card_acceptor_tax_id]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 25 mins to fix
        lib/active_merchant/billing/gateways/litle.rb on lines 348..351

        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

                  doc.merchantData do
                    doc.affiliate(options[:affiliate]) if options[:affiliate]
                    doc.campaign(options[:campaign]) if options[:campaign]
                    doc.merchantGroupingId(options[:merchant_grouping_id]) if options[:merchant_grouping_id]
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 25 mins to fix
        lib/active_merchant/billing/gateways/litle.rb on lines 53..56

        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 scrub(transcript)
                transcript.
                  gsub(%r((<user>).+(</user>)), '\1[FILTERED]\2').
                  gsub(%r((<password>).+(</password>)), '\1[FILTERED]\2').
                  gsub(%r((<number>).+(</number>)), '\1[FILTERED]\2').
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 25 mins to fix
        lib/active_merchant/billing/gateways/authorize_net.rb on lines 225..235

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

        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_stored_credential_for_initial_txn(doc, options)
                case options[:stored_credential][:reason_type]
                when 'unscheduled'
                  doc.processingType('initialCOF')
                when 'installment'
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 15 mins to fix
        lib/active_merchant/billing/gateways/litle.rb on lines 442..449

        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

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

              def source_for_subsequent_stored_credential_txns(doc, options)
                case options[:stored_credential][:reason_type]
                when 'unscheduled'
                  doc.orderSource('ecommerce')
                when 'installment'
        Severity: Minor
        Found in lib/active_merchant/billing/gateways/litle.rb and 1 other location - About 15 mins to fix
        lib/active_merchant/billing/gateways/litle.rb on lines 431..438

        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

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

              def verify(creditcard, options = {})
                MultiResponse.run(:use_first_response) do |r|
                  r.process { authorize(0, creditcard, options) }
                  r.process(:ignore_result) { void(r.authorization, options) }
        Severity: Major
        Found in lib/active_merchant/billing/gateways/litle.rb and 46 other locations - About 15 mins to fix
        lib/active_merchant/billing/gateways/airwallex.rb on lines 95..98
        lib/active_merchant/billing/gateways/allied_wallet.rb on lines 64..67
        lib/active_merchant/billing/gateways/axcessms.rb on lines 52..55
        lib/active_merchant/billing/gateways/bank_frick.rb on lines 78..81
        lib/active_merchant/billing/gateways/beanstream.rb on lines 109..112
        lib/active_merchant/billing/gateways/bridge_pay.rb on lines 70..73
        lib/active_merchant/billing/gateways/card_stream.rb on lines 197..200
        lib/active_merchant/billing/gateways/cardknox.rb on lines 82..85
        lib/active_merchant/billing/gateways/cenpos.rb on lines 76..79
        lib/active_merchant/billing/gateways/checkout.rb on lines 86..89
        lib/active_merchant/billing/gateways/clearhaus.rb on lines 90..93
        lib/active_merchant/billing/gateways/creditcall.rb on lines 106..109
        lib/active_merchant/billing/gateways/credorax.rb on lines 232..235
        lib/active_merchant/billing/gateways/culqi.rb on lines 81..84
        lib/active_merchant/billing/gateways/dibs.rb on lines 62..65
        lib/active_merchant/billing/gateways/ezic.rb on lines 72..75
        lib/active_merchant/billing/gateways/forte.rb on lines 90..93
        lib/active_merchant/billing/gateways/iveri.rb on lines 65..68
        lib/active_merchant/billing/gateways/ixopay.rb on lines 65..68
        lib/active_merchant/billing/gateways/mastercard.rb on lines 64..67
        lib/active_merchant/billing/gateways/maxipago.rb on lines 62..65
        lib/active_merchant/billing/gateways/merchant_partners.rb on lines 72..75
        lib/active_merchant/billing/gateways/merchant_ware_version_four.rb on lines 111..114
        lib/active_merchant/billing/gateways/micropayment.rb on lines 57..60
        lib/active_merchant/billing/gateways/moka.rb on lines 106..109
        lib/active_merchant/billing/gateways/monei.rb on lines 117..120
        lib/active_merchant/billing/gateways/mundipagg.rb on lines 86..89
        lib/active_merchant/billing/gateways/ncr_secure_pay.rb on lines 61..64
        lib/active_merchant/billing/gateways/ogone.rb on lines 207..210
        lib/active_merchant/billing/gateways/openpay.rb on lines 73..76
        lib/active_merchant/billing/gateways/opp.rb on lines 151..154
        lib/active_merchant/billing/gateways/pagarme.rb on lines 66..69
        lib/active_merchant/billing/gateways/pay_junction_v2.rb on lines 74..77
        lib/active_merchant/billing/gateways/payeezy.rb on lines 117..120
        lib/active_merchant/billing/gateways/pro_pay.rb on lines 204..207
        lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb on lines 71..74
        lib/active_merchant/billing/gateways/reach.rb on lines 111..114
        lib/active_merchant/billing/gateways/s5.rb on lines 92..95
        lib/active_merchant/billing/gateways/sage_pay.rb on lines 177..180
        lib/active_merchant/billing/gateways/securion_pay.rb on lines 66..69
        lib/active_merchant/billing/gateways/smart_ps.rb on lines 79..82
        lib/active_merchant/billing/gateways/transact_pro.rb on lines 102..105
        lib/active_merchant/billing/gateways/usa_epay_transaction.rb on lines 107..110
        lib/active_merchant/billing/gateways/visanet_peru.rb on lines 68..71
        lib/active_merchant/billing/gateways/world_net.rb on lines 84..87
        lib/active_merchant/billing/gateways/worldpay_us.rb on lines 68..71

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

        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