lib/diaspora_federation/entity.rb
Class Entity
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Entity
extend PropertiesDSL
include Logging
# Invalid XML characters
Method json_data
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
def json_data # rubocop:disable Metrics/PerceivedComplexity
enriched_properties.map {|key, value|
type = self.class.class_props[key]
next if optional_nil_value?(key, value)
- 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 instantiate_nested
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def instantiate_nested(name, value)
if value.instance_of?(Array)
return value unless value.first.instance_of?(Hash)
value.map {|hash| self.class.class_props[name].first.new(hash) }
- 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"