enclose-io/compiler

View on GitHub
lts/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 lts/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 lts/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 lts/deps/v8/tools/splaytree.js - About 45 mins to fix

      Similar blocks of code found in 4 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 lts/deps/v8/tools/splaytree.js and 3 other locations - About 2 days to fix
      lts/deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 198..257
      lts/deps/v8/benchmarks/splay.js on lines 293..352
      current/deps/v8/tools/splaytree.js on lines 224..283

      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 4 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 lts/deps/v8/tools/splaytree.js and 3 other locations - About 1 day to fix
      lts/deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 65..87
      lts/deps/v8/benchmarks/splay.js on lines 160..182
      current/deps/v8/tools/splaytree.js on lines 67..89

      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 4 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 lts/deps/v8/tools/splaytree.js and 3 other locations - About 1 day to fix
      lts/deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 98..119
      lts/deps/v8/benchmarks/splay.js on lines 193..214
      current/deps/v8/tools/splaytree.js on lines 100..121

      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 4 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 lts/deps/v8/tools/splaytree.js and 3 other locations - About 4 hrs to fix
      lts/deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 157..173
      lts/deps/v8/benchmarks/splay.js on lines 252..268
      current/deps/v8/tools/splaytree.js on lines 174..190

      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

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

      SplayTree.prototype.traverse_ = function(f) {
        var nodesToVisit = [this.root_];
        while (nodesToVisit.length > 0) {
          var node = nodesToVisit.shift();
          if (node == null) {
      Severity: Major
      Found in lts/deps/v8/tools/splaytree.js and 1 other location - About 4 hrs to fix
      current/deps/v8/tools/splaytree.js on lines 292..303

      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 116.

      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 4 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 lts/deps/v8/tools/splaytree.js and 3 other locations - About 2 hrs to fix
      lts/deps/v8/benchmarks/spinning-balls/splay-tree.js on lines 141..150
      lts/deps/v8/benchmarks/splay.js on lines 236..245
      current/deps/v8/tools/splaytree.js on lines 158..167

      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 4 locations. Consider refactoring.
      Open

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

      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

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

      SplayTree.prototype.findMin = function() {
        if (this.isEmpty()) {
          return null;
        }
        var current = this.root_;
      Severity: Major
      Found in lts/deps/v8/tools/splaytree.js and 1 other location - About 2 hrs to fix
      current/deps/v8/tools/splaytree.js on lines 143..152

      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 77.

      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 2 locations. Consider refactoring.
      Open

      SplayTree.prototype.exportKeysAndValues = function() {
        var result = [];
        this.traverse_(function(node) { result.push([node.key, node.value]); });
        return result;
      };
      Severity: Major
      Found in lts/deps/v8/tools/splaytree.js and 1 other location - About 1 hr to fix
      current/deps/v8/tools/splaytree.js on lines 197..201

      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 74.

      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 2 locations. Consider refactoring.
      Open

      SplayTree.prototype.exportValues = function() {
        var result = [];
        this.traverse_(function(node) { result.push(node.value); });
        return result;
      };
      Severity: Major
      Found in lts/deps/v8/tools/splaytree.js and 1 other location - About 1 hr to fix
      current/deps/v8/tools/splaytree.js on lines 207..211

      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 67.

      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