Showing 6 of 8 total issues
Function sortBy
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
export const sortBy = (cmp, as) => {
const sequences = as => {
if (isEmpty(as)) { return list(as) }
let xs = tail(as)
if (isEmpty(xs)) { return list(as) }
- 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 sortBy
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const sortBy = (cmp, as) => {
const sequences = as => {
if (isEmpty(as)) { return list(as) }
let xs = tail(as)
if (isEmpty(xs)) { return list(as) }
Function listRangeBy
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const listRangeBy = (start, end, step) => {
if (start === end) { return list(start) }
let x = start
const xs = list(x)
const listGenerator = 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 cycle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const cycle = as => {
if (isEmpty(as)) { throw new EmptyListError(cycle) }
let x = head(as)
let xs = tail(as)
const c = list(x)
- 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 compare
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
compare (ys) {
if (isEmpty(this) && isEmpty(ys)) { return EQ }
if (isEmpty(this) && !isEmpty(ys)) { return LT }
if (!isEmpty(this) && isEmpty(ys)) { return GT }
if (this.head() === head(ys)) { return this.tail().compare(tail(ys)) }
- 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 this.head() < head(ys) ? LT : GT