activemerchant/active_merchant

View on GitHub
lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb

Summary

Maintainability
C
1 day
Test Coverage

File beanstream_core.rb has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module BeanstreamCore
      include Empty

Severity: Minor
Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb - About 5 hrs to fix

    Method prepare_address_for_non_american_countries has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def prepare_address_for_non_american_countries(options)
            [options[:billing_address], options[:shipping_address]].compact.each do |address|
              next if empty?(address[:country])
    
              unless %w[US CA].include?(address[:country])
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.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 interval has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def interval(options)
            if options.include? :periodicity
              requires!(options, [:periodicity, *PERIODICITIES.keys])
              PERIODICITIES[options[:periodicity]]
            elsif options.include? :interval
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.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 post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def post(data, use_profile_api = nil)
            response = parse(ssl_post((use_profile_api ? SECURE_PROFILE_URL : self.live_url), data))
            response[:customer_vault_id] = response[:customerCode] if response[:customerCode]
            build_response(
              success?(response),
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

          def post_data(params, use_profile_api)
            params[:requestType] = 'BACKEND'
            if use_profile_api
              params[:merchantId] = @options[:login]
              params[:passCode] = @options[:secure_profile_api_key]
    Severity: Minor
    Found in lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    There are no issues that match your filters.

    Category
    Status