Showing 5 of 8 total issues
Method observer_proc
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def observer_proc(klass, method_name, skip_if, instance_method: true, &main_block)
original_method = instance_method ? klass.instance_method(method_name) : klass.method(method_name)
me = self
-> (*args, &block) do
- 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 stop_observe
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def stop_observe(klass, method_name, instance_method: true)
method_names = generate_method_names(method_name)
if instance_method
unless method_defined?(klass, method_names[:observed]) && method_defined?(klass, method_names[:dump])
- 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(input)
input = {} unless input
raise InputClassError, 'If you want to use custom #validate, you have to pass a hash to an interactor' unless input.is_a?(Hash)
validator = contract_class ? contract_class : input_schema
- 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_write_method
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def define_write_method(attr_name, proc, options)
set_proc_to_const(proc, attr_name) if proc
define_method("#{attr_name}=") do |val|
val = options[:prepare].call(val) if options[:prepare]
- 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 contract
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def contract(contract_class: nil, &block)
unless new_dry_validation?
raise DryValidationVersionError,
"Your depended dry-validation gem version must be gteq #{NEW_DRY_VALIDATION_V}"
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"