Method execute
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def execute(queryable, bindings: {}, solutions: Solution.new, graph_name: nil, name: nil, **options, &block)
# Use provided solutions to allow for query chaining
# Otherwise, a quick empty solution simplifies the logic below; no special case for
# the first pattern
@solutions = Query::Solutions(solutions)
- 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
Class Query
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Query
include Enumerable
autoload :Pattern, 'rdf/query/pattern'
autoload :Solution, 'rdf/query/solution'
autoload :Solutions, 'rdf/query/solutions'
Method execute
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(queryable, bindings: {}, solutions: Solution.new, graph_name: nil, name: nil, **options, &block)
# Use provided solutions to allow for query chaining
# Otherwise, a quick empty solution simplifies the logic below; no special case for
# the first pattern
@solutions = Query::Solutions(solutions)
Method compile_hash_patterns
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compile_hash_patterns(hash_patterns)
patterns = []
hash_patterns.each do |s, pos|
raise ArgumentError, "invalid hash pattern: #{hash_patterns.inspect}" unless pos.is_a?(Hash)
pos.each do |p, os|
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*patterns, solutions: nil, graph_name: nil, name: nil, validate: false, **options, &block)
@options = options.dup
@solutions = Query::Solutions(solutions)
graph_name = name if graph_name.nil?
@graph_name = graph_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 apply_graph_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply_graph_name(graph_name = nil)
graph_name ||= self.graph_name
patterns.each {|pattern| pattern.graph_name = graph_name if pattern.graph_name.nil?} unless graph_name.nil?
end
- 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"