Showing 188 of 213 total issues
Method -
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def -(other)
if self.class == Double || [Double, ::Float].include?(other.class)
RDF::Literal::Double.new(to_f - other.to_f)
elsif ((self.class == RDF::Literal::Float || other.class == RDF::Literal::Float) rescue false)
RDF::Literal::Float.new(to_f - other.to_f)
- 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 formats
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.formats(reader: false, writer: false)
f = RDF::Format.sort_by(&:to_sym).
select {|ft| (reader ? ft.reader : (writer ? ft.writer : (ft.reader || ft.writer)))}.
inject({}) do |memo, r|
memo.merge(r.to_sym => r.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 %
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def %(other)
if self.class == Double || [Double, ::Float].include?(other.class)
self.class.new(to_f % other.to_f)
elsif ((self.class == RDF::Literal::Float || other.class == RDF::Literal::Float) rescue false)
self.class.new(to_f % other.to_f)
- 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 normalize_path
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.normalize_path(path)
output, input = String.new, path.to_s
if input.encoding != Encoding::ASCII_8BIT
input = input.dup.force_encoding(Encoding::ASCII_8BIT)
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"
Further reading
Method *
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def *(other)
if self.class == Double || [Double, ::Float].include?(other.class)
RDF::Literal::Double.new(to_f * other.to_f)
elsif ((self.class == RDF::Literal::Float || other.class == RDF::Literal::Float) rescue false)
RDF::Literal::Float.new(to_f * other.to_f)
- 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 parent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parent
case
when root? then nil
else
require 'pathname' unless defined?(Pathname)
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def +(other)
if self.class == Double || [Double, ::Float].include?(other.class)
RDF::Literal::Double.new(to_f + other.to_f)
elsif ((self.class == RDF::Literal::Float || other.class == RDF::Literal::Float) rescue false)
RDF::Literal::Float.new(to_f + other.to_f)
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args, validate: false, canonicalize: false, **options)
@value = @object = @hash = nil
@mutex = Mutex.new
uri = args.first
if 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 to_s
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_s
prefix = distinguished? ? (existential? ? '$' : '?') : (existential? ? '$$' : '??')
unbound? ? "#{prefix}#{name}" : "#{prefix}#{name}=#{value}"
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"
Further reading
Method limit_vocabs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def limit_vocabs(*vocabs)
@vocabs = if Array(vocabs).empty?
nil
else
vocabs.map do |vocab|
- 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 new
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.new(*args, vocab: nil, attributes: {}, **options)
klass = if args.first.nil?
RDF::Node
elsif args.first.is_a?(Hash)
args.unshift(nil)
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def /(other)
if self.class == Double || [Double, ::Float].include?(other.class)
RDF::Literal::Double.new(to_f / other.to_f)
elsif ((self.class == RDF::Literal::Float || other.class == RDF::Literal::Float) rescue false)
RDF::Literal::Float.new(to_f / other.to_f)
- 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 update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update(*statements)
raise TypeError.new("#{self} is immutable") if immutable?
statements = statements[0] if statements.length == 1 && statements[0].is_a?(Enumerable)
statements.each do |statement|
- 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 initialize
has a Cognitive Complexity of 9 (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?(::String) then case value.upcase
- 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 query_pattern
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def query_pattern(pattern, **options, &block)
return super unless pattern.graph_name == DEFAULT_GRAPH
if block_given?
pattern = pattern.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 register
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def register(prefix, vocab, **params)
# check the input
raise ArgumentError, "#{prefix} must be symbol-able" unless
[String, Symbol].any? { |c| prefix.is_a? c }
- 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 coerce_statements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def coerce_statements(statements, query: false, constant: false, &block)
raise ArgumentError, 'expecting a block' unless block_given?
statements = statements.map do |value|
case
- 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 each_statement
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def each_statement(&block)
if block_given?
@data.each do |g, ss|
ss.each do |s, ps|
ps.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 unescape
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.unescape(string)
# Note: avoiding copying the input string when no escaping is needed
# greatly reduces the number of allocations and the processing time.
string = string.dup.force_encoding(Encoding::UTF_8) unless string.encoding == Encoding::UTF_8
scanner = StringScanner.new(string)
- 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"