Showing 10 of 24 total issues
Function unlink
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
unlink(node) {
assert(node instanceof Node);
if (node.left !== null) {
// Swap node with its predecessor
const pred = predecessor(node);
- 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
Function unlink
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
unlink(node) {
assert(node instanceof Node);
if (node.left !== null) {
// Swap node with its predecessor
const pred = predecessor(node);
Function rangetraversal
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default function* rangetraversal(compare, root, left, right) {
if (compare(root.key, left) < 0) {
// If the root lies to the left of the interval, we can discard the
// entire left subtree.
if (root.right !== null) {
- 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
Function insert
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const insert = (compare, A, B) => {
while (true) {
if (compare(B.key, A.key) < 0) {
const node = A.left;
- 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
Function leftOpenRangeTraversal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function* leftOpenRangeTraversal(compare, root, right) {
if (compare(root.key, right) >= 0) {
// If the root lies to the right of the interval, we can discard the
// entire right subtree.
if (root.left !== null) {
- 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
Function rightOpenRangeTraversal
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function* rightOpenRangeTraversal(compare, root, left) {
if (compare(root.key, left) < 0) {
// If the root lies to the left of the interval, we can discard the
// entire left subtree.
if (root.right !== null) {
- 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
Function delete_case4
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const delete_case4 = (n) => {
assert(n instanceof Node);
assert(n._color === BLACK);
assert(n.parent !== null);
const s = sibling(n);
- 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
Function search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const search = (compare, root, key) => {
assert(root instanceof Node);
while (true) {
const d = compare(key, root.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
Function delete_case3
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const delete_case3 = (n) => {
assert(n instanceof Node);
assert(n._color === BLACK);
assert(n.parent !== null);
const s = sibling(n);
- 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
Function swap_non_adjacent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const swap_non_adjacent = (A, B) => {
assert(A instanceof Node);
assert(B instanceof Node);
const p = A.parent;
const u = A.left;
- 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"