Showing 188 of 213 total issues
Method serialize_value
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def serialize_value(value, key, indent: "")
if value.is_a?(Hash)
# Favor English
keys = value.keys
keys = keys.include?(:en) ? (keys - [:en]).sort.unshift(:en) : keys.sort
- 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 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)
Consider simplifying this complex logical expression. Open
if @options[:rdfstar] && match(ST_START)
subject = read_uriref || read_node || read_quotedTriple || fail_subject
predicate = read_uriref(intern: true) || fail_predicate
object = read_uriref || read_node || read_literal || read_quotedTriple || fail_object
if !match(ST_END)
Consider simplifying this complex logical expression. Open
unless blank? || read_comment
subject = read_uriref || read_node || read_quotedTriple || fail_subject
predicate = read_uriref(intern: true) || fail_predicate
object = read_uriref || read_node || read_literal || read_quotedTriple || fail_object
Method options
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.options(argv, format: nil)
options = OptionParser.new
cli_opts = OPTIONS.map(&:dup)
logger = Logger.new($stderr)
logger.level = Logger::WARN
Method /
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def /(fragment)
frag = fragment.respond_to?(:to_uri) ? fragment.to_uri : RDF::URI(fragment.to_s)
raise ArgumentError, "Non-absolute URI or string required, got #{frag}" unless frag.relative?
if urn?
RDF::URI.intern(to_s.sub(/:+$/,'') + ':' + fragment.to_s.sub(/^:+/,''))
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(value, datatype: nil, lexical: nil, **options)
@datatype = RDF::URI(datatype || self.class.const_get(:DATATYPE))
@string = lexical || (value if value.is_a?(String))
@object = case
when value.class == ::Date
- 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 parse
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(files, evaluate: nil, format: nil, encoding: Encoding::UTF_8, **options, &block)
if files.empty?
# If files are empty, either use options[:execute]
input = evaluate ? StringIO.new(evaluate) : $stdin
input.set_encoding(encoding )
- 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 options
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.options(argv, format: nil)
options = OptionParser.new
cli_opts = OPTIONS.map(&:dup)
logger = Logger.new($stderr)
logger.level = Logger::WARN
- 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 join
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def join(*uris)
joined_parts = object.dup.delete_if {|k, v| %i(user password host port).include?(k)}
uris.each do |uri|
uri = RDF::URI.new(uri) unless uri.is_a?(RDF::URI)
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(value, datatype: nil, lexical: nil, **options)
@datatype = RDF::URI(datatype || self.class.const_get(:DATATYPE))
@string = lexical || (value if value.is_a?(String))
@object = case
when value.is_a?(::DateTime)
- 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 delete_from
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def delete_from(data, statement)
if has_statement_in?(data, statement)
s, p, o, g = statement.to_quad
g = DEFAULT_GRAPH unless supports?(:graph_name)
g ||= DEFAULT_GRAPH
- 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 adjust_to_timezone!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def adjust_to_timezone!(*args)
zone = args.empty? ? '+00:00' : args.first
if zone.to_s.empty?
# Remove timezone component
@object = self.class.new(@object.strftime(self.class.const_get(:FORMAT))).object
- 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 filter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def filter(criteria = {})
@variable_names = nil
if block_given?
self.reject! do |solution|
!yield(solution.is_a?(Solution) ? solution : Solution.new(solution))
- 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 read_uriref
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def read_uriref(intern: false, **options)
if uri_str = match(URIREF)
uri_str = self.class.unescape(uri_str)
uri = RDF::URI.send(intern? && intern ? :intern : :new, uri_str)
uri.validate! if validate?
- 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 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 []=
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 open_url
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.open_url(base_uri, proxy: nil, headers: {}, verify_none: false, **options)
ssl_verify = verify_none ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
redirect_count = 0
max_redirects = 5
Method query_pattern
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def query_pattern(pattern, **options, &block)
snapshot = @data
if block_given?
graph_name = pattern.graph_name
subject = pattern.subject
Method options
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.options
[
RDF::CLI::Option.new(
symbol: :class_name,
datatype: String,