Method format_value
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def format_value(currency_code, value, options={})
info = currency_info(currency_code, options)
negative = false
if value < 0
- 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 generate_attrs
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def generate_attrs(attr)
model_class.class_eval do
define_method(attr) do
currency_info = currency_value_class_info.currency_info_for(self)
return read_attribute(attr) if currency_info.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 currency_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def currency_info(code, options={})
code = code.to_s.upcase
valid_options = [:symbol, :round, :suffix, :space, :digits]
info = {:code => code, :symbol => code, :round => 0.01, :suffix => nil, :space => nil, :digits => nil}
if ::Invoicing::CurrencyValue::CURRENCIES.has_key? code
- 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 attr_conversion_input
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def attr_conversion_input(object, attr)
value = nil
if callback = all_options[:conversion_input]
value = object.send(callback, attr)
- 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"