maxmilton/stage1

View on GitHub

Showing 13 of 44 total issues

Function reconcile has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
Open

export const reconcile = <T extends any[], N extends Node>(
  parent: Element,
  renderedValues: any[],
  data: any[],
  createFn: (...args: T) => N,
Severity: Minor
Found in src/reconcile/non-keyed.ts - About 2 days 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 reconcile has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
Open

export const reconcile = <T extends any[], N extends Node>(
  key: keyof N,
  parent: Element,
  renderedValues: any[],
  data: any[],
Severity: Minor
Found in src/reconcile/keyed.ts - About 2 days 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 reconcile has 180 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const reconcile = <T extends any[], N extends Node>(
  key: keyof N,
  parent: Element,
  renderedValues: any[],
  data: any[],
Severity: Major
Found in src/reconcile/keyed.ts - About 7 hrs to fix

    Function reconcile has 180 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const reconcile = <T extends any[], N extends Node>(
      parent: Element,
      renderedValues: any[],
      data: any[],
      createFn: (...args: T) => N,
    Severity: Major
    Found in src/reconcile/non-keyed.ts - About 7 hrs to fix

      Function reconcile has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      export const reconcile = <T extends any[], N extends Node>(
        parent: Element,
        renderedValues: any[],
        data: any[],
        createFn: (...args: T) => N,
      Severity: Minor
      Found in src/reconcile/reuse-nodes.ts - About 4 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 reconcile has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const reconcile = <T extends any[], N extends Node>(
        parent: Element,
        renderedValues: any[],
        data: any[],
        createFn: (...args: T) => N,
      Severity: Minor
      Found in src/reconcile/reuse-nodes.ts - About 1 hr to fix

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

        export const onNodeRemove = (node: Node, fn: () => void): void => {
          new MutationObserver((mutations, observer) => {
            for (const mutation of mutations) {
              for (const removedNode of mutation.removedNodes) {
                if (removedNode.contains(node)) {
        Severity: Minor
        Found in src/utils.ts - 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 longestPositiveIncreasingSubsequence has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        const longestPositiveIncreasingSubsequence = (ns: any[], newStart: number) => {
          const seq = [];
          const is = [];
          let l = -1;
          const pre = new Array(ns.length);
        Severity: Minor
        Found in src/reconcile/non-keyed.ts - 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 longestPositiveIncreasingSubsequence has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        const longestPositiveIncreasingSubsequence = (ns: any[], newStart: number) => {
          const seq = [];
          const is = [];
          let l = -1;
          const pre = new Array(ns.length);
        Severity: Minor
        Found in src/reconcile/keyed.ts - 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

        Avoid too many return statements within this function.
        Open

            return;
        Severity: Major
        Found in src/reconcile/keyed.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return;
          Severity: Major
          Found in src/reconcile/non-keyed.ts - About 30 mins to fix

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

            const findGreatestIndexLEQ = (seq: any[], n: number) => {
              // invariant: lo is guaranteed to be index of a value <= n, hi to be >
              // therefore, they actually start out of range: (-1, last + 1)
              let lo = -1;
              let hi = seq.length;
            Severity: Minor
            Found in src/reconcile/non-keyed.ts - 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

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

            const findGreatestIndexLEQ = (seq: any[], n: number) => {
              // invariant: lo is guaranteed to be index of a value <= n, hi to be >
              // therefore, they actually start out of range: (-1, last + 1)
              let lo = -1;
              let hi = seq.length;
            Severity: Minor
            Found in src/reconcile/keyed.ts - 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