Function patchKeyedChildren
has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring. Open
function patchKeyedChildren (
a: VNode[],
b: VNode[],
dom: Element,
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
File patch.ts
has 612 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* tslint:disable: no-empty*/
import {
isString,
isAttrAnEvent,
isNumber,
Function patchProp
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
export function patchProp (
domNode: Element,
prop: string,
lastValue,
nextValue,
- 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 patchKeyedChildren
has 167 lines of code (exceeds 25 allowed). Consider refactoring. Open
function patchKeyedChildren (
a: VNode[],
b: VNode[],
dom: Element,
context,
Function patch
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export function patch (
lastVnode,
nextVnode,
parentNode: Element,
context: object,
- 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 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function patch (
lastVnode,
nextVnode,
parentNode: Element,
context: object,
Function patchProp
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function patchProp (
domNode: Element,
prop: string,
lastValue,
nextValue,
Function lis
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function lis (a: number[]): number[] {
const p = a.slice()
const result: number[] = []
result.push(0)
let u: number
- 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 patchStyle
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function patchStyle (lastAttrValue: CSSStyleSheet, nextAttrValue: CSSStyleSheet, dom: HTMLElement) {
const domStyle = dom.style
let style
let value
- 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 patchNonKeyedChildren
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function patchNonKeyedChildren (
parentDom: Element,
lastChildren,
nextChildren,
context: object,
- 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 lis
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lis (a: number[]): number[] {
const p = a.slice()
const result: number[] = []
result.push(0)
let u: number
Function patchArrayChildren
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function patchArrayChildren (
parentDom: Element,
lastChildren,
nextChildren,
context: object,
Function patchArrayChildren
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function patchArrayChildren (
parentDom: Element,
lastChildren,
nextChildren,
context: object,
- 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 patchNonKeyedChildren
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function patchNonKeyedChildren (
parentDom: Element,
lastChildren,
nextChildren,
context: object,
Function patchProps
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function patchProps (
domNode: Element,
nextProps: Props,
previousProps: Props,
lastVnode: VNode,
- 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 patchNonKeyedChildren
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
parentDom: Element,
lastChildren,
nextChildren,
context: object,
isSvg: boolean,
Function patchKeyedChildren
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
a: VNode[],
b: VNode[],
dom: Element,
context,
isSvg: boolean,
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
Avoid deeply nested control flow statements. Open
if (patched < bLeft) {
j = keyIndex.get(aNode.key)
if (j !== undefined) {
bNode = b[j]
Avoid deeply nested control flow statements. Open
if (isSvg && namespace) {
if (nextValue) {
domNode.setAttributeNS(namespace, prop, nextValue)
} else {
const colonPosition = prop.indexOf(':')
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
} else if (patched !== bLeft) {
for (i = bLeft - 1; i >= 0; i--) {
if (sources[i] === -1) {
pos = i + bStart
node = b[pos]
Avoid deeply nested control flow statements. Open
for (i = bLeft - 1; i >= 0; i--) {
if (sources[i] === -1) {
pos = i + bStart
node = b[pos]
nextPos = pos + 1
Avoid deeply nested control flow statements. Open
if (aNode !== null) {
unmount(aNode, dom)
i--
}
Avoid deeply nested control flow statements. Open
if (lastDom != null) {
parentNode.replaceChild(newDom, lastDom)
} else {
parentNode.appendChild(newDom)
}
Avoid deeply nested control flow statements. Open
if (
isValidElement(lastVnode) &&
lastVnode.children !== EMPTY_CHILDREN
) {
unmountChildren(lastVnode.children)
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 setStyle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function setStyle (domStyle, style, value) {
if (isNullOrUndef(value) || (isNumber(value) && isNaN(value))) {
domStyle[style] = ''
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (sources[i] === -1) {
pos = i + bStart
node = b[pos]
nextPos = pos + 1
attachNewNode(
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 70.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (sources[i] === -1) {
pos = i + bStart
node = b[pos]
nextPos = pos + 1
attachNewNode(
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 70.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
while (aStartNode.key === bStartNode.key) {
patch(aStartNode, bStartNode, dom, context, isSvg)
aStart++
bStart++
if (aStart > aEnd || bStart > bEnd) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
while (aEndNode.key === bEndNode.key) {
patch(aEndNode, bEndNode, dom, context, isSvg)
aEnd--
bEnd--
if (aStart > aEnd || bStart > bEnd) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76