multiplex/multiplex.js

View on GitHub
src/lib/collections/sorted-list.js

Summary

Maintainability
A
2 hrs
Test Coverage

Function SortedList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function SortedList(value, comparer) {
    var dic = isType(value, Dcitionary) ? value : null,
        capacity = isNumber(value, Number) ? value : (dic ? dic.count() : 0);

    comparer = Comparer.from(comparer || value);
Severity: Minor
Found in src/lib/collections/sorted-list.js - About 55 mins to fix

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 capacity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    capacity: function (value) {
        if (value === null || value === undefined) {
            return this.slot.keys.length;
        } else {
            assertType(value, Number);
Severity: Minor
Found in src/lib/collections/sorted-list.js - About 45 mins to fix

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 8 (exceeds 5 allowed). Consider refactoring.
Open

    insert: function (index, key, value) {
        var slot = this.slot;

        if (slot.size === slot.keys.length) {
            var newCapacity = slot.keys.length === 0 ? 4 : slot.keys.length * 2,
Severity: Minor
Found in src/lib/collections/sorted-list.js - About 45 mins to fix

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

There are no issues that match your filters.

Category
Status