Showing 40 of 40 total issues
Class Schema
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Schema < Hash
NO_TRANSFORM = Dry::Types::FnContainer.register { |x| x }
SYMBOLIZE_KEY = Dry::Types::FnContainer.register(:to_sym.to_proc)
include ::Enumerable
File printer.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Dry
module Types
# @api private
class Printer
MAPPING = {
Class Compiler
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Compiler
extend ::Dry::Core::Deprecations[:'dry-types']
attr_reader :registry
Method try
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def try(input)
if primitive?(input)
success = true
output = {}
result = {}
- 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 try
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def try(input, &block)
if primitive?(input)
output = []
result = input.map { |el| member.try(el) }
- 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 visit_callable
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def visit_callable(callable)
fn = callable.is_a?(String) ? FnContainer[callable] : callable
case fn
when ::Method
- 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 visit_options
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def visit_options(options, meta = EMPTY_HASH)
if options.empty? && meta.empty?
yield ""
else
opts = options.empty? ? "" : " options=#{options.inspect}"
- 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 try
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def try(input)
if primitive?(input)
success = true
output = {}
result = {}
Method type_constants
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def type_constants(*namespaces, default: Undefined, **aliases)
if namespaces.empty? && aliases.empty? && Undefined.equal?(default)
default_ns = :Strict
elsif Undefined.equal?(default)
default_ns = Undefined
- 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 resolve_missing_keys
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def resolve_missing_keys(hash, options)
skip_missing = options.fetch(:skip_missing, false)
resolve_defaults = options.fetch(:resolve_defaults, true)
keys.each do |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 visit_schema
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def visit_schema(schema)
options = schema.options.dup
size = schema.count
key_fn_str = ""
type_fn_str = ""
Method fallback
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fallback(value = Undefined, shared: false, &_fallback)
if Undefined.equal?(value) && !block_given?
raise ::ArgumentError, "fallback value or a block must be given"
end
Method visit_sum_constructors
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def visit_sum_constructors(sum)
case sum.left
when Sum
visit_sum_constructors(sum.left) do |left|
case sum.right
Method visit_callable
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def visit_callable(callable)
fn = callable.is_a?(String) ? FnContainer[callable] : callable
case fn
when ::Method
Method try
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def try(input, &block)
result = type.try(input)
if result.success?
validation = rule.(result.input)
- 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 visit_sum_constructors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def visit_sum_constructors(sum)
case sum.left
when Sum
visit_sum_constructors(sum.left) do |left|
case sum.right
- 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 self.[](name)
type_map.fetch_or_store(name) do
case name
when ::String
result = name.match(TYPE_SPEC_REGEX)
- 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 fallback
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fallback(value = Undefined, shared: false, &_fallback)
if Undefined.equal?(value) && !block_given?
raise ::ArgumentError, "fallback value or a block must be given"
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 call_safe
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def call_safe(input)
if primitive?(input)
failed = false
result = input.each_with_object([]) do |el, output|
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def coerce(input)
unless primitive?(input)
return failure(
input, CoercionError.new("#{input.inspect} must be an instance of #{primitive}")
)
- 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"