Method export_iterable
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def export_iterable(items, include_blank)
if items.is_a?(Hash)
items.each { |key, value| items[key] = value.respond_to?(:to_export) ? value.to_export(include_blank) : value }
items.to_hash.stringify_keys
else
- 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 export_attr
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def export_attr(exporter, include_blank)
value = if exporter.respond_to?(:call)
exporter.call(self)
elsif respond_to?(exporter)
send(exporter)
- 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 to_export
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_export(include_blank = true)
return unless self.class.exportable_attributes.present?
self.class.exportable_attributes.keys.inject({}) do |hash, attribute|
value = export_attr(self.class.exportable_attributes[attribute], include_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"