ncbo/bioportal_web_ui

View on GitHub

Showing 628 of 628 total issues

Function get_annotations has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

function get_annotations() {
  jQuery("#results_error").html("");
  jQuery("#annotator_error").html("");

  // Validation
Severity: Minor
Found in app/assets/javascripts/bp_annotatorplus.js - About 2 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 setClass has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        setClass: function(element, add, remove, options) {
          options = parseAnimateOptions(options);

          var STORAGE_KEY = '$$animateClasses';
          element = angular.element(element);
Severity: Major
Found in public/browse/lib/angular-animate/angular-animate.js - About 2 hrs to fix

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

        var 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-2.0.0.js - About 2 hrs to fix

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

            function runSuggest(e) {
              var search = function(searchData) {
                if (this.value.length < settings.minCharacters) {
                  clearAndHideResults();
                  return false;
      Severity: Major
      Found in public/widgets/jquery.ncbo.autocomplete.js - About 2 hrs to fix

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

            var 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-2.0.2.js - About 2 hrs to fix

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

          function ngViewFactory($route, $anchorScroll, $animate) {
            return {
              restrict: 'ECA',
              terminal: true,
              priority: 400,
          Severity: Major
          Found in public/browse/lib/angular-route/angular-route.js - About 2 hrs to fix

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

                var 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-2.0.1.js - About 2 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 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

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

                          beforeRemoveClass: function(element, className, animationCompleted, options) {
                            options = options || {};
                            var cancellationMethod = animateBefore('removeClass', element, suffixClasses(className, '-remove'), options.from);
                            if (cancellationMethod) {
                              afterReflow(element, animationCompleted);
                  Severity: Major
                  Found in public/browse/lib/angular-animate/angular-animate.js and 1 other location - About 2 hrs to fix
                  public/browse/lib/angular-animate/angular-animate.js on lines 2081..2090

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

                  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

                      var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"), // .*+?|()[]{}\
                          keywords = jQuery(jumpTo_searchBoxSelector).val().trim().replace(specials, "\\$&").split(' ').join('|'),
                          regex = new RegExp('(' + keywords + ')', 'gi');
                  Severity: Major
                  Found in public/javascripts/widgets/quick_jump.js and 1 other location - About 2 hrs to fix
                  public/javascripts/widgets/form_complete.js on lines 158..160

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

                  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

                          beforeAddClass: function(element, className, animationCompleted, options) {
                            options = options || {};
                            var cancellationMethod = animateBefore('addClass', element, suffixClasses(className, '-add'), options.from);
                            if (cancellationMethod) {
                              afterReflow(element, animationCompleted);
                  Severity: Major
                  Found in public/browse/lib/angular-animate/angular-animate.js and 1 other location - About 2 hrs to fix
                  public/browse/lib/angular-animate/angular-animate.js on lines 2092..2101

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

                  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

                      var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"), // .*+?|()[]{}\
                          keywords = jQuery(input).val().trim().replace(specials, "\\$&").split(' ').join('|'),
                          regex = new RegExp('(' + keywords + ')', 'gi');
                  Severity: Major
                  Found in public/javascripts/widgets/form_complete.js and 1 other location - About 2 hrs to fix
                  public/javascripts/widgets/quick_jump.js on lines 161..163

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

                  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

                    if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 10) {
                      div.append(jQuery("<span>").css("font-weight", "bold").html(text));
                      div.append("<br/>");
                    }
                  Severity: Major
                  Found in app/assets/javascripts/bp_ontolobridge.js and 2 other locations - About 2 hrs to fix
                  app/assets/javascripts/bp_notes.js on lines 271..274
                  app/assets/javascripts/bp_ontolobridge.js on lines 271..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 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 3 locations. Consider refactoring.
                  Open

                    if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 10) {
                      div.append(jQuery("<span>").css("font-weight", "bold").html(text));
                      div.append("<br/>");
                    }
                  Severity: Major
                  Found in app/assets/javascripts/bp_ontolobridge.js and 2 other locations - About 2 hrs to fix
                  app/assets/javascripts/bp_notes.js on lines 271..274
                  app/assets/javascripts/bp_ontolobridge.js on lines 240..243

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

                    if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 10) {
                      div.append(jQuery("<span>").css("font-weight", "bold").html(text));
                      div.append("<br/>");
                    }
                  Severity: Major
                  Found in app/assets/javascripts/bp_notes.js and 2 other locations - About 2 hrs to fix
                  app/assets/javascripts/bp_ontolobridge.js on lines 240..243
                  app/assets/javascripts/bp_ontolobridge.js on lines 271..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 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

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

                        filter: function(ontology) {
                          if ($scope.facets.types.active.length == 0)
                            return true;
                          if ($scope.facets.types.active.indexOf(ontology.type) === -1)
                            return false;
                  Severity: Major
                  Found in public/browse/app.js and 1 other location - About 2 hrs to fix
                  public/browse/app.js on lines 66..72

                  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

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

                        filter: function(ontology) {
                          if ($scope.facets.formats.active.length == 0)
                            return true;
                          if ($scope.facets.formats.active.indexOf(ontology.format) === -1)
                            return false;
                  Severity: Major
                  Found in public/browse/app.js and 1 other location - About 2 hrs to fix
                  public/browse/app.js on lines 55..61

                  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

                    def massage_annotated_classes(annotations, options)
                      # Get the class details required for display, assume this is necessary
                      # for every element of the annotations array because the API returns a set.
                      # Use the batch REST API to get all the annotated class prefLabels.
                      start = Time.now
                  Severity: Major
                  Found in app/controllers/annotatorplus_controller.rb and 1 other location - About 2 hrs to fix
                  app/controllers/annotator_controller.rb on lines 95..112

                  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

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

                    def massage_annotated_classes(annotations, options)
                      # Get the class details required for display, assume this is necessary
                      # for every element of the annotations array because the API returns a set.
                      # Use the batch REST API to get all the annotated class prefLabels.
                      start = Time.now
                  Severity: Major
                  Found in app/controllers/annotator_controller.rb and 1 other location - About 2 hrs to fix
                  app/controllers/annotatorplus_controller.rb on lines 120..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 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

                  Severity
                  Category
                  Status
                  Source
                  Language