Showing 12 of 19 total issues
Class Type
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Type
include Mixin::Errors
include Mixin::Reflection
include Mixin::HandlerSupport
Method define_denormalizer
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def define_denormalizer
denormalizer_block do |input, _, ctx|
break input if input.is_a?(DateTime)
input = input.to_s if input.is_a?(Symbol)
break DateTime.iso8601(input, 3) if input.is_a?(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"
Further reading
Method attribute!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def attribute!(name, *types, **options)
name = name.to_sym
types = types.map do |type|
next type if type.is_a?(Parameter)
next parameter!(type) if type.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 denormalize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def denormalize(source, type, context)
return source if type.valid?(source, context)
find_candidate_methods(source.class).each do |candidate|
begin
next unless source.respond_to?(candidate)
- 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 denormalize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def denormalize(source, type, context = nil)
validate_source!(source, type, context)
entity = type.factory.create(type, source, context)
type.attributes.values.each do |attribute|
next if attribute.virtual
- 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_parameter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def resolve_parameter(parameter, substitution)
clone.tap do |clone|
clone.types = types.each_with_object([]) do |type, carrier|
if type == parameter
buffer = substitution
- 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_denormalizer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def define_denormalizer
denormalizer_block do |input, _, ctx|
break input if input.is_a?(Rational)
input = input.to_s if input.is_a?(Symbol)
break Rational(input) if input.is_a?(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"
Further reading
Method inject
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def inject(entity, _type, attribute, value, _context = nil)
Method normalize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def normalize(entity, type, context)
type.attributes.values.each_with_object({}) do |attribute, data|
next if attribute.virtual
condition = context.include_sensitive_attributes
next if attribute.sensitive && !condition
- 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_def
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_def
return @type.to_s if parameters.empty?
params = parameters.map do |key, value|
value = [value] unless value.is_a?(Enumerable)
value = value.map(&:to_def)
- 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 enumerate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enumerate(entity, type, _context)
::Enumerator.new do |yielder|
type.attributes.values.each do |attribute|
next if attribute.virtual
value = attribute.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 successful
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def successful(enumerator, error = StandardError, ctx = nil)
suppressed = []
enumerator.each do |*args|
begin
return yield(*args)
- 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"