Method initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name:, children: nil, constraints: nil)
msg = 'Argument name was not a String.'
raise ::TypeError, msg unless name.is_a? String
msg = 'Argument name was an empty string.'
raise ::ArgumentError if name.empty?
- 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 match_children?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def match_children?(arg)
self_childless = @children.nil?
arg_childless = !arg.is_a?(Enumerable) || arg.count == 0
return true if self_childless
return false if !self_childless && arg_childless
- 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 match_class?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def match_class?(arg)
actual_name = (optional?) ? @name[0..-2] : @name
if actual_name == 'Boolean'
arg.is_a?(TrueClass) || arg.is_a?(FalseClass)
else
- 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 constraints=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def constraints=(csts)
msg = 'Argument csts was not a Taipo::TypeElement::Constraints.'
raise ::TypeError, msg unless csts.is_a? Taipo::TypeElement::Constraints
names = Hash.new
- 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"