Showing 188 of 213 total issues
Class Literal
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Literal
private
@@subclasses = [] # @private
@@datatype_map = nil # @private
Class Statement
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Statement
include RDF::Resource
##
# @private
Method parse
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def parse(value)
value = value.to_s.dup.force_encoding(Encoding::ASCII_8BIT)
parts = {}
if matchdata = IRI_PARTS.match(value)
scheme, authority, path, query, fragment = matchdata[1..-1]
- 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
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def self.each(file_name: nil,
file_extension: nil,
content_type: nil,
has_reader: false,
has_writer: false,
- 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
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def query(pattern, **options, &block)
raise TypeError, "#{self} is not readable" if respond_to?(:readable?) && !readable?
case pattern
# A basic graph pattern (BGP) query:
- 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 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 write_epilogue
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write_epilogue
class_name = options[:class_name]
module_name = options.fetch(:module_name, "RDF")
source = options.fetch(:location, base_uri)
strict = options.fetch(:strict, false)
Method initialize
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def initialize(body, options = {})
options.each do |key, value|
# de-quote charset
matchdata = value.match(/^["'](.*)["']$/.freeze) if key == "charset"
value = matchdata[1] if matchdata
- 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_ruby
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def to_ruby(indent: "")
"term(" +
(self.uri? ? self.to_s.inspect + ",\n" : "\n") +
"#{indent} " +
attributes.keys.sort.map do |k|
- 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 Numeric
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Numeric < Literal
##
# Compares this literal to `other` for sorting purposes.
#
# @param [Object] other
Method open
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.open(filename, format: nil, **options, &block)
# If we're the abstract reader, and we can figure out a concrete reader from format, use that.
if self == RDF::Reader && format && reader = self.for(format)
return reader.open(filename, format: format, **options, &block)
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
File reader.rb
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RDF
##
# The base class for RDF parsers.
#
# @example Loading an RDF reader implementation
Class Solution
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Solution
# Undefine all superfluous instance methods:
alias_method :__send, :send
# Temporarily remember instance method for deprecation message in `method_missing`.
File enumerable.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RDF
##
# An RDF statement enumeration mixin.
#
# Classes that include this module must implement an `#each` method that
Class Repository
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Repository < Dataset
include RDF::Mutable
include RDF::Transactable
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 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 exec
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.exec(args, output: $stdout, option_parser: nil, messages: {}, **options)
option_parser ||= self.options(args)
options[:logger] ||= option_parser.options[:logger]
output.set_encoding(Encoding::UTF_8) if output.respond_to?(:set_encoding) && RUBY_PLATFORM == "java"
Method write_statement
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def write_statement(statement)
statement = statement.canonicalize! if canonicalize?
# Make sure BNodes in statement use unique identifiers
if statement.node?
- 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 from_graph
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_graph(graph, url: nil, class_name: nil, extra: nil)
vocab = case class_name
when RDF::Vocabulary
class_name.instance_variable_set(:@ontology, nil)
class_name.instance_variable_set(:@properties, nil)