sjsyrek/lazy-linked-lists

View on GitHub

Showing 6 of 8 total issues

Function sortBy has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

export const sortBy = (cmp, as) => {
  const sequences = as => {
    if (isEmpty(as)) { return list(as) }
    let xs = tail(as)
    if (isEmpty(xs)) { return list(as) }
Severity: Minor
Found in source/lib.js - About 3 hrs 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 sortBy has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const sortBy = (cmp, as) => {
  const sequences = as => {
    if (isEmpty(as)) { return list(as) }
    let xs = tail(as)
    if (isEmpty(xs)) { return list(as) }
Severity: Minor
Found in source/lib.js - About 1 hr to fix

    Function listRangeBy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    export const listRangeBy = (start, end, step) => {
      if (start === end) { return list(start) }
      let x = start
      const xs = list(x)
      const listGenerator = function* () {
    Severity: Minor
    Found in source/lib.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 cycle has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    export const cycle = as => {
      if (isEmpty(as)) { throw new EmptyListError(cycle) }
      let x = head(as)
      let xs = tail(as)
      const c = list(x)
    Severity: Minor
    Found in source/lib.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 compare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      compare (ys) {
        if (isEmpty(this) && isEmpty(ys)) { return EQ }
        if (isEmpty(this) && !isEmpty(ys)) { return LT }
        if (!isEmpty(this) && isEmpty(ys)) { return GT }
        if (this.head() === head(ys)) { return this.tail().compare(tail(ys)) }
    Severity: Minor
    Found in source/list.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

        return this.head() < head(ys) ? LT : GT
    Severity: Major
    Found in source/list.js - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language