ezylean/object-description

View on GitHub

Showing 7 of 21 total issues

Function from has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

export function from(
  desc: Description,
  destination?: any,
  assignValue = defaultAssignValue,
  assignStructure = defaultAssignStructure
Severity: Minor
Found in src/lib/from.ts - About 5 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 to has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

export function to(
  value: any,
  complete = false,
  isValue: (
    value,
Severity: Minor
Found in src/lib/to.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 to has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function to(
  value: any,
  complete = false,
  isValue: (
    value,
Severity: Minor
Found in src/lib/to.ts - About 1 hr to fix

    Function from has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function from(
      desc: Description,
      destination?: any,
      assignValue = defaultAssignValue,
      assignStructure = defaultAssignStructure
    Severity: Minor
    Found in src/lib/from.ts - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                if (
                  !isValue(node.value, node.path[node.path.length - 1], node.path)
                ) {
                  nodes.unshift(node);
                  memory.set(node.value, node.path);
      Severity: Major
      Found in src/lib/to.ts - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                } else if (target) {
                  const targetedValue = getByPath(target, holder.result);
                  if (targetedValue !== undefined) {
                    assignValue(node, key, targetedValue);
                  }
        Severity: Major
        Found in src/lib/from.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if (!node[key] || node[key].constructor !== Ctor) {
                      assignStructure(node, key, Ctor);
                    }
          Severity: Major
          Found in src/lib/from.ts - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language