Method compile_masgn
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def compile_masgn(lhs_items, array, len = nil)
pre_splat = lhs_items.take_while { |child| child.type != :splat }
post_splat = lhs_items.drop(pre_splat.size)
pre_splat.each_with_index do |child, idx|
- 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 compile_masgn
has 34 lines of code (exceeds 30 allowed). Consider refactoring. Open
def compile_masgn(lhs_items, array, len = nil)
pre_splat = lhs_items.take_while { |child| child.type != :splat }
post_splat = lhs_items.drop(pre_splat.size)
pre_splat.each_with_index do |child, idx|
Method compile_assignment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compile_assignment(child, array, idx, len = nil)
assign =
if !len || idx >= len
s(:js_tmp, "(#{array}[#{idx}] == null ? nil : #{array}[#{idx}])")
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 compile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compile
with_temp do |array|
if rhs.type == :array
push "#{array} = ", expr(rhs)
rhs_len = rhs.children.any? { |c| c.type == :splat } ? nil : rhs.children.size
- 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"