ncbo/bioportal_web_ui

View on GitHub

Showing 628 of 628 total issues

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

lunr.Index.prototype.search = function (query) {
  var queryTokens = this.pipeline.run(lunr.tokenizer(query)),
      queryVector = new lunr.Vector,
      documentSets = [],
      fieldBoosts = this._fields.reduce(function (memo, f) { return memo + f.boost }, 0)
Severity: Minor
Found in public/browse/lib/lunr.js/lib/index.js - About 1 hr to fix

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

    lunr.Index.prototype.search = function (query) {
      var queryTokens = this.pipeline.run(lunr.tokenizer(query)),
          queryVector = new lunr.Vector,
          documentSets = [],
          fieldBoosts = this._fields.reduce(function (memo, f) { return memo + f.boost }, 0)
    Severity: Minor
    Found in public/browse/lib/lunr.js/lunr.js - About 1 hr to fix

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

      function bindRequestTermSaveClick() {
        var success = "";
        var error = "";
        var user = jQuery(document).data().bp.user;
        var ontology_id = jQuery(document).data().bp.ont_viewer.ontology_id;
      Severity: Minor
      Found in app/assets/javascripts/bp_ontolobridge.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_annotatorplus.js - About 1 hr to fix

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

          lunr.Pipeline.prototype.remove = function (fn) {
            var pos = this._stack.indexOf(fn)
            this._stack.splice(pos, 1)
          }
          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 362..365

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

          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.SortedSet.load = function (serialisedData) {
            var set = new this
          
            set.elements = serialisedData
            set.length = serialisedData.length
          Severity: Major
          Found in public/browse/lib/lunr.js/lib/sorted_set.js and 1 other location - About 1 hr to fix
          public/browse/lib/lunr.js/lunr.js on lines 566..573

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

          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.SortedSet.load = function (serialisedData) {
            var set = new this
          
            set.elements = serialisedData
            set.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/sorted_set.js on lines 24..31

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

          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.remove = function (fn) {
            var pos = this._stack.indexOf(fn)
            this._stack.splice(pos, 1)
          }
          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 162..165

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

          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 filterOntologies has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var filterOntologies = function() {
              var key, i, ontology, facet, facet_count, show, other_facets, count = 0;
              $scope.show_highlight = false;
              $scope.show_highlight = true;
          
          
          Severity: Minor
          Found in public/browse/app.js - About 1 hr to fix

            Function inject has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              window.inject = angular.mock.inject = function() {
                var blockFns = Array.prototype.slice.call(arguments, 0);
                var errorForStack = new Error('Declaration Location');
                return isSpecRunning() ? workFn.call(currentSpec) : workFn;
                /////////////////////
            Severity: Minor
            Found in public/browse/lib/angular-mocks/angular-mocks.js - About 1 hr to fix

              Function displayOntologies has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              function displayOntologies(data, ontology) {
                var ontTable = null;
              
                if (jQuery.fn.dataTable.isDataTable('#adminOntologies')) {
                  ontTable = jQuery('#adminOntologies').DataTable();
              Severity: Minor
              Found in app/assets/javascripts/bp_admin.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

              Method download_link has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def download_link(submission, ontology = nil)
                  ontology ||= @ontology
                  if submission.ontology.summaryOnly
                    link = 'N/A - metadata only'
                  else
              Severity: Minor
              Found in app/helpers/ontologies_helper.rb - 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 $interval has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var $interval = function(fn, delay, count, invokeApply) {
                    var iteration = 0,
                        skipApply = (angular.isDefined(invokeApply) && !invokeApply),
                        deferred = (skipApply ? $$q : $q).defer(),
                        promise = deferred.promise;
              Severity: Minor
              Found in public/browse/lib/angular-mocks/angular-mocks.js - About 1 hr to fix

                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

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

                lunr.utils.warn = (function (global) {
                  return function (message) {
                    if (global.console && console.warn) {
                      console.warn(message)
                    }
                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/utils.js on lines 17..23

                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

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

                lunr.utils.warn = (function (global) {
                  return function (message) {
                    if (global.console && console.warn) {
                      console.warn(message)
                    }
                Severity: Major
                Found in public/browse/lib/lunr.js/lib/utils.js and 1 other location - About 1 hr to fix
                public/browse/lib/lunr.js/lunr.js on lines 76..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 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

                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

                Function MockXhr has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function MockXhr() {
                
                  // hack for testing $http, $httpBackend
                  MockXhr.$$lastInstance = this;
                
                
                Severity: Minor
                Found in public/browse/lib/angular-mocks/angular-mocks.js - About 1 hr to fix

                  Function getElementAnimationDetails has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        function getElementAnimationDetails(element, cacheKey) {
                          var data = cacheKey ? lookupCache[cacheKey] : null;
                          if (!data) {
                            var transitionDuration = 0;
                            var transitionDelay = 0;
                  Severity: Minor
                  Found in public/browse/lib/angular-animate/angular-animate.js - About 1 hr to fix

                    Function get_annotation_rows has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function get_annotation_rows(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