Class List
has 55 methods (exceeds 20 allowed). Consider refactoring. Open
class RDF::List
include RDF::Enumerable
include RDF::Value
include Comparable
File list.rb
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RDF
##
# An RDF list.
#
# @example Constructing a new list
Method valid?
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def valid?
li = subject
list_nodes = []
while li != RDF.nil do
return false if list_nodes.include?(li)
- 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 a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def initialize(subject: nil, graph: nil, values: nil, wrap_transaction: false, &block)
@subject = subject || RDF.nil
@graph = graph || RDF::Graph.new
is_empty = @graph.query({subject: subject, predicate: RDF.first}).empty?
- 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 []=
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def []=(*args)
start, length = 0, 0
ary = self.to_a
- 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 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(subject: nil, graph: nil, values: nil, wrap_transaction: false, &block)
@subject = subject || RDF.nil
@graph = graph || RDF::Graph.new
is_empty = @graph.query({subject: subject, predicate: RDF.first}).empty?
Method valid?
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def valid?
li = subject
list_nodes = []
while li != RDF.nil do
return false if list_nodes.include?(li)
Method []=
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def []=(*args)
start, length = 0, 0
ary = self.to_a
Avoid too many return
statements within this method. Open
return list_nodes.all? do |li|
refs = @graph.query({object: li}).count
case refs
when 0 then li == subject
when 1 then true
Avoid too many return
statements within this method. Open
return false unless firsts == 1 && rests == 1
Method each_subject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each_subject
return enum_subject unless block_given?
subject = self.subject
yield subject
- 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"