Showing 33 of 64 total issues
Function strCompare
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
public static strCompare(a: string, b: string): number {
var ia = 0;
var ib = 0;
var ma = a.length;
var mb = b.length;
- 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
BaseLinqable
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
export class BaseLinqable<T> extends Behaviour<T> {
/**
* Returns the only element of a sequence,
* and throws an exception if there is not exactly one element in the sequence.
* @throws {InvalidOperationError} The input sequence is empty. || The input sequence contains more than one element.
File BaseLinqable.ts
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
import aggregate, { aggregateDelegate } from '../core/aggregate';
import { InvalidOperationError } from "../error";
import { LinqArrayIterable } from "./iterable";
import { Behaviour } from './behaviour';
import where from '../core/where';
Function Transpose
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public Transpose<T>(): Array<Array<T>> {
if (!this.array) throw new ArgumentNullError("array");
var source: Array<Array<T>> = this.array as any;
let generator = function* (): IterableIterator<Array<T>> {
var enumerators =
- 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 strCompare
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static strCompare(a: string, b: string): number {
var ia = 0;
var ib = 0;
var ma = a.length;
var mb = b.length;
Function Except
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public Except(arr: Array<T> | number, comparer?: (x: T, y: T) => boolean) {
let array: Array<T>;
let element: T = null;
comparer = comparer || this.EqualityComparer;
if (!(arr instanceof Array))
- 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 SortComparer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected SortComparer(a: any, b: any): number {
if (a === b) return 0;
if (a === null || a === undefined) return -1;
if (b === null || b === undefined) return 1;
if (a.hasOwnProperty("Compare"))
- 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 Batch
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public Batch(size: number, resultSelector?: (arr: Array<T>) => Array<T>): Array<T[]> {
let source = this.array;
resultSelector = resultSelector || ((arr: Array<T>) => arr);
let generator = function* (): IterableIterator<Array<T>> {
let bucket: T[] = 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 Flatten
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public Flatten(predicate?: (arr: Array<{}>) => boolean) {
this.checkArray();
predicate = predicate || ((x) => typeof x !== "string");
let that = this;
let generator = function* () {
- 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 Except
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Except(arr: Array<T> | number, comparer?: (x: T, y: T) => boolean) {
let array: Array<T>;
let element: T = null;
comparer = comparer || this.EqualityComparer;
if (!(arr instanceof Array))
Function Flatten
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Flatten(predicate?: (arr: Array<{}>) => boolean) {
this.checkArray();
predicate = predicate || ((x) => typeof x !== "string");
let that = this;
let generator = function* () {
Function Transpose
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Transpose<T>(): Array<Array<T>> {
if (!this.array) throw new ArgumentNullError("array");
var source: Array<Array<T>> = this.array as any;
let generator = function* (): IterableIterator<Array<T>> {
var enumerators =
Function EqualityComparer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected EqualityComparer(a: any, b: any): boolean {
if (a === b) return true;
if (a === null || a === undefined) return false;
if (b === null || b === undefined) return false;
if (typeof a == '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 Lag
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public Lag<TResult>(offset: number, defaultValue: T, selector: (x: T, y: T) => TResult): TResult[] {
this.checkArray();
if (!selector) throw new ArgumentNullError("Selector is undefined.");
if (offset <= 0) throw new ArgumentOutOfRangeError("offset <= 0");
let that = this;
- 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 Exclude
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public Exclude(startIndex: number, count: number): T[] {
this.checkArray();
if (startIndex < 0) throw new ArgumentOutOfRangeError("startIndex is negative.");
if (count < 0) throw new ArgumentOutOfRangeError("count is negative.");
if (count == 0) return this.array;
- 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 Min
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public Min(selector?: (element: T) => number): number {
this.checkArray();
var l = this.array.length;
if (l == 0)
return 0;
- 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 MinBy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public MinBy(selector: (element: T) => number): T {
this.checkArray();
var l = this.array.length;
if (l == 0)
throw new InvalidOperationError("Array Is Empty.");
- 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 MaxBy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public MaxBy(selector: (element: T) => number): T {
this.checkArray();
var l = this.array.length;
if (l == 0)
throw new InvalidOperationError("Array Is Empty.");
- 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
if (ca > cb) return 1;
Avoid too many return
statements within this function. Open
if (ma < mb) return -1;