Showing 128 of 341 total issues
Avoid deeply nested control flow statements. Open
if (lastDom != null) {
parentNode.replaceChild(newDom, lastDom)
} else {
parentNode.appendChild(newDom)
}
Function createContext
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function createContext<T> (defaultValue: T): Context<T> {
const contextProp = '__context_' + uid++ + '__'
class Provider extends Component<ProviderProps<T>> {
static isContextProvider = true
- 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 h
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function h (type: string, props: Props, children?: VirtualChildren) {
let childNodes
if (props.children) {
if (!children) {
children = props.children
- 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 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
Function addChildren
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function addChildren (
childNodes: VirtualNode[],
children: VirtualNode | VirtualNode[],
type: string
) {
- 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 (
isValidElement(lastVnode) &&
lastVnode.children !== EMPTY_CHILDREN
) {
unmountChildren(lastVnode.children)
Avoid deeply nested control flow statements. Open
if (!props.value) {
renderedString += ` value="${encodeEntities(value)}"`
}
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 detach
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
detach (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
Function patch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
lastVnode,
nextVnode,
parentNode: Element,
context: object,
isSvg?: boolean
Function patchChildren
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
parentDom: Element,
lastChildren,
nextChildren,
context: object,
isSvg: boolean
Function patchProps
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
domNode: Element,
nextProps: Props,
previousProps: Props,
lastVnode: VNode,
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 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 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 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 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 newVNode