iterable-iterator/cardinality

View on GitHub

Showing 10 of 10 total issues

Function gele has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const gele = (m, n, iterable) => {
    if (n < m) return false;

    if (n < 0) return false;

Severity: Minor
Found in src/core/gele.js - About 1 hr 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 eq has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const eq = (n, iterable) => {
    if (n < 0 || !Number.isInteger(n)) return false;

    if (iterable.length !== undefined) return iterable.length === n;

Severity: Minor
Found in src/core/eq.js - About 35 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

Avoid too many return statements within this function.
Open

    for (; n > 0; --n) if (it.next().done) return true;
Severity: Major
Found in src/core/gele.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return it.next().done;
    Severity: Major
    Found in src/core/eq.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return it.next().done;
      Severity: Major
      Found in src/core/le.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return m <= iterable.size && iterable.size <= n;
        Severity: Major
        Found in src/core/gele.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return m <= iterable.length && iterable.length <= n;
          Severity: Major
          Found in src/core/gele.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                for (; m > 0; --m) if (it.next().done) return false;
            Severity: Major
            Found in src/core/gele.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return it.next().done;
              Severity: Major
              Found in src/core/gele.js - About 30 mins to fix

                Function le has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                const le = (n, iterable) => {
                    if (n < 0) return false;
                
                    if (iterable.length !== undefined) return iterable.length <= n;
                
                
                Severity: Minor
                Found in src/core/le.js - About 25 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

                Severity
                Category
                Status
                Source
                Language