Method each
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def each
if block_given?
self.class.properties.each do |name, property|
if value = read_attribute(name)
if self.class.reflect_on_association(name)
- 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 each
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def each(*args)
raise Spira::NoTypeError, "Cannot count a #{self} without a reference type URI" unless type
options = args.extract_options!
conditions = options.delete(:conditions) || {}
- 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
File persistence.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Spira
module Persistence
extend ActiveSupport::Concern
module ClassMethods
Method id_for
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def id_for(identifier)
case
# Absolute URI's go through unchanged
when identifier.is_a?(RDF::URI) && identifier.absolute?
identifier
- 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 qualified_const_get
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def qualified_const_get(str)
path = str.to_s.split('::')
from_root = path[0].empty?
if from_root
from_root = []
- 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 retrieve_attribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_attribute(name, options, sts)
if self.class.reflections[name]
sts.inject([]) do |values, statement|
if statement.predicate == options[:predicate]
values << build_value(statement.object, options[:type])
- 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"