Function diff
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
diff: function(newVal, oldVal) {
if (Object(newVal) === newVal) {
newVal = platform.toJson(newVal) //安全的遍历VBscript
if (Array.isArray(newVal)) { //转换成对象
var b = {}
- 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 diff
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
diff: function(newVal, oldVal) {
if (Object(newVal) === newVal) {
newVal = platform.toJson(newVal) //安全的遍历VBscript
if (Array.isArray(newVal)) { //转换成对象
var b = {}
Function equalObject
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function equalObject(a, b, level) {
if (a === null || b === null)
return false;
if (getEnumerableKeys(a).length !== getEnumerableKeys(b).length)
return false;
- 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 (newVal[i] !== oldVal[i]) {
hasChange = true
}
Avoid deeply nested control flow statements. Open
if (!deepEquals(newVal[i], oldVal[i], 4)) {
this.value = newVal
return true
}
Function deepEquals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function deepEquals(a, b, level) {
if (level === 0)
return a === b
if (a === null && b === null)
return 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
Avoid too many return
statements within this function. Open
return a === b
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return equalArray(a, b, level)
Avoid too many return
statements within this function. Open
return equalObject(a, b, level)
Avoid too many return
statements within this function. Open
return true
Function equalArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function equalArray(a, b, level) {
if (a.length !== b.length) {
return false
}
for (let i = a.length - 1; i >= 0; i--) {
- 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
Parsing error: 'import' and 'export' may appear only with 'sourceType: module' Open
import { avalon, platform } from '../seed/core'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/