Showing 1,005 of 1,501 total issues
Method commit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def commit(endpoint, post)
raw_response = ssl_post(url() + endpoint, post_data(post), headers)
response = parse(raw_response)
rescue ResponseError => e
raw_response = e.response.body
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def post_data(money, creditcard, options)
params = parameters(money, creditcard, options)
xml = REXML::Document.new
order = xml.add_element('order')
- 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 add_d3d
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_d3d(post, options)
add_pair post, 'FLAG3D', 'Y'
win_3ds = THREE_D_SECURE_DISPLAY_WAYS.key?(options[:win_3ds]) ?
THREE_D_SECURE_DISPLAY_WAYS[options[:win_3ds]] :
THREE_D_SECURE_DISPLAY_WAYS[:main_window]
Method error_code_from
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def error_code_from(response)
unless success_from(response)
case response['errorCode']
when '3002' then STANDARD_ERROR_CODE[:invalid_number] # You submitted an invalid card number or brand or combination of card number and brand with your request.
when '3004' then STANDARD_ERROR_CODE[:incorrect_zip] # The zip/postal code must be provided for an AVS check request.
Method add_address
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_address(xml, creditcard, options)
return unless creditcard
if address = options[:billing_address] || options[:address]
xml.tag!('CUSTOMER_BILL') do
Method add_customer_data
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_customer_data(post, options)
post[:email] = options[:email]
post[:ipaddress] = options[:ip]
post[:customer_id] = options[:customer_id] || options[:customer]
Method add_settings
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_settings(xml, source, options)
xml.transactionSettings do
if options[:recurring] || subsequent_recurring_transaction?(options)
xml.setting do
xml.settingName('recurringBilling')
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
Method verify
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def verify(creditcard, options = {})
if options[:allow_card_verification] == true
options.delete(:allow_card_verification)
exp_month = creditcard.month.to_s
exp_year = creditcard.year.to_s
Method test_gateways
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def test_gateways(min_version = :TLS1_1)
raise 'Requires Ruby 2.5 or better' unless Net::HTTP.instance_methods.include?(:min_version=)
puts "Verifying #{@gateways.count} gateways for SSL min_version=#{min_version}\n\n"
- 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 add_address
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_address(tag, post, options)
return unless address_options = options[:shipping_address]
address = {}
address[:name] = address_options[:name] if address_options[:name]
- 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 add_level_3_data
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_level_3_data(post, options)
post[:invoice_id] = options[:invoice_id] if options[:invoice_id]
post[:customer_reference_id] = options[:customer_reference_id] if options[:customer_reference_id]
post[:tax_amount] = options[:tax_amount].to_i if options[:tax_amount]
post[:national_tax_amount] = options[:national_tax_amount].to_i if options[:national_tax_amount]
- 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 requires!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def requires!(hash, *params)
params.each do |param|
if param.is_a?(Array)
raise ArgumentError.new("Missing required parameter: #{param.first}") unless hash.has_key?(param.first)
- 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 commit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def commit(action, parameters)
parameters[:request] = action
url = (test? ? test_url : live_url)
payload = parameters.to_json unless parameters.nil?
- 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 commit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def commit(action, parameters)
if action == 'void'
commit_raw(action, parameters)
else
MultiResponse.run(true) do |r|
- 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 parse_response
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_response(response, root)
status = nil
root.elements.to_a.each do |node|
status = REXML::XPath.first(node, 'CC_TRANSACTION/PROCESSING_STATUS') if node.name =~ /FNC_CC_/
- 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 add_credit_card
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_credit_card(xml, credit_card, action)
xml.tag! 'Account' do
if credit_card.track_data.present?
# Track 1 has a start sentinel (STX) of '%' and track 2 is ';'
# Track 1 and 2 have identical end sentinels (ETX) of '?'
- 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 add_transaction_data
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_transaction_data(xml, money, options)
options[:order_id] ||= generate_unique_id
xml.tag! "FNC_CC_#{options[:action].to_s.upcase}" do
xml.tag! 'FunctionID', clean_description(options[:description])
- 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 commit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def commit(action, money, parameters)
case action
when 'sale'
begin
response = call_api(TRANSACTION_API, parameters)
- 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 add_network_tokenization_card
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_network_tokenization_card(xml, payment_method, options)
source = payment_method.respond_to?(:source) ? payment_method.source : options[:wallet_type]
token_type = NETWORK_TOKEN_TYPE.fetch(source, 'NETWORKTOKEN')
xml.paymentDetails do
- 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"