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
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])
- Read upRead up
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
- Read upRead up
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),
- Read upRead up
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]
- Read upRead up
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"