ncbo/bioportal_web_ui

View on GitHub

Showing 628 of 628 total issues

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

lunr.TokenStore.load = function (serialisedData) {
  var store = new this

  store.root = serialisedData.root
  store.length = serialisedData.length
Severity: Major
Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 1 hr to fix
public/browse/lib/lunr.js/lib/token_store.js on lines 25..32

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

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

Function buildResults has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      function buildResults(resultObjects, filterTxt) {
        filterTxt = '(' + filterTxt + ')';

        var bOddRow = true, i, iFound = 0,
          filterPatt = settings.caseSensitive ? new RegExp(filterTxt, 'g') : new RegExp(filterTxt, 'ig');
Severity: Minor
Found in public/widgets/jquery.ncbo.autocomplete.js - About 1 hr to fix

    Function SearchAnalytics has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function SearchAnalytics() {
      this.bindTracker = function() {
        jQuery(document).on("click", "#search_results_container div.class_link a", function(e) {
          e.preventDefault();
    
    
    Severity: Minor
    Found in app/assets/javascripts/bp_analytics.js - About 1 hr 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 bp_internal_formComplete_formatItem has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function bp_internal_formComplete_formatItem(row) {
      var input = this.extraParams.input;
      var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
      var keywords = jQuery(input).val().replace(specials, "\\$&").split(' ').join('|');
      var regex = new RegExp( '(' + keywords + ')', 'gi' );
    Severity: Minor
    Found in app/assets/javascripts/bp_form_complete.js - About 1 hr to fix

      Function SearchAnalytics has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function SearchAnalytics() {
        this.bindTracker = function() {
          jQuery(document).on("click", "#search_results_container div.class_link a", function(e) {
            e.preventDefault();
      
      
      Severity: Minor
      Found in app/assets/javascripts/bp_analytics.js - About 1 hr to fix

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

        lunr.Pipeline.prototype.toJSON = function () {
          return this._stack.map(function (fn) {
            lunr.Pipeline.warnIfFunctionNotRegistered(fn)
        
            return fn.label
        Severity: Major
        Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 1 hr to fix
        public/browse/lib/lunr.js/lib/pipeline.js on lines 211..217

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

        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.Store.prototype.remove = function (id) {
          if (!this.has(id)) return
        
          delete this.store[id]
          this.length--
        Severity: Major
        Found in public/browse/lib/lunr.js/lib/document_store.js and 1 other location - About 1 hr to fix
        public/browse/lib/lunr.js/lunr.js on lines 1278..1283

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

        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.Store.prototype.remove = function (id) {
          if (!this.has(id)) return
        
          delete this.store[id]
          this.length--
        Severity: Major
        Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 1 hr to fix
        public/browse/lib/lunr.js/lib/document_store.js on lines 77..82

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

        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.Pipeline.prototype.toJSON = function () {
          return this._stack.map(function (fn) {
            lunr.Pipeline.warnIfFunctionNotRegistered(fn)
        
            return fn.label
        Severity: Major
        Found in public/browse/lib/lunr.js/lib/pipeline.js and 1 other location - About 1 hr to fix
        public/browse/lib/lunr.js/lunr.js on lines 411..417

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

        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

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

                function run(fns, cancellations, allCompleteFn) {
                  var animations = [];
                  forEach(fns, function(animation) {
                    animation.fn && animations.push(animation);
                  });
        Severity: Minor
        Found in public/browse/lib/angular-animate/angular-animate.js - About 1 hr to fix

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

              var 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-2.0.1.js - About 1 hr to fix

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

                var 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-2.0.2.js - About 1 hr 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 setAjaxNodes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var 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-2.0.0.js - About 1 hr to fix

                  Method get_annotated_classes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def get_annotated_classes(annotations, semantic_types=[])
                      # Use batch service to get class prefLabels
                      class_list = []
                      annotations.each {|a| class_list << get_annotated_class_hash(a) }
                      hierarchy = annotations.map {|a| a if a.keys.include? 'hierarchy' }.compact
                  Severity: Minor
                  Found in app/controllers/annotator_controller.rb - About 1 hr to fix

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

                    var ajax_process_ont = function() {
                      if( ajax_ont_array.length === 0 ){
                        ajax_process_ont_halt();
                        return true;
                      }
                    Severity: Minor
                    Found in app/assets/javascripts/bp_ajax_controller.js - About 1 hr to fix

                      Method get_annotated_classes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def get_annotated_classes(annotations, semantic_types=[])
                          # Use batch service to get class prefLabels
                          class_list = []
                          annotations.each {|a| class_list << get_annotated_class_hash(a) }
                          hierarchy = annotations.map {|a| a if a.keys.include? 'hierarchy' }.compact
                      Severity: Minor
                      Found in app/controllers/annotatorplus_controller.rb - About 1 hr to fix

                        Function compile has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                        compile: function (tElement, tAttrs, transclude)
                                        {
                                            return function (scope, elm, attrs, controllers)
                                            {
                                                var bindonceController = controllers[0];
                        Severity: Minor
                        Found in public/browse/lib/angular-bindonce/bindonce.js - About 1 hr to fix

                          Function $get has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            this.$get = function() {
                              var $log = {
                                log: function() { $log.log.logs.push(concat([], arguments, 0)); },
                                warn: function() { $log.warn.logs.push(concat([], arguments, 0)); },
                                info: function() { $log.info.logs.push(concat([], arguments, 0)); },
                          Severity: Minor
                          Found in public/browse/lib/angular-mocks/angular-mocks.js - About 1 hr to fix

                            Function get_annotation_rows_from_raw has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function get_annotation_rows_from_raw(annotation, params) {
                              "use strict";
                              // data independent var declarations
                              var
                                rows = [],
                            Severity: Minor
                            Found in app/assets/javascripts/bp_annotator.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language