Showing 7 of 9 total issues
Function compareDeep
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
export function compareDeep(
actual: any,
expected: any,
tab: string,
references: Set<unknown>,
- 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 compareDeep
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function compareDeep(
actual: any,
expected: any,
tab: string,
references: Set<unknown>,
Function match
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function match(actual: unknown, expected: unknown) {
let matchResult: boolean = true;
try {
if (actual !== expected) {
if (shouldFailOnExactCompare(typeof actual, typeof expected)) {
- 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 (compareResult) {
deepResult += `${prefix}${key}: {${compareResult},\n${tab}}`;
}
Avoid deeply nested control flow statements. Open
if (matchResult) {
deepResult += `${prefix}${key}: ${matchResult},`;
}
Function mustGoDeep
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function mustGoDeep(a: unknown, e: unknown, references: Set<unknown>) {
const result =
isJsonComparable(a) &&
isJsonComparable(e) &&
!references.has(a) &&
- 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 checkSomeCallsError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function checkSomeCallsError(
actualCall: SinonStub,
expectedCall: object[][],
compareFunc: (actual: unknown, expected: unknown) => 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"