Method __find
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
def __find(invalid, id, elements, assert_repeatable = false)
reachable = false
repeatable = false
matches = []
filter_tok = nil
- 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 element
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def element(m, n = nil, o = nil)
if m <= 0 or (n || 1) <= 0 or (o || 1) <= 0
raise ArgumentError,
"all arguments must be positive"
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"
Further reading
File navigation.rb
has 449 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Stupidedi
using Refinements
module Parser
module Navigation
Method __find
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __find(invalid, id, elements, assert_repeatable = false)
reachable = false
repeatable = false
matches = []
filter_tok = nil
Method element
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def element(m, n = nil, o = nil)
if m <= 0 or (n || 1) <= 0 or (o || 1) <= 0
raise ArgumentError,
"all arguments must be positive"
end
Method filter?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def filter?(filter_tok, segment_val)
return true unless filter_tok.id == segment_val.id
filter_tok.element_toks.zip(segment_val.children) do |f_tok, e_val|
if f_tok.simple?
- 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 __filter?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __filter?(filter_tok, invalid_val)
return true unless filter_tok.id == invalid_val.id
children = invalid_val.segment_tok.element_toks
filter_tok.element_toks.zip(children) do |f_tok, e_tok|
- 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 next
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def next(count = 1)
unless count > 0
raise ArgumentError,
"count must be positive"
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"
Further reading
Method prev
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def prev(count = 1)
unless count > 0
raise ArgumentError,
"count must be positive"
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"
Further reading
Method parent
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parent
active = []
@active.each do |zipper|
state = zipper
- 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 prev
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prev(count = 1)
unless count > 0
raise ArgumentError,
"count must be positive"
end
Method next
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def next(count = 1)
unless count > 0
raise ArgumentError,
"count must be positive"
end
Method parent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parent
active = []
@active.each do |zipper|
state = zipper
Method first
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def first
active = roots.map do |zipper|
state = zipper
value = zipper.node.zipper
- 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 last
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def last
active = roots.map do |zipper|
state = zipper
value = zipper.node.zipper
- 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
Avoid deeply nested control flow statements. Open
unless o <= components
raise ArgumentError,
"repeatable composite element #{descriptor} only has #{components} components"
end
Avoid deeply nested control flow statements. Open
if element_zip.node.blank?
Either.failure("repeatable composite element #{descriptor} does not occur")
elsif occurs_count < n
Either.failure("repeatable composite element #{descriptor} only occurs #{occurs_count} times")
else
Avoid deeply nested control flow statements. Open
unless __value.eql?(__state.node.zipper)
__state = __state.replace(__state.node.copy(:zipper => __value))
end