ncbo/bioportal_web_ui

View on GitHub

Showing 628 of 628 total issues

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

angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {

  var $rootScopePrototype = Object.getPrototypeOf($delegate);

  $rootScopePrototype.$countChildScopes = countChildScopes;
Severity: Minor
Found in public/browse/lib/angular-mocks/angular-mocks.js - About 1 hr to fix

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

    function MockHttpExpectation(method, url, data, headers) {
    
      this.data = data;
      this.headers = headers;
    
    
    Severity: Minor
    Found in public/browse/lib/angular-mocks/angular-mocks.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_annotatorplus.js - About 1 hr to fix

        Method build_tree has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def build_tree(node, string, id)
            if node.children.nil? || node.children.length < 1
              return string # unchanged
            end
            node.children.sort! {|a,b| (a.prefLabel || a.id).downcase <=> (b.prefLabel || b.id).downcase}
        Severity: Minor
        Found in app/helpers/application_helper.rb - About 1 hr to fix

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

          rec.getHighlightedTerms = function(data, rowNumber) {
              var inputText = document.getElementById("inputText").value;
              var newText = '';
              var lastPosition = 0;
              var ontologyIds = [ ];
          Severity: Minor
          Found in app/assets/javascripts/bp_recommender.js - About 1 hr to fix

            Function indexOf has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            lunr.SortedSet.prototype.indexOf = function (elem, start, end) {
              var start = start || 0,
                  end = end || this.elements.length,
                  sectionLength = end - start,
                  pivot = start + Math.floor(sectionLength / 2),
            Severity: Minor
            Found in public/browse/lib/lunr.js/lib/sorted_set.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 visits_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              def visits_data(ontology = nil)
                ontology ||= @ontology
            
                return nil unless @analytics && @analytics[ontology.acronym.to_sym]
            
            
            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

            Method update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                @user = LinkedData::Client::Models::User.find(params[:id])
                @user = LinkedData::Client::Models::User.find_by_username(params[:id]).first if @user.nil?
            
                @errors = validate_update(user_params)
            Severity: Minor
            Found in app/controllers/users_controller.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 addRequestTermBox has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            function addRequestTermBox(id) {
              clearStatusMessages();
              var formContainer = jQuery(".request_term_form_div");
              var requestTermForm = requestTermFields(id, formContainer);
              var formID = requestTermForm.attr('id');
            Severity: Minor
            Found in app/assets/javascripts/bp_ontolobridge.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

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

            lunr.Vector.Node = function (idx, val, next) {
              this.idx = idx
              this.val = val
              this.next = next
            }
            Severity: Major
            Found in public/browse/lib/lunr.js/lib/vector.js and 1 other location - About 1 hr to fix
            public/browse/lib/lunr.js/lunr.js on lines 446..450

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

            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.Vector.Node = function (idx, val, next) {
              this.idx = idx
              this.val = val
              this.next = next
            }
            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/vector.js on lines 29..33

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

            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

              module Renderers
                # Generate GitHub issue content for a node rename change request. The change request is described using the
                # Knowledge Graph Change Language grammar, e.g.:
                #
                #   rename MONDO:0000087 from 'polymicrogyria' to 'polymicrogyria ABCD'
            Severity: Major
            Found in app/lib/kgcl/renderers/node_rename_content.rb and 1 other location - About 1 hr to fix
            app/lib/kgcl/renderers/remove_synonym_content.rb on lines 4..51

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

            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

              module Renderers
                # Generate GitHub issue content for a remove synonym change request
                #
                # The change request is formally described using the Knowledge Graph Change Language grammar, e.g.:
                #
            Severity: Major
            Found in app/lib/kgcl/renderers/remove_synonym_content.rb and 1 other location - About 1 hr to fix
            app/lib/kgcl/renderers/node_rename_content.rb on lines 4..49

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

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

                function workFn() {
                  var modules = currentSpec.$modules || [];
                  var strictDi = !!currentSpec.$injectorStrict;
                  modules.unshift('ngMock');
                  modules.unshift('ng');
            Severity: Minor
            Found in public/browse/lib/angular-mocks/angular-mocks.js - About 1 hr to fix

              Function onSuccessAction has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              UpdateCheck.prototype.onSuccessAction = function(data, ontology, deferredObj) {
                var self = this;
                delete data["success"];
                updateInfo = data["update_info"];
              
              
              Severity: Minor
              Found in app/assets/javascripts/bp_admin.js - About 1 hr to fix

                Method format_metric_list has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def format_metric_list(metrics, metric, title)
                    return 0 if metric.nil?
                
                    markup = ""
                
                
                Severity: Minor
                Found in app/helpers/ontology_metrics_helper.rb - About 1 hr to fix

                  Method feedback has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def feedback
                      # Show the header/footer or not
                      feedback_layout = params[:pop].eql?('true') ? 'popup' : 'ontology'
                  
                      # We're using a hidden form field to trigger for error checking
                  Severity: Minor
                  Found in app/controllers/home_controller.rb - About 1 hr to fix

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

                      def create
                        u = LinkedData::Client::Models::User.find(params[:user_id])
                        ont = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology_id]).first
                    
                        # Is this request to add or remove a subscription?
                    Severity: Minor
                    Found in app/controllers/subscriptions_controller.rb - About 1 hr to fix

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

                          if (document.getElementById(jQuery(this).attr('name') + "_bioportal_concept_id") == null)
                            html += "<input type='hidden' id='" + jQuery(this).attr('name') + "_bioportal_concept_id'>";
                      Severity: Major
                      Found in public/javascripts/widgets/form_complete.js and 7 other locations - About 1 hr to fix
                      app/assets/javascripts/bp_form_complete.js on lines 175..176
                      app/assets/javascripts/bp_form_complete.js on lines 177..178
                      app/assets/javascripts/bp_form_complete.js on lines 179..180
                      app/assets/javascripts/bp_form_complete.js on lines 181..182
                      public/javascripts/widgets/form_complete.js on lines 314..315
                      public/javascripts/widgets/form_complete.js on lines 316..317
                      public/javascripts/widgets/form_complete.js on lines 318..319

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

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

                          if (document.getElementById(jQuery(this).attr('name') + "_bioportal_concept_id") == null)
                            html += "<input type='hidden' id='" + jQuery(this).attr('name') + "_bioportal_concept_id'>";
                      Severity: Major
                      Found in app/assets/javascripts/bp_form_complete.js and 7 other locations - About 1 hr to fix
                      app/assets/javascripts/bp_form_complete.js on lines 177..178
                      app/assets/javascripts/bp_form_complete.js on lines 179..180
                      app/assets/javascripts/bp_form_complete.js on lines 181..182
                      public/javascripts/widgets/form_complete.js on lines 312..313
                      public/javascripts/widgets/form_complete.js on lines 314..315
                      public/javascripts/widgets/form_complete.js on lines 316..317
                      public/javascripts/widgets/form_complete.js on lines 318..319

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

                      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