Showing 33 of 559 total issues
Method _present
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def _present(attributes: nil, **args)
options = self.class.plugin_store[:presenter][:options].merge(args)
result = {}
# TODO: Optimize!
_attribute_store.store.each do |key, atr|
- 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 _create_configurable_set_method
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def _create_configurable_set_method(name, setter_name, **opts)
class_methods_module do
define_method(setter_name) do |*args, **kargs, &blk|
klass = self
opts[:before_update].call(klass) if opts[:before_update]
- 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 create_option_methods
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def create_option_methods(config)
config.option_store.each do |option|
define_singleton_method(option.name) do |&blk|
if blk
if options[option.name].nil? && option.options[:init]
- 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_to_ordered_array
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def add_to_ordered_array(new_item)
if @order.empty?
@order << new_item
else
# We have to figure out where to place the item.
- 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 _value_changed?
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _value_changed?(value, ref)
if ref == :wardrobe_instance
if value._changed?
_dirty!
_dirty_tracker_dirty_sub_instances << 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 merge_options
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def merge_options(other)
merged_options = options.dup
other.each do |key, value|
next if merged_options[key] == value
if merged_options[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 run
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def run(report = true)
if validation && validation.any?
validate(validation, report)
elsif value.respond_to?(:_validate!)
if value._validation_errors.any?
- 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 merge
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def merge(other, calling_object)
if frozen?
dup.merge(other, calling_object)
else
(other.stores.keys - stores.keys).each do |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"
Further reading
Method _present
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _present(attributes: nil, **args)
options = self.class.plugin_store[:presenter][:options].merge(args)
result = {}
# TODO: Optimize!
_attribute_store.store.each do |key, atr|
Method validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate(validation, report)
if validation.type == :special
send(*validation.args, report)
else
begin
- 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 create_option_methods
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_option_methods(config)
config.option_store.each do |option|
define_singleton_method(option.name) do |&blk|
if blk
if options[option.name].nil? && option.options[:init]
Method add_to_ordered_array
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_to_ordered_array(new_item)
if @order.empty?
@order << new_item
else
# We have to figure out where to place the item.
Method _create_configurable_set_method
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _create_configurable_set_method(name, setter_name, **opts)
class_methods_module do
define_method(setter_name) do |*args, **kargs, &blk|
klass = self
opts[:before_update].call(klass) if opts[:before_update]
Method type?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def type?(predicate)
return if self.is_a?(predicate)
if predicate == Wardrobe::Boolean
return if self.is_a?(TrueClass) || self.is_a?(FalseClass)
"must be a TrueClass or FalseClass"
- 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_key?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def each_key?(validation, report)
errors = {}
value.each do |key, _|
result = Validator.new(key, nil, nil, validation).run(false)
result = [result] unless result.is_a?(Array)
- 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_value?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def each_value?(validation, report)
errors = {}
value.each do |key, val|
result = Validator.new(val, nil, nil, validation).run(false)
result = [result] unless result.is_a?(Array)
- 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
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add(name, klass, defining_object, config, **args, &blk)
Method each?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def each?(validation, report)
errors = {}
value.each_with_index do |item, index|
result = Validator.new(item, nil, nil, validation).run(false)
result = [result] unless result.is_a?(Array)
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, klass, defining_object, config, **options)
Method update_hash
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_hash(name, klass, hash_key, hash_klass, &blk)