Class Statement
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Statement
include RDF::Resource
##
# @private
Method initialize!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def initialize!
@graph_name = Node.intern(@graph_name) if @graph_name.is_a?(Symbol)
@subject = if @subject.is_a?(Value)
@subject.to_term
elsif @subject.is_a?(Symbol)
- 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 initialize!
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize!
@graph_name = Node.intern(@graph_name) if @graph_name.is_a?(Symbol)
@subject = if @subject.is_a?(Value)
@subject.to_term
elsif @subject.is_a?(Symbol)
Method dup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dup
options = Hash[@options]
options[:subject] = subject.is_a?(RDF::Node) ? subject : subject.dup
options[:predicate] = predicate.dup
options[:object] = object.is_a?(RDF::Node) ? object : object.dup
- 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_s
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_s
(graph_name ? to_quad : to_triple).map do |term|
if term.is_a?(Statement)
"<<#{term.to_s[0..-3]}>>"
elsif term.respond_to?(:to_base)
- 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
Avoid too many return
statements within this method. Open
return true
Method initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(subject = nil, predicate = nil, object = nil, options = {})
if subject.is_a?(Hash)
@options = Hash[subject] # faster subject.dup
@subject = @options.delete(:subject)
@predicate = @options.delete(:predicate)
- 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"