indentlabs/notebook

View on GitHub
public/navigator/js-mindmap.js

Summary

Maintainability
F
3 days
Test Coverage

File js-mindmap.js has 430 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 js-mindmap

 Copyright (c) 2008/09/10 Kenneth Kufluk http://kenneth.kufluk.com/

Severity: Minor
Found in public/navigator/js-mindmap.js - About 6 hrs to fix

    Function mindmap has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      $.fn.mindmap = function (options) {
        // Define default settings.
        options = $.extend({
          attract: 15,
          repulse: 6,
    Severity: Major
    Found in public/navigator/js-mindmap.js - About 4 hrs to fix

      Function getForceVector has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        Node.prototype.getForceVector = function () {
          var i, x1, y1, xsign, dist, theta, f,
            xdist, rightdist, bottomdist, otherend,
            fx = 0,
            fy = 0,
      Severity: Major
      Found in public/navigator/js-mindmap.js - About 3 hrs to fix

        Function display has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Node.prototype.display = function (depth) {
            var parent = this,
              stepAngle,
              angle;
        
        
        Severity: Minor
        Found in public/navigator/js-mindmap.js - About 1 hr to fix

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

            Node.prototype.updatePosition = function () {
              var forces, showx, showy;
          
              if (this.el.hasClass("ui-draggable-dragging")) {
                this.x = parseInt(this.el.css('left'), 10) + (this.el.width() / 2);
          Severity: Minor
          Found in public/navigator/js-mindmap.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                            if (activeParent.children[i] === mindmap.activeNode) {
                              newNode = activeParent.children[i + 1];
                            }
            Severity: Major
            Found in public/navigator/js-mindmap.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if (activeParent.children[i] === mindmap.activeNode) {
                                newNode = activeParent.children[i - 1];
                              }
              Severity: Major
              Found in public/navigator/js-mindmap.js - About 45 mins to fix

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

                        if (x1 === 0) {
                          theta = Math.PI / 2;
                          xsign = 0;
                        } else {
                          theta = Math.atan(y1 / x1);
                Severity: Major
                Found in public/navigator/js-mindmap.js and 1 other location - About 2 hrs to fix
                public/navigator/js-mindmap.js on lines 343..350

                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

                        if (x1 === 0) {
                          theta = Math.PI / 2;
                          xsign = 0;
                        }
                        else {
                Severity: Major
                Found in public/navigator/js-mindmap.js and 1 other location - About 2 hrs to fix
                public/navigator/js-mindmap.js on lines 293..299

                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

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

                    if (Math.abs(fx) > this.options.maxForce) {
                      fx = this.options.maxForce * (fx / Math.abs(fx));
                    }
                Severity: Major
                Found in public/navigator/js-mindmap.js and 1 other location - About 1 hr to fix
                public/navigator/js-mindmap.js on lines 383..385

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

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

                    if (Math.abs(fy) > this.options.maxForce) {
                      fy = this.options.maxForce * (fy / Math.abs(fy));
                    }
                Severity: Major
                Found in public/navigator/js-mindmap.js and 1 other location - About 1 hr to fix
                public/navigator/js-mindmap.js on lines 380..382

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

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

                      if (this.obj.activeNode !== this && this.obj.activeNode !== this.parent && this.obj.activeNode.parent !== this) {
                        // TODO hide me!
                        this.el.hide();
                        this.visible = false;
                      }
                Severity: Minor
                Found in public/navigator/js-mindmap.js and 1 other location - About 55 mins to fix
                public/navigator/js-mindmap.js on lines 195..198

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

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

                      if (this.obj.activeNode === this || this.obj.activeNode === this.parent || this.obj.activeNode.parent === this) {
                        this.el.show();
                        this.visible = true;
                      }
                Severity: Minor
                Found in public/navigator/js-mindmap.js and 1 other location - About 55 mins to fix
                public/navigator/js-mindmap.js on lines 189..193

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

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

                      this.y = parseInt(this.el.css('top'), 10) + (this.el.height() / 2);
                Severity: Minor
                Found in public/navigator/js-mindmap.js and 1 other location - About 35 mins to fix
                public/navigator/js-mindmap.js on lines 230..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 47.

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

                      this.x = parseInt(this.el.css('left'), 10) + (this.el.width() / 2);
                Severity: Minor
                Found in public/navigator/js-mindmap.js and 1 other location - About 35 mins to fix
                public/navigator/js-mindmap.js on lines 231..231

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

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

                              for (i = activeParent.children.length - 2; i >= 0; i--) {
                                if (activeParent.children[i] === mindmap.activeNode) {
                                  newNode = activeParent.children[i + 1];
                                }
                              }
                Severity: Minor
                Found in public/navigator/js-mindmap.js and 1 other location - About 35 mins to fix
                public/navigator/js-mindmap.js on lines 542..546

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

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

                              for (i = 1; i < activeParent.children.length; i++) {
                                if (activeParent.children[i] === mindmap.activeNode) {
                                  newNode = activeParent.children[i - 1];
                                }
                              }
                Severity: Minor
                Found in public/navigator/js-mindmap.js and 1 other location - About 35 mins to fix
                public/navigator/js-mindmap.js on lines 559..563

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

                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