Showing 15 of 53 total issues
File simple-matcher.ts
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
import deepEqual = require("deep-equal");
import { MatchError } from "alsatian";
import { SpecError } from "../errors";
import { ISimpleMatcher } from "./i-simple-matcher";
File elements-matcher.ts
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IPropertiesMatcher } from "./i-properties-matcher";
import { MatchMode, LocationMode, EqType, AssertionContext } from "../types";
import { IFluentCore } from "./i-fluent-core";
import { IElementsMatcher } from "./i-elements-matcher";
import { INarrowableFluentCore } from "./i-narrowable-fluent-core";
SimpleMatcher
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
export class SimpleMatcher<T, TNext, TPrev> extends Operators<T, TNext, TPrev>
implements ISimpleMatcher<T, TNext, TPrev> {
constructor(actualValue: any,
nextValue: any,
initial: boolean,
Function _assertSequentialHasElements
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected _assertSequentialHasElements(
expected: Array<any>,
location: LocationMode,
elMode: MatchMode,
path: Array<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
Function _assertSequentialHasElements
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected _assertSequentialHasElements(
expected: Array<any>,
location: LocationMode,
elMode: MatchMode,
path: Array<string>
Function _heuristicMatch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected _heuristicMatch(
actual: any,
expected: any,
location: LocationMode,
elMode: MatchMode.asserts | MatchMode.normal
- 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 hasProperty
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public hasProperty<R>(
expected: ((o: T) => R) | keyof T
): INarrowableFluentCore<T, R, TPrev>
{
this.setCurrentNode(this.hasProperty.name, null);
Function isEmpty
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public isEmpty(): IFluentCore<T, TNext, TPrev> {
this.setCurrentNode(this.isEmpty.name, null);
if (
!(
typeof this.actualValue === "object" ||
Function _assertHasElements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected _assertHasElements(
actual: Array<any>,
expected: Array<any>,
location: LocationMode,
elMode: MatchMode,
- 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 _assertContainsElements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected _assertContainsElements(
expected: Array<any>,
location: LocationMode,
elMode: MatchMode,
path: Array<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
Function hasProperty
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public hasProperty<R>(
expected: ((o: T) => R) | keyof T
): INarrowableFluentCore<T, R, TPrev>
{
this.setCurrentNode(this.hasProperty.name, 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 too many return
statements within this function. Open
return expected(actual);
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return this._deeplyEquals(actual, expected, EqType.strictly);
Function _assertThrew
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected _assertThrew<TError extends Error>(
threw: Error,
errorType: {
new (...args: Array<any>): TError;
}
- 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"