Showing 3 of 5 total issues
Class List
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class List
include Conversions
attr_reader :length
alias_method :size, :length
Method insert
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def insert(to_add, after: nil, before: nil)
if after && before || !after && !before
raise ArgumentError, 'either :after or :before keys should be passed'
end
matcher = after || before
- 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 __unlink_node
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def __unlink_node(node)
@head = node.next if node.prev.nil?
@tail = node.prev if node.next.nil?
if node.prev.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"