Showing 4 of 8 total issues
Function heap
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
Open
export function heap ( Buffer ) {
/**
* The *s* prefix in members and methods stands for size.
* The *a* prefix in members and methods stands for address.
- 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 heap
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function heap ( Buffer ) {
/**
* The *s* prefix in members and methods stands for size.
* The *a* prefix in members and methods stands for address.
Function free
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Heap.prototype.free = function(i, n) {
var j, k, tmp, joinleft, joinright;
j = this.asearch(i, this.alo, this.ahi);
joinleft = this.addr[j-1] + this.size[this.amap[j-1]] === i;
Function smove
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Heap.prototype.smove = function(i, j) {
var tmp, m, n, k;
n = i - j;
m = this.shi - this.slo - n;