ncbo/bioportal_web_ui

View on GitHub

Showing 628 of 628 total issues

Function get_annotations has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  // Validation
Severity: Major
Found in app/assets/javascripts/bp_annotatorplus.js - About 3 hrs to fix

    Function displayUsers has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function displayUsers(data) {
        let ontTable = null;
        let allRows
        if (jQuery.fn.dataTable.isDataTable('#adminUsers')) {
            ontTable = jQuery('#adminUsers').DataTable();
    Severity: Major
    Found in app/assets/javascripts/bp_admin.js - About 3 hrs to fix

      File ontologies_controller.rb has 318 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class OntologiesController < ApplicationController
        include MappingsHelper
        include MappingStatistics
      
        require "multi_json"
      Severity: Minor
      Found in app/controllers/ontologies_controller.rb - About 3 hrs to fix

        File app.js has 317 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        // Declare app level module which depends on views, and components
        angular.module('FacetedBrowsing', [
          'ngRoute',
        Severity: Minor
        Found in public/browse/app.js - About 3 hrs to fix

          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 public/widgets/jquery.ncbo.tree-2.0.1.js and 3 other locations - About 3 hrs to fix
          app/assets/javascripts/bp_property_tree.js on lines 120..131
          public/widgets/jquery.ncbo.tree-2.0.0.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 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 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 public/widgets/jquery.ncbo.tree-2.0.2.js and 3 other locations - About 3 hrs to fix
          app/assets/javascripts/bp_property_tree.js on lines 120..131
          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

          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 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 public/widgets/jquery.ncbo.tree-2.0.0.js and 3 other locations - About 3 hrs to fix
          app/assets/javascripts/bp_property_tree.js on lines 120..131
          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

          File angular-route.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * @license AngularJS v1.3.5
           * (c) 2010-2014 Google, Inc. http://angularjs.org
           * License: MIT
           */
          Severity: Minor
          Found in public/browse/lib/angular-route/angular-route.js - About 3 hrs to fix

            File bp_recommender.js has 313 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Namespace for global variables and functions
            var rec = { }
            rec.maxInputWords = 500;
            
            rec.showOrHideAdvancedOptions = function() {
            Severity: Minor
            Found in app/assets/javascripts/bp_recommender.js - About 3 hrs to fix

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

              lunr.EventEmitter.prototype.emit = function (name) {
                if (!this.hasHandler(name)) return
              
                var args = Array.prototype.slice.call(arguments, 1)
              
              
              Severity: Major
              Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 3 hrs to fix
              public/browse/lib/lunr.js/lib/event_emitter.js on lines 62..70

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

              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

              lunr.EventEmitter.prototype.emit = function (name) {
                if (!this.hasHandler(name)) return
              
                var args = Array.prototype.slice.call(arguments, 1)
              
              
              Severity: Major
              Found in public/browse/lib/lunr.js/lib/event_emitter.js and 1 other location - About 3 hrs to fix
              public/browse/lib/lunr.js/lunr.js on lines 145..153

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

              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

              File form_complete.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              // jQuery check, if it's not present then include it
              function bpMinVersion(min, actual) {
                function parseVersionString (str) {
                  if (typeof(str) != 'string') { return false; }
                  var x = str.split('.');
              Severity: Minor
              Found in public/javascripts/widgets/form_complete.js - About 3 hrs to fix

                File bp_ontolobridge.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                function bindAddRequestTermClick() {
                  jQuery("a.add_request_term").live('click', function(){
                    var id = jQuery(this).attr("data-parent-id");
                    addRequestTermBox(id);
                  });
                Severity: Minor
                Found in app/assets/javascripts/bp_ontolobridge.js - About 3 hrs to fix

                  Method show has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def show
                      # Hack to make ontologyid and conceptid work in addition to id and ontology params
                      params[:id] = params[:id].nil? ? params[:ontologyid] : params[:id]
                      params[:ontology] = params[:ontology].nil? ? params[:id] : params[:ontology]
                  
                  
                  Severity: Minor
                  Found in app/controllers/ontologies_controller.rb - 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 onSuccessAction has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                  AjaxAction.prototype.onSuccessAction = function(data, ontology, deferredObj) {
                    var self = this;
                    if (!self.isLongOperation) {
                      return;
                    }
                  Severity: Minor
                  Found in app/assets/javascripts/bp_admin.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 parseTemplate has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function parseTemplate(template, tags) {
                      tags = tags || mustache.tags;
                      template = template || '';
                  
                      if (typeof tags === 'string') {
                  Severity: Major
                  Found in public/browse/lib/lunr.js/example/mustache.js - About 3 hrs to fix

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

                        var 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-2.0.2.js and 2 other locations - About 3 hrs to fix
                    public/widgets/jquery.ncbo.tree-2.0.0.js on lines 184..191
                    public/widgets/jquery.ncbo.tree-2.0.1.js on lines 184..191

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

                    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

                        var 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-2.0.1.js and 2 other locations - About 3 hrs to fix
                    public/widgets/jquery.ncbo.tree-2.0.0.js on lines 184..191
                    public/widgets/jquery.ncbo.tree-2.0.2.js on lines 184..191

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

                    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

                        var 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-2.0.0.js and 2 other locations - About 3 hrs to fix
                    public/widgets/jquery.ncbo.tree-2.0.1.js on lines 184..191
                    public/widgets/jquery.ncbo.tree-2.0.2.js on lines 184..191

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

                    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