aureooms/js-memory

View on GitHub

Showing 4 of 8 total issues

Function heap has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
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.
Severity: Minor
Found in src/heap.js - About 4 hrs to fix

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

export function heap ( Buffer ) {

    /**
     * The *s* prefix in members and methods stands for size.
     * The *a* prefix in members and methods stands for address.
Severity: Major
Found in src/heap.js - About 3 hrs to fix

    Function free has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    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;
    Severity: Minor
    Found in src/heap.js - About 1 hr to fix

      Function smove has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Heap.prototype.smove = function(i, j) {
              var tmp, m, n, k;
              n = i - j;
              m = this.shi - this.slo - n;
      
      
      Severity: Minor
      Found in src/heap.js - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language