ncbo/bioportal_web_ui

View on GitHub
public/widgets/jquery.ncbo.tree.js

Summary

Maintainability
F
1 wk
Test Coverage

Function NCBOTree has 370 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  $.fn.NCBOTree = function(opt) {
    var OPTIONS;
    var ROOT_ID = "roots";

    OPTIONS = {
Severity: Major
Found in public/widgets/jquery.ncbo.tree.js - About 1 day to fix

    File jquery.ncbo.tree.js has 374 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 public/widgets/jquery.ncbo.tree.js - About 5 hrs to fix

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

            TREE.setTreeNodes = function(obj, useParent) {
              obj = useParent ? obj.parent() : obj;
              $('li>a', obj).addClass('text').bind('selectstart', function() {
                return false;
              }).click(function(){
      Severity: Major
      Found in public/widgets/jquery.ncbo.tree.js - About 2 hrs to fix

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

              TREE.setAjaxNodes = function(node, parentId, successCallback, errorCallback) {
                if (typeof OPTIONS.beforeExpand == 'function') {
                  OPTIONS.beforeExpand(node);
                }
                $TREE_CONTAINER.trigger("beforeExpand", node);
        Severity: Minor
        Found in public/widgets/jquery.ncbo.tree.js - About 1 hr to fix

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

                TREE.formatNodes = function(nodes) {
                  var holder = $("<span>");
                  var ul = $("<ul>")
          
                  // Sort by prefLabel
          Severity: Minor
          Found in public/widgets/jquery.ncbo.tree.js - About 1 hr to fix

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

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

            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

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

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

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

                  TREE.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 public/widgets/jquery.ncbo.tree.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/bp_property_tree.js on lines 133..140

            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

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

                OPTIONS = {
                  autoclose:         false,
                  beforeExpand:      false,
                  afterExpand:       false,
                  afterExpandError:  false,
            Severity: Major
            Found in public/widgets/jquery.ncbo.tree.js and 3 other locations - About 2 hrs to fix
            public/widgets/jquery.ncbo.tree-2.0.0.js on lines 44..62
            public/widgets/jquery.ncbo.tree-2.0.1.js on lines 44..62
            public/widgets/jquery.ncbo.tree-2.0.2.js on lines 44..62

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

            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

                  TREE.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){
                      TREE.nodeToggle(node);
            Severity: Major
            Found in public/widgets/jquery.ncbo.tree.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/bp_property_tree.js on lines 264..274

            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

                        success: function(roots){
                          // Flatten potentially nested arrays
                          roots = $.map([roots], function(n){
                            return n;
                          });
            Severity: Major
            Found in public/widgets/jquery.ncbo.tree.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/bp_property_tree.js on lines 294..301

            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

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

                      var hasChildrenNotExpanded = typeof node.children !== 'undefined' && node.childrenCount > 0 && node.children.length == 0;
            Severity: Minor
            Found in public/widgets/jquery.ncbo.tree.js and 1 other location - About 30 mins to fix
            public/widgets/jquery.ncbo.tree-2.0.0.js on lines 148..148

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

            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