Showing 12 of 28 total issues
Method inherited
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def inherited(subclass)
config_class = Class.new(self::SeregaConfig)
config_class.serializer_class = subclass
subclass.const_set(:SeregaConfig, config_class)
subclass.instance_variable_set(:@config, subclass::SeregaConfig.new(config.opts))
Method append_many
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def append_many(preloads, plan)
plan.points.each do |point|
current_preloads = point.attribute.preloads
next unless current_preloads
- 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 validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate(serializer_class, fields)
fields.each do |name, nested_fields|
attribute = serializer_class && serializer_class.attributes[name]
# Save error when no attribute with checked name exists
- 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 check_proc
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_proc(value)
raise SeregaError, value_error unless value.is_a?(Proc)
params = value.parameters
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call(opts)
return unless opts.key?(:preload_path)
value = opts[:preload_path]
raise SeregaError, "Invalid option :preload_path => #{value.inspect}. Can be provided only when :preload option provided" unless opts[:preload]
- 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 attributes_points
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attributes_points(modifiers)
only = modifiers[:only] || FROZEN_EMPTY_HASH
except = modifiers[:except] || FROZEN_EMPTY_HASH
with = modifiers[:with] || FROZEN_EMPTY_HASH
points = []
- 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 prepare_batch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def prepare_batch
batch = init_opts[:batch]
return unless batch
# take loader
- 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 add_metadata
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_metadata(object, context, hash)
self.class.meta_attributes.each_value do |meta_attribute|
metadata = meta_attribute_value(object, context, meta_attribute)
next unless metadata
- 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 parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse(fields)
res = {}
attribute = +""
char = +""
path_stack = 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 visible?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def visible?(modifiers)
except = modifiers[:except] || FROZEN_EMPTY_HASH
only = modifiers[:only] || FROZEN_EMPTY_HASH
with = modifiers[:with] || FROZEN_EMPTY_HASH
- 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 preload
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def preload(object, preloads)
return object if object.nil? || (object.is_a?(Array) && object.empty?) || preloads.empty?
preload_handler = handlers.find { |handler| handler.fit?(object) }
raise SeregaError, "Can't preload #{preloads.inspect} to #{object.inspect}" unless preload_handler
- 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 plugin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def plugin(name, **opts)
raise SeregaError, "This plugin is already loaded" if plugin_used?(name)
plugin = SeregaPlugins.find_plugin(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"