Tyriar/js-data-structures

View on GitHub

Showing 12 of 51 total issues

File red-black-tree.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @module lib/red-black-tree
 * @license MIT Copyright 2015 Daniel Imms (http://www.growingwiththeweb.com)
 */
'use strict';
Severity: Minor
Found in lib/red-black-tree.js - About 3 hrs to fix

File splay-tree.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @module lib/splay-tree
 * @license MIT Copyright 2014 Daniel Imms (http://www.growingwiththeweb.com)
 */
'use strict';
Severity: Minor
Found in lib/splay-tree.js - About 2 hrs to fix

Function deleteFixup has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  RedBlackTree.prototype.deleteFixup = function (node) {
    while (node !== this.root && node.color === 'black') {
      var w;
      if (node === node.parent.getLeft()) {
        w = node.parent.getRight();
Severity: Major
Found in lib/red-black-tree.js - About 2 hrs to fix

Function exports has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
  'use strict';

  grunt.config.init({
    pkg: grunt.file.readJSON('package.json')
Severity: Minor
Found in GruntFile.js - About 1 hr to fix

Function insertFixup has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  RedBlackTree.prototype.insertFixup = function (node) {
    while (node.parent && node.parent.parent && node.parent.color === 'red') {
      var uncle;
      if (node.parent === node.parent.parent.getLeft()) {
        uncle = node.parent.parent.getRight();
Severity: Minor
Found in lib/red-black-tree.js - About 1 hr to fix

Function remove has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  RedBlackTree.prototype.remove = function (key) {
    var node = this.search(key);
    if (!node) {
      return false;
    }
Severity: Minor
Found in lib/red-black-tree.js - About 1 hr to fix

Function add has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  BinarySearchTree.prototype.add = function (key) {
    var newNode = new BinaryTreeNode(key);

    if (!this.root) {
      this.nodeCount++;
Severity: Minor
Found in lib/binary-search-tree.js - About 1 hr to fix

Avoid deeply nested control flow statements.
Open

          if (node === node.parent.getLeft()) {
            node = node.parent;
            this.rotateRight(node);
          }
Severity: Major
Found in lib/red-black-tree.js - About 45 mins to fix

Avoid too many return statements within this function.
Open

    return false;
Severity: Major
Found in lib/splay-tree.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return containsInternal(tree, key, node.right);
Severity: Major
Found in lib/splay-tree.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return undefined;
Severity: Major
Found in lib/splay-tree.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return removeInternal2(tree, node);
Severity: Major
Found in lib/splay-tree.js - About 30 mins to fix
Severity
Category
Status
Source
Language