Method execute
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def execute(queryable, bindings = {}, &block)
bindings = bindings.to_h if bindings.is_a?(Solution)
query = {
subject: subject.is_a?(Variable) && bindings[subject.to_sym] ? bindings[subject.to_sym] : subject,
predicate: predicate.is_a?(Variable) && bindings[predicate.to_sym] ? bindings[predicate.to_sym] : 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"
Further reading
Method valid?
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def valid?
(subject? ? (subject.resource? || subject.variable?) && subject.valid? : true) &&
(predicate? ? (predicate.uri? || predicate.variable?) && predicate.valid? : true) &&
(object? ? (object.term? || object.variable?) && object.valid? : true) &&
(graph? ? (graph_name.resource? || graph_name.variable?) && graph_name.valid? : true)
- 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 Pattern
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Pattern < RDF::Statement
##
# @private
# @since 0.2.2
def self.from(pattern, graph_name: nil, **options)
Method initialize!
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def initialize!
@graph_name = Variable.new(@graph_name) if @graph_name.is_a?(Symbol)
@subject = Variable.new(@subject) if @subject.is_a?(Symbol)
@predicate = Variable.new(@predicate) if @predicate.is_a?(Symbol)
@object = Variable.new(@object) if @object.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 solution
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def solution(statement)
RDF::Query::Solution.new do |solution|
solution[subject.to_sym] = statement.subject if subject.is_a?(Variable)
solution[predicate.to_sym] = statement.predicate if predicate.is_a?(Variable)
solution[object.to_sym] = statement.object if object.is_a?(Variable)
- 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 variable_terms
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def variable_terms(name = nil)
warn "[DEPRECATION] RDF::Query::Pattern#variable_terms is deprecated and will be removed in a future version.\n" +
"Called from #{Gem.location_of_caller.join(':')}"
terms = []
terms << :subject if subject.is_a?(Variable) && (!name || name.eql?(subject.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 eql?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def eql?(other)
return false unless other.is_a?(Statement) && (self.graph_name || false) == (other.graph_name || false)
predicate == other.predicate &&
(subject.is_a?(Pattern) ? subject.eql?(other.subject) : subject == other.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"
Further reading
Method variables?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def variables?
subject && subject.variable? ||
predicate && predicate.variable? ||
object && object.variable? ||
graph_name && graph_name.variable?
- 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 variable_count
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def variable_count
[subject, predicate, object, graph_name].inject(0) do |memo, term|
memo += (term.is_a?(Variable) ? 1 :
(term.respond_to?(:variable_count) ? term.variable_count : 0))
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"