ncbo/bioportal_web_ui

View on GitHub
app/assets/javascripts/bp_property_tree.js

Summary

Maintainability
F
1 wk
Test Coverage

Function NCBOPropertyTree has 240 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var NCBOPropertyTree = function(element, opt) {
    var obj = this;
    var OPTIONS;
    var ROOT_ID = "roots";

Severity: Major
Found in app/assets/javascripts/bp_property_tree.js - About 1 day to fix

    Function setTreeNodes has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.setTreeNodes = function(target, useParent) {
          target = useParent ? target.parent() : target;
          $('li>a', target).addClass('text').bind('selectstart', function() {
            return false;
          }).click(function(){
    Severity: Major
    Found in app/assets/javascripts/bp_property_tree.js - About 2 hrs to fix

      File bp_property_tree.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
      * jQuery SimpleTree Drag&Drop plugin
      * Update on 22th May 2008
      * Version 0.3
      *
      Severity: Minor
      Found in app/assets/javascripts/bp_property_tree.js - About 2 hrs to fix

        Function setAjaxNodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.setAjaxNodes = function(node, parentId, successCallback, errorCallback) {
              if (typeof OPTIONS.beforeExpand == 'function') {
                OPTIONS.beforeExpand(node);
              }
              $TREE_CONTAINER.trigger("beforeExpand", node);
        Severity: Minor
        Found in app/assets/javascripts/bp_property_tree.js - About 1 hr to fix

          Function formatNodes has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              this.formatNodes = function(nodes) {
                var holder = $("<span>");
                var ul = $("<ul>");
          
                // Sort by prefLabel
          Severity: Minor
          Found in app/assets/javascripts/bp_property_tree.js - About 1 hr to fix

            Function init has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                this.init = function() {
                  ROOT.html($("<span>").html("Loading...").css("font-size", "smaller"));
                  $.ajax({
                    url: obj.determineHTTPS(OPTIONS.ncboUIURL) + "/ajax/properties/tree",
                    data: {
            Severity: Minor
            Found in app/assets/javascripts/bp_property_tree.js - About 1 hr to fix

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

                  this.setTreeNodes = function(target, useParent) {
                    target = useParent ? target.parent() : target;
                    $('li>a', target).addClass('text').bind('selectstart', function() {
                      return false;
                    }).click(function(){
              Severity: Major
              Found in app/assets/javascripts/bp_property_tree.js and 1 other location - About 4 days to fix
              public/widgets/jquery.ncbo.tree.js on lines 266..325

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

              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.setAjaxNodes = function(node, parentId, successCallback, errorCallback) {
                    if (typeof OPTIONS.beforeExpand == 'function') {
                      OPTIONS.beforeExpand(node);
                    }
                    $TREE_CONTAINER.trigger("beforeExpand", node);
              Severity: Major
              Found in app/assets/javascripts/bp_property_tree.js and 1 other location - About 2 days to fix
              public/widgets/jquery.ncbo.tree.js on lines 224..264

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

              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.nodeToggle = function(obj) {
                    var childUl = $('>ul',obj);
                    if (childUl.is(':visible')) {
                      obj.className = obj.className.replace('open','close');
                      childUl.hide();
              Severity: Major
              Found in app/assets/javascripts/bp_property_tree.js and 1 other location - About 5 hrs to fix
              public/widgets/jquery.ncbo.tree.js on lines 209..222

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

              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

                  this.selectedClass = function(){
                    var cls = $(TREE.find("a.active")[0]);
                    if (cls.length == 0) {
                      return null;
                    } else {
              Severity: Major
              Found in app/assets/javascripts/bp_property_tree.js and 3 other locations - About 3 hrs to fix
              public/widgets/jquery.ncbo.tree-2.0.0.js on lines 108..119
              public/widgets/jquery.ncbo.tree-2.0.1.js on lines 108..119
              public/widgets/jquery.ncbo.tree-2.0.2.js on lines 108..119

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

              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

                  this.closeNearby = function(obj) {
                    $(obj).siblings().filter('.folder-open, .folder-open-last').each(function(){
                      var childUl = $('>ul',this);
                      var className = this.className;
                      this.className = className.replace('open', 'close');
              Severity: Major
              Found in app/assets/javascripts/bp_property_tree.js and 1 other location - About 3 hrs to fix
              public/widgets/jquery.ncbo.tree.js on lines 200..207

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

              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.setTrigger = function(node) {
                    $('>a',node).before('<img class="trigger" src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" border=0>');
                    var trigger = $('>.trigger', node);
                    trigger.click(function(event){
                      obj.nodeToggle(node);
              Severity: Major
              Found in app/assets/javascripts/bp_property_tree.js and 1 other location - About 1 hr to fix
              public/widgets/jquery.ncbo.tree.js on lines 327..337

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

              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 (roots.length > 0) {
                          // Flatten potentially nested arrays
                          roots = $.map([roots], function(n){
                            return n;
                          });
              Severity: Major
              Found in app/assets/javascripts/bp_property_tree.js and 1 other location - About 1 hr to fix
              public/widgets/jquery.ncbo.tree.js on lines 406..413

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

              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