Showing 1,501 of 1,501 total issues
Method transaction_element
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def transaction_element(action, parameters)
transaction = REXML::Element.new(action)
# Must add the elements in the correct order
actions[action].each do |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"
Further reading
Method add_address
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def add_address(post, options)
if address = options[:billing_address] || options[:address]
post[:address] = address[:address1] if address[:address1]
post[:address2] = address[:address2] if address[:address2]
post[:city] = address[:city] if address[:city]
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def add_address(post, options)
if (address = (options[:billing_address] || options[:address]))
post[:address] = {}
post[:address][:street1] = address[:address1] if address[:address1]
post[:address][:street2] = address[:address2] if address[:address2]
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def add_address(post, options)
return unless post[:card]&.kind_of?(Hash)
if address = options[:billing_address] || options[:address]
post[:card][:address_line1] = address[:address1] if address[:address1]
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def post_data(params)
return nil unless params
params.map do |key, value|
next if value != false && value.blank?
- 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_billing_address
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def add_billing_address(xml, creditcard, options)
address = options[:billing_address]
return unless address
xml.billing 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"
Further reading
Method add_shipping
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def add_shipping(xml, shipping)
xml.tag!('v1:Shipping') do
xml.tag!('v1:Type', shipping[:type]) if shipping[:type]
xml.tag!('v1:Name', shipping[:name]) if shipping[:name]
xml.tag!('v1:Address1', shipping[:address_1]) if shipping[:address_1]
- 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_direct_response
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_direct_response(params)
delimiter = @options[:delimiter] || ','
direct_response = { 'raw' => params }
direct_response_fields = params.split(delimiter)
direct_response.merge(
File vanco.rb
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
module ActiveMerchant
module Billing
class VancoGateway < Gateway
File ixopay.rb
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class IxopayGateway < Gateway
Method parameters
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parameters(money, creditcard, options = {})
params = {
# General order parameters
StoreID: @options[:login],
Passphrase: @options[:password],
File cecabank_json.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_merchant/billing/gateways/cecabank/cecabank_common'
module ActiveMerchant
module Billing
class CecabankJsonGateway < Gateway
Similar blocks of code found in 2 locations. Consider refactoring. Open
def authorize(money, creditcard_or_datakey, options = {})
requires!(options, :order_id)
post = {}
add_payment_source(post, creditcard_or_datakey, options)
post[:amount] = amount(money)
- Read upRead up
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 78.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
STANDARD_ERROR_CODE_MAPPING = {
'R101' => STANDARD_ERROR_CODE[:incorrect_number],
'R102' => STANDARD_ERROR_CODE[:invalid_number],
'R103' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'R104' => STANDARD_ERROR_CODE[:invalid_cvc],
- Read upRead up
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 78.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
STANDARD_ERROR_CODE_MAPPING = {
'2127' => STANDARD_ERROR_CODE[:incorrect_address],
'22' => STANDARD_ERROR_CODE[:card_declined],
'227' => STANDARD_ERROR_CODE[:incorrect_address],
'23' => STANDARD_ERROR_CODE[:card_declined],
- Read upRead up
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 78.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def purchase(money, creditcard_or_datakey, options = {})
requires!(options, :order_id)
post = {}
add_payment_source(post, creditcard_or_datakey, options)
post[:amount] = amount(money)
- Read upRead up
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 78.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method parse_direct_response_elements
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_direct_response_elements(response, options)
params = response[:direct_response]&.tr('"', '')
return {} unless params
parts = params.split(options[:delimiter] || ',')
Method commit
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def commit(method, url, parameters = nil, options = {}, type = false)
raw_response = response = nil
success = false
begin
json = parameters ? parameters.to_json : nil
Method add_mpi_3ds
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add_mpi_3ds(xml, three_d_secure_options)
# structure as per https://developer.paypal.com/api/nvp-soap/payflow/3d-secure-mpi/
authentication_id = three_d_secure_options[:authentication_id]
authentication_status = three_d_secure_options[:authentication_response_status]
- 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_and_customer_info
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add_address_and_customer_info(xml, options)
billing_address = options[:billing_address] || options[:address]
shipping_address = options[:shipping_address]
ipv4_address = ipv4?(options[:ip]) ? options[:ip] : 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"