Showing 1,005 of 1,501 total issues
Method format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format(number, option)
return '' if number.blank?
case option
when :two_digits then sprintf('%.2i', number.to_i)[-2..-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 add_decision_manager_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_decision_manager_fields(xml, options)
return unless options[:decision_manager_enabled]
xml.tag! 'decisionManager' do
xml.tag! 'enabled', options[:decision_manager_enabled] if options[:decision_manager_enabled]
- 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_tax_service
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_tax_service(xml)
xml.tag! 'taxService', { 'run' => 'true' } do
xml.tag!('nexus', @options[:nexus]) unless @options[:nexus].blank?
xml.tag!('sellerRegistration', @options[:vat_reg_number]) unless @options[:vat_reg_number].blank?
end
- 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_soft_descriptors_from_specialized_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_soft_descriptors_from_specialized_class(xml, soft_desc)
xml.tag! :SDMerchantName, soft_desc.merchant_name if soft_desc.merchant_name
xml.tag! :SDProductDescription, soft_desc.product_description if soft_desc.product_description
xml.tag! :SDMerchantCity, soft_desc.merchant_city if soft_desc.merchant_city
xml.tag! :SDMerchantPhone, soft_desc.merchant_phone if soft_desc.merchant_phone
- 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 build_update_subscription_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_update_subscription_request(reference, creditcard, options)
xml = Builder::XmlMarkup.new indent: 2
add_address(xml, creditcard, options[:billing_address], options) unless options[:billing_address].blank?
add_purchase_data(xml, options[:setup_fee], true, options) unless options[:setup_fee].blank?
add_creditcard(xml, creditcard) if creditcard
- 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"