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;
- Read upRead up
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';
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 {
- Read upRead up
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];
- Read upRead up
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];
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 {
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;
Function applybeforeUpdateHooks
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function applybeforeUpdateHooks(
fiber,
instance,
newProps,
newContext,
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;
- Read upRead up
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,
- Read upRead up
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;
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;
- Read upRead up
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
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];
- Read upRead up
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"