RubyLouvre/anu

View on GitHub
packages/fiber/commitWork.js

Summary

Maintainability
D
2 days
Test Coverage

Function commitDFSImpl has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

function commitDFSImpl(fiber) {
    let topFiber = fiber;
    outerLoop: while (true) {
        //逐步向下执行所有移除与插入操作
        if (fiber.effects && fiber.effects.length) {
Severity: Minor
Found in packages/fiber/commitWork.js - 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 commitEffects has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export function commitEffects(fiber) {
    let instance = fiber.stateNode || emptyObject;
    let amount = fiber.effectTag;
    let updater = instance.updater || fakeObject;
    for (let i = 0; i < effectLength; i++) {
Severity: Minor
Found in packages/fiber/commitWork.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 commitEffects has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function commitEffects(fiber) {
    let instance = fiber.stateNode || emptyObject;
    let amount = fiber.effectTag;
    let updater = instance.updater || fakeObject;
    for (let i = 0; i < effectLength; i++) {
Severity: Major
Found in packages/fiber/commitWork.js - About 2 hrs to fix

    Function commitDFSImpl has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function commitDFSImpl(fiber) {
        let topFiber = fiber;
        outerLoop: while (true) {
            //逐步向下执行所有移除与插入操作
            if (fiber.effects && fiber.effects.length) {
    Severity: Minor
    Found in packages/fiber/commitWork.js - About 1 hr to fix

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

      function disposeFiber(fiber, force) {
          let { stateNode, effectTag } = fiber;
          if (!stateNode) {
              return;
          }
      Severity: Minor
      Found in packages/fiber/commitWork.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 disposeFibers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export function disposeFibers(fiber) {
          let list = [fiber.oldChildren, fiber.children];
          for (let i = 0; i < 2; i++) {
              let c = list[i];
              if (c) {
      Severity: Minor
      Found in packages/fiber/commitWork.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 disposeFiber has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function disposeFiber(fiber, force) {
          let { stateNode, effectTag } = fiber;
          if (!stateNode) {
              return;
          }
      Severity: Minor
      Found in packages/fiber/commitWork.js - About 1 hr to fix

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

        function safeInvokeHooks(upateQueue, create, destory) {
            var uneffects = upateQueue[destory],
                effects = upateQueue[create], fn;
            if (!uneffects){
                return;
        Severity: Minor
        Found in packages/fiber/commitWork.js - 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

        There are no issues that match your filters.

        Category
        Status