benjamine/jsondiffpatch

View on GitHub
packages/jsondiffpatch/src/filters/nested.ts

Summary

Maintainability
B
5 hrs
Test Coverage

Function objectsDiffFilter has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

export const objectsDiffFilter: Filter<DiffContext> = (context) => {
  if (context.leftIsArray || context.leftType !== 'object') {
    return;
  }

Severity: Minor
Found in packages/jsondiffpatch/src/filters/nested.ts - About 2 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 objectsDiffFilter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const objectsDiffFilter: Filter<DiffContext> = (context) => {
  if (context.leftIsArray || context.leftType !== 'object') {
    return;
  }

Severity: Minor
Found in packages/jsondiffpatch/src/filters/nested.ts - About 1 hr to fix

    Function collectChildrenDiffFilter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export const collectChildrenDiffFilter: Filter<DiffContext> = (context) => {
      if (!context || !context.children) {
        return;
      }
      const length = context.children.length;
    Severity: Minor
    Found in packages/jsondiffpatch/src/filters/nested.ts - 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 collectChildrenPatchFilter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      function collectChildrenPatchFilter(context) {
        if (!context || !context.children) {
          return;
        }
        const deltaWithChildren = context.delta as ObjectDelta | ArrayDelta;
    Severity: Minor
    Found in packages/jsondiffpatch/src/filters/nested.ts - 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

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

    export const collectChildrenReverseFilter: Filter<ReverseContext> = (
      context,
    ) => {
      if (!context || !context.children) {
        return;
    Severity: Minor
    Found in packages/jsondiffpatch/src/filters/nested.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

    There are no issues that match your filters.

    Category
    Status