Showing 13 of 158 total issues
Class Mapping
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Mapping < Node
INCOMPATIBLE_KEYS_WARNING = "Use either a languages key or an engines key, but not both. They are mutually exclusive.".freeze
def self.mapping
@mapping ||= superclass.respond_to?(:mapping) ? superclass.mapping.dup : {}
Class Node
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Node
def self.has_default?
false
end
Class Sequence
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Sequence < Node
attr_reader :children
alias_method :__getobj__, :children
def self.[](node_type)
Method serialize_secure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def serialize_secure(value)
case options[:secure]
when :decrypted
raise ArgumentError, "secure option is set decrypted, but a secure value is not decrypted" unless value.decrypted?
serialize_decrypted(value)
- 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 accept_mapping
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def accept_mapping(node, value)
case value.tag
when MAP, OMAP, PAIRS then node.visit_mapping self, value
when SET then node.visit_sequence self, SetNode.new(value)
when SEQ then node.visit_sequence self, value
- 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 generate_key
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def generate_key(node, value)
if value.respond_to? :value and (value.tag.nil? || value.tag == STR)
value = value.value.to_s
value.start_with?(?:) ? value[1..-1] : value
else
- 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 prefix_scalar
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.prefix_scalar(key = nil, *types)
@prefix_scalar ||= superclass.respond_to?(:prefix_scalar) ? superclass.prefix_scalar : nil
if key
@prefix_scalar = key.to_s
define_method(:visit_scalar) do |visitor, type, value, _implicit = 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
Method verify_required
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_required
self.class.required.each do |key|
next if @mapping.include? key
type = self.class.subnode_for_key(key)
if type.has_default?
- 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 parses?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.parses?(value)
return true if value.is_a?(::Psych::Nodes::Node)
return true if value.is_a?(String) or value.is_a?(IO)
return true if defined?(StringIO) and value.is_a?(StringIO)
value.respond_to?(:to_str) or value.respond_to?(:to_io)
- 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 lines
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def lines(wrapper, lines)
return wrapper % lines.join(",") unless pretty?
return wrapper % "" if lines.empty?
return wrapper % " #{lines.first} " unless lines.size > 1 or lines.first.include?("\n") or lines.first.size > 50
lines = "\n " + lines.join(",\n").strip.gsub("\n", "\n ") + "\n"
- 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 regexp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def regexp(pattern)
return pattern if pattern.is_a? Regexp
return Regexp.new(pattern) unless pattern =~ FORMATS["!regexp"]
flag = $2.chars.inject(0) { |f,c| f | REG_FLAGS.fetch(c, 0) }
Regexp.new($1, flag)
- 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 map
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.map(*list)
options = Hash === list.last ? list.pop : {}
list.each do |key|
required << key.to_s if options[:required]
define_map_accessor(key)
- 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 define_map_accessor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.define_map_accessor(key)
define_method(key) { | | self[key] } unless method_defined? key
define_method("#{key}=") { |v| self[key] = v } unless method_defined? "#{key}="
define_method("#{key}?") { | | !!self[key] } unless method_defined? "#{key}?"
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"