Showing 128 of 341 total issues
Avoid deeply nested control flow statements. Open
if (
isValidElement(lastVnode) &&
lastVnode.children !== EMPTY_CHILDREN
) {
unmountChildren(lastVnode.children)
Function attach
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
attach (vnode, ref, domNode: Element) {
const node = isComposite(vnode) ? vnode.component : domNode
if (isFunction(ref)) {
const componentForCatcher = isComposite(vnode) ? vnode.component : vnode
errorCatcher(() => {
- 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
Avoid deeply nested control flow statements. Open
if (isSvg && namespace) {
if (nextValue) {
domNode.setAttributeNS(namespace, prop, nextValue)
} else {
const colonPosition = prop.indexOf(':')
Function mountComponent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function mountComponent (
vnode: FullComponent,
parentContext: ParentContext,
parentComponent
) {
- 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
Avoid deeply nested control flow statements. Open
for (let i = 0, len = children.length; i < len; i++) {
const child = children[i]
if (isString(child)) {
renderedString += child === '' ? ' ' : encodeEntities(child)
} else if (isNumber(child)) {
Function patchProp
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
domNode: Element,
prop: string,
lastValue,
nextValue,
lastVnode: VNode | null,
Avoid deeply nested control flow statements. Open
if (patched < bLeft) {
for (j = bStart; j <= bEnd; j++) {
bNode = b[j]
if (aNode.key === bNode.key) {
sources[j - bStart] = i
Function getData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function getData (_vnode) {
const vnode = _vnode instanceof Component ? _vnode.vnode : _vnode
const component = vnode.component
let updater: any = null
- 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
Avoid deeply nested control flow statements. Open
if (!props.value) {
renderedString += ` value="${encodeEntities(value)}"`
}
Function patchProps
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
domNode: Element,
nextProps: Props,
previousProps: Props,
lastVnode: VNode,
isSvg?: boolean
Function patchChildren
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
parentDom: Element,
lastChildren,
nextChildren,
context: object,
isSvg: boolean
Function patchArrayChildren
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
parentDom: Element,
lastChildren,
nextChildren,
context: object,
isSvg: boolean
Function mountChild
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
child: VNode,
domNode: Element,
parentContext: Object,
isSvg?: boolean,
parentComponent?
Function dispatchEvent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function dispatchEvent (event, target, items, count, eventData) {
Function patch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
lastVnode,
nextVnode,
parentNode: Element,
context: object,
isSvg?: boolean
Function mountElement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function mountElement (
element: Element | Text | Comment | Array<Element | Text | Comment>,
parentNode: Element,
refChild?: Node | null
) {
- 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 transformPropsForComponent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function transformPropsForComponent (props: Props, defaultProps?: Props) {
const newProps: any = {}
for (const propName in props) {
const propValue = props[propName]
newProps[propName] = propValue
- 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 initDevTools
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function initDevTools () {
const hook = (window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__
if (hook == null) {
return
}
- 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 transformPropsForRealTag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function transformPropsForRealTag (type: string, props: Props) {
const newProps: Props = {}
for (const propName in props) {
const propValue = props[propName]
if (propName === 'defaultValue') {
- 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
Avoid too many return
statements within this function. Open
return true