ncbo/bioportal_web_ui

View on GitHub

Showing 628 of 628 total issues

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

  if (jQuery('link[href$="' + BP_INTERNAL_SEARCH_SERVER + '/javascripts/JqueryPlugins/autocomplete/jquery.autocomplete.css"]')) {
    jQuery("head").append("<link>");
    css = jQuery("head").children(":last");
    css.attr({
      rel:  "stylesheet",
Severity: Major
Found in app/assets/javascripts/bp_form_complete.js and 1 other location - About 2 hrs to fix
public/javascripts/widgets/form_complete.js on lines 88..96

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

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 (jQuery('link[href$="' + BP_SEARCH_SERVER + '/javascripts/JqueryPlugins/autocomplete/jquery.autocomplete.css"]')) {
      jQuery("head").append("<link>");
      css = jQuery("head").children(":last");
      css.attr({
        rel:  "stylesheet",
Severity: Major
Found in public/javascripts/widgets/form_complete.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/bp_form_complete.js on lines 30..38

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

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

  $scope.categories = jQuery(document).data().bp.categories.sort(function(a, b){
    if (a.name < b.name) return -1;
    if (a.name > b.name) return 1;
    return 0;
  });
Severity: Major
Found in public/browse/app.js and 1 other location - About 2 hrs to fix
public/browse/app.js on lines 33..37

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

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

  $scope.groups = jQuery(document).data().bp.groups.sort(function(a, b){
    if (a.acronym < b.acronym) return -1;
    if (a.acronym > b.acronym) return 1;
    return 0;
  });
Severity: Major
Found in public/browse/app.js and 1 other location - About 2 hrs to fix
public/browse/app.js on lines 27..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 88.

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

function bp_internal_formComplete_setup_functions() {
  jQuery("input[class*='bp_internal_form_complete']").each(function(){
    var classes = this.className.split(" ");
    var values;
    var ontology_id;
Severity: Major
Found in app/assets/javascripts/bp_form_complete.js - About 2 hrs to fix

    Method json_search has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def json_search
        if params[:q].nil?
          render :text => "No search class provided"
          return
        end
    Severity: Minor
    Found in app/controllers/search_controller.rb - 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 $get has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

           function($browser,   $rootScope,   $q,   $$q) {
        var repeatFns = [],
            nextRepeatId = 0,
            now = 0;
    
    
    Severity: Major
    Found in public/browse/lib/angular-mocks/angular-mocks.js - About 2 hrs to fix

      Function setupModuleLoader has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function setupModuleLoader(window) {
      
        var $injectorMinErr = minErr('$injector');
        var ngMinErr = minErr('ng');
      
      
      Severity: Major
      Found in public/browse/lib/angular-loader/angular-loader.js - About 2 hrs to fix

        File text.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
         * Available via the MIT or new BSD license.
         * see: http://github.com/requirejs/text for details
         */
        Severity: Minor
        Found in public/browse/lib/lunr.js/example/text.js - About 2 hrs to fix

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

              this.selectClass = function(cls) {
                var foundClass = $(TREE.find("a[data-id='" + encodeURIComponent(cls) + "']"));
                $(TREE.find("a.active")[0]).removeClass("active");
                foundClass.addClass("active");
              }
          Severity: Major
          Found in public/widgets/jquery.ncbo.tree-2.0.2.js and 2 other locations - About 2 hrs to fix
          public/widgets/jquery.ncbo.tree-2.0.0.js on lines 102..106
          public/widgets/jquery.ncbo.tree-2.0.1.js on lines 102..106

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

          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

              this.selectClass = function(cls) {
                var foundClass = $(TREE.find("a[data-id='" + encodeURIComponent(cls) + "']"));
                $(TREE.find("a.active")[0]).removeClass("active");
                foundClass.addClass("active");
              }
          Severity: Major
          Found in public/widgets/jquery.ncbo.tree-2.0.0.js and 2 other locations - About 2 hrs to fix
          public/widgets/jquery.ncbo.tree-2.0.1.js on lines 102..106
          public/widgets/jquery.ncbo.tree-2.0.2.js on lines 102..106

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

          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

              this.selectClass = function(cls) {
                var foundClass = $(TREE.find("a[data-id='" + encodeURIComponent(cls) + "']"));
                $(TREE.find("a.active")[0]).removeClass("active");
                foundClass.addClass("active");
              }
          Severity: Major
          Found in public/widgets/jquery.ncbo.tree-2.0.1.js and 2 other locations - About 2 hrs to fix
          public/widgets/jquery.ncbo.tree-2.0.0.js on lines 102..106
          public/widgets/jquery.ncbo.tree-2.0.2.js on lines 102..106

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

          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 jquery.ncbo.autocomplete.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*jshint curly: true, eqeqeq: true, undef: true, devel: true, browser: true */
          /*global jQuery */
          
          /**
           * Turn a text box into an auto suggest box which search's and
          Severity: Minor
          Found in public/widgets/jquery.ncbo.autocomplete.js - About 2 hrs to fix

            Function commitRoute has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function commitRoute() {
                  var lastRoute = $route.current;
                  var nextRoute = preparedRoute;
            
                  if (preparedRouteIsUpdateOnly) {
            Severity: Major
            Found in public/browse/lib/angular-route/angular-route.js - About 2 hrs to fix

              Method create has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create
                  params[:mappings] ||= []
                  params[:max_level] ||= 0
                  params[:ontologies] ||= []
                  params[:semantic_types] ||= []
              Severity: Major
              Found in app/controllers/annotatorplus_controller.rb - About 2 hrs to fix

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

                    if (row[0].indexOf("[obsolete]") != -1) {
                        row[0] = row[0].replace("[obsolete]", "");
                        obsolete_prefix = "<span class='obsolete_class' title='obsolete class'>";
                        obsolete_suffix = "</span>";
                    } else {
                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 174..181

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

                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.after = function (existingFn, newFn) {
                  lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
                
                  var pos = this._stack.indexOf(existingFn) + 1
                  this._stack.splice(pos, 0, newFn)
                Severity: Major
                Found in public/browse/lib/lunr.js/lib/pipeline.js and 1 other location - About 2 hrs to fix
                public/browse/lib/lunr.js/lunr.js on lines 332..337

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

                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 (row[0].indexOf("[obsolete]") != -1) {
                        row[0] = row[0].replace("[obsolete]", "");
                        obsolete_prefix = "<span class='obsolete_class' title='obsolete class'>";
                        obsolete_suffix = "</span>";
                    } else {
                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 181..188

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

                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.after = function (existingFn, newFn) {
                  lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
                
                  var pos = this._stack.indexOf(existingFn) + 1
                  this._stack.splice(pos, 0, newFn)
                Severity: Major
                Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 2 hrs to fix
                public/browse/lib/lunr.js/lib/pipeline.js on lines 132..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 85.

                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.Index.prototype.field = function (fieldName, opts) {
                  var opts = opts || {},
                      field = { name: fieldName, boost: opts.boost || 1 }
                
                  this._fields.push(field)
                Severity: Major
                Found in public/browse/lib/lunr.js/lunr.js and 1 other location - About 2 hrs to fix
                public/browse/lib/lunr.js/lib/index.js on lines 100..106

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

                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