Showing 5 of 5 total issues
Method validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate
self.class.instance_variable_get(:@_validations).each do |validation|
unless (if_condition = validation[:options][:if]).nil?
next unless instance_exec(&if_condition)
puts '"if condition" is `true`, this will then trigger validation'
- 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 varblock_merge
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def varblock_merge(variables)
raise ArgumentError, '`varblock_merge` does not accept a block. Are you looking for `varblock_merged_with` instead?' if block_given?
variables.each do |key, value|
current_value = self[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 handle_option_truthy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle_option_truthy(values, context)
is_truthy = true
values.each do |value|
if value.is_a? Proc
- 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 handle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle(value, context, options)
if options.any?
return handle_options(value, context, options)
# else, if no options, defaults to return as a wrapped 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 varblock_get
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def varblock_get(var_hash, index, *options)
unsupported_options = (options - VarBlock::GetvarHandlers::OPTIONS)
raise ArgumentError, "3rd argument options Array only supports #{VarBlock::GetvarHandlers::OPTIONS}. Does not support #{unsupported_options.map(&:inspect).join(', ')}" if unsupported_options.any?
raise ArgumentError, "1st argument should be a VarHash object, but is found to be a #{var_hash.class}" unless var_hash.is_a? VarHash
raise ArgumentError, "2nd argument :#{index} is not defined. Defined are #{var_hash.keys.map(&:inspect).join(', ')}" unless var_hash.keys.include?(index)
- 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"