Showing 6 of 22 total issues
Function set
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const set = <T>(args: any[], value: T) => (cache: CacheObj<T>): void => {
let previousNode = cache.root
// tslint:disable-next-line: prefer-for-of
for (let i = 0; i < args.length; 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
Function filter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const filter = <A>(fn: (a: A) => unknown) => (list: List<A>): List<A> =>
let_<[A | Nil, List<A>], List<A>>((h, t) =>
isNil(h) ? Nil : fn(h) ? [h, filter(fn)(t)] : filter(fn)(t),
)(head(list), tail(list))
- 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 every
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const every = <A>(fn: (a: A) => unknown) => (list: List<A>): boolean =>
let_<[A | Nil, List<A>], boolean>((h, t) =>
isNil(h) ? true : !fn(h) ? false : every(fn)(t),
)(head(list), tail(list))
- 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 and
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const and = <Args extends any[]>(
...options: Array<((...args: Args) => unknown) | unknown>
) => (...args: Args): boolean =>
options.every(fnOrBool =>
isFunction(fnOrBool)
- 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 some
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const some = <A>(fn: (a: A) => unknown) => (list: List<A>): boolean =>
let_<[A | Nil, List<A>], boolean>((h, t) =>
isNil(h) ? false : fn(h) ? true : some(fn)(t),
)(head(list), tail(list))
- 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 last
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const last = <A>(list: List<A>): A | Nil =>
let_<[A | Nil, List<A>], A | Nil>((h, t) =>
isNil(h) ? Nil : isNil(t) ? h : last(t),
)(head(list), tail(list))
- 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"