RubyLouvre/anu

View on GitHub
packages/fiber/beginWork.js

Summary

Maintainability
F
4 days
Test Coverage

Function reconcileDFS has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

export function reconcileDFS(fiber, info, deadline, ENOUGH_TIME) {
    var topWork = fiber;
    outerLoop: while (fiber) {
        if (fiber.disposed || deadline.timeRemaining() <= ENOUGH_TIME) {
            break;
Severity: Minor
Found in packages/fiber/beginWork.js - About 6 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

File beginWork.js has 424 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { extend, typeNumber, isFn, gDSFP, gSBU } from 'react-core/util';
import { fiberizeChildren } from 'react-core/createElement';
import { AnuPortal } from 'react-core/createPortal';

import { Renderer } from 'react-core/createRenderer';
Severity: Minor
Found in packages/fiber/beginWork.js - About 6 hrs to fix

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

    function diffChildren(parentFiber, children) {
        let oldFibers = parentFiber.children; // 旧的
        if (oldFibers) {
            parentFiber.oldChildren = oldFibers;
        } else {
    Severity: Minor
    Found in packages/fiber/beginWork.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 updateClassComponent has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    export function updateClassComponent(fiber, info) {
        let { type, stateNode: instance, props } = fiber;
        let { contextStack, containerStack } = info;
        let getContext = type.contextType;
        let unmaskedContext = contextStack[0];
    Severity: Minor
    Found in packages/fiber/beginWork.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 updateClassComponent has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function updateClassComponent(fiber, info) {
        let { type, stateNode: instance, props } = fiber;
        let { contextStack, containerStack } = info;
        let getContext = type.contextType;
        let unmaskedContext = contextStack[0];
    Severity: Major
    Found in packages/fiber/beginWork.js - About 3 hrs to fix

      Function diffChildren has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function diffChildren(parentFiber, children) {
          let oldFibers = parentFiber.children; // 旧的
          if (oldFibers) {
              parentFiber.oldChildren = oldFibers;
          } else {
      Severity: Major
      Found in packages/fiber/beginWork.js - About 2 hrs to fix

        Function reconcileDFS has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function reconcileDFS(fiber, info, deadline, ENOUGH_TIME) {
            var topWork = fiber;
            outerLoop: while (fiber) {
                if (fiber.disposed || deadline.timeRemaining() <= ENOUGH_TIME) {
                    break;
        Severity: Major
        Found in packages/fiber/beginWork.js - About 2 hrs to fix

          Function applybeforeUpdateHooks has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function applybeforeUpdateHooks(
              fiber,
              instance,
              newProps,
              newContext,
          Severity: Minor
          Found in packages/fiber/beginWork.js - About 1 hr to fix

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

            function mergeStates(fiber, nextProps) {
                let instance = fiber.stateNode,
                    pendings = fiber.updateQueue.pendingStates,
                    n = pendings.length,
                    state = fiber.memoizedState || instance.state;
            Severity: Minor
            Found in packages/fiber/beginWork.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 applybeforeUpdateHooks has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function applybeforeUpdateHooks(
                fiber,
                instance,
                newProps,
                newContext,
            Severity: Minor
            Found in packages/fiber/beginWork.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 mergeStates has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function mergeStates(fiber, nextProps) {
                let instance = fiber.stateNode,
                    pendings = fiber.updateQueue.pendingStates,
                    n = pendings.length,
                    state = fiber.memoizedState || instance.state;
            Severity: Minor
            Found in packages/fiber/beginWork.js - About 1 hr to fix

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

              function getMaskedContext(instance, contextTypes, unmaskedContext) {
                  var noContext = !contextTypes;
                  if (instance){
                      if (noContext){
                          return instance.context;
              Severity: Minor
              Found in packages/fiber/beginWork.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

              Function applybeforeUpdateHooks has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  fiber,
                  instance,
                  newProps,
                  newContext,
                  contextStack
              Severity: Minor
              Found in packages/fiber/beginWork.js - About 35 mins to fix

                Function updateHostComponent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function updateHostComponent(fiber, info) {
                    const { props, tag, alternate: prev } = fiber;
                
                    if (!fiber.stateNode) {
                        fiber.parent = info.containerStack[0];
                Severity: Minor
                Found in packages/fiber/beginWork.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

                There are no issues that match your filters.

                Category
                Status