deps/v8/tools/splaytree.js

Summary

Maintainability
F
1 wk
Test Coverage

Function splay_ has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

SplayTree.prototype.splay_ = function(key) {
  if (this.isEmpty()) {
    return;
  }
  // Create a dummy node.  The use of the dummy node is a bit
Severity: Minor
Found in deps/v8/tools/splaytree.js - About 3 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 splay_ has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

SplayTree.prototype.splay_ = function(key) {
  if (this.isEmpty()) {
    return;
  }
  // Create a dummy node.  The use of the dummy node is a bit
Severity: Minor
Found in deps/v8/tools/splaytree.js - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

            if (!current.right) {
              break;
            }
    Severity: Major
    Found in deps/v8/tools/splaytree.js - About 45 mins to fix

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      SplayTree.prototype.splay_ = function(key) {
        if (this.isEmpty()) {
          return;
        }
        // Create a dummy node.  The use of the dummy node is a bit
      Severity: Major
      Found in deps/v8/tools/splaytree.js and 2 other locations - About 2 days to fix
      deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 198..257
      deps/v8/benchmarks/splay.js on lines 293..352

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 468.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      SplayTree.prototype.insert = function(key, value) {
        if (this.isEmpty()) {
          this.root_ = new SplayTree.Node(key, value);
          return;
        }
      Severity: Major
      Found in deps/v8/tools/splaytree.js and 2 other locations - About 1 day to fix
      deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 65..87
      deps/v8/benchmarks/splay.js on lines 160..182

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 246.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      SplayTree.prototype.remove = function(key) {
        if (this.isEmpty()) {
          throw Error('Key not found: ' + key);
        }
        this.splay_(key);
      Severity: Major
      Found in deps/v8/tools/splaytree.js and 2 other locations - About 1 day to fix
      deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 98..119
      deps/v8/benchmarks/splay.js on lines 193..214

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 215.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      SplayTree.prototype.findGreatestLessThan = function(key) {
        if (this.isEmpty()) {
          return null;
        }
        // Splay on the key to move the node with the given key or the last
      Severity: Major
      Found in deps/v8/tools/splaytree.js and 2 other locations - About 4 hrs to fix
      deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 157..173
      deps/v8/benchmarks/splay.js on lines 252..268

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 133.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      SplayTree.prototype.findMax = function(opt_startNode) {
        if (this.isEmpty()) {
          return null;
        }
        var current = opt_startNode || this.root_;
      Severity: Major
      Found in deps/v8/tools/splaytree.js and 2 other locations - About 2 hrs to fix
      deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 141..150
      deps/v8/benchmarks/splay.js on lines 236..245

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 82.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      SplayTree.prototype.find = function(key) {
        if (this.isEmpty()) {
          return null;
        }
        this.splay_(key);
      Severity: Major
      Found in deps/v8/tools/splaytree.js and 2 other locations - About 2 hrs to fix
      deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 129..135
      deps/v8/benchmarks/splay.js on lines 224..230

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 78.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status