ncbo/bioportal_web_ui

View on GitHub

Showing 628 of 628 total issues

Function appendTextArea has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function appendTextArea(id, placeholder, div, isRequired, invalidMessage) {
Severity: Minor
Found in app/assets/javascripts/bp_ontolobridge.js - About 35 mins to fix

    Function appendField has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function appendField(id, text, div, isRequired, invalidMessage) {
    Severity: Minor
    Found in app/assets/javascripts/bp_ontolobridge.js - About 35 mins to fix

      Function AjaxAction has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      var AjaxAction = function(httpMethod, operation, path, isLongOperation, params) {
      Severity: Minor
      Found in app/assets/javascripts/bp_admin.js - About 35 mins to fix

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

          if (params.experiencer) {
            annotationsTable.fnSetColumnVis(BP_COLUMNS.experiencer, true);
          } else {
            annotationsTable.fnSetColumnVis(BP_COLUMNS.experiencer, false);
          }
        Severity: Major
        Found in app/assets/javascripts/bp_annotatorplus.js and 3 other locations - About 35 mins to fix
        app/assets/javascripts/bp_annotatorplus.js on lines 82..86
        app/assets/javascripts/bp_annotatorplus.js on lines 87..91
        app/assets/javascripts/bp_annotatorplus.js on lines 97..101

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

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

          if (params.score) {
            annotationsTable.fnSetColumnVis(BP_COLUMNS.score, true);
          } else {
            annotationsTable.fnSetColumnVis(BP_COLUMNS.score, false);
          }
        Severity: Major
        Found in app/assets/javascripts/bp_annotatorplus.js and 3 other locations - About 35 mins to fix
        app/assets/javascripts/bp_annotatorplus.js on lines 87..91
        app/assets/javascripts/bp_annotatorplus.js on lines 92..96
        app/assets/javascripts/bp_annotatorplus.js on lines 97..101

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

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

          if (params.temporality) {
            annotationsTable.fnSetColumnVis(BP_COLUMNS.temporality, true);
          } else {
            annotationsTable.fnSetColumnVis(BP_COLUMNS.temporality, false);
          }
        Severity: Major
        Found in app/assets/javascripts/bp_annotatorplus.js and 3 other locations - About 35 mins to fix
        app/assets/javascripts/bp_annotatorplus.js on lines 82..86
        app/assets/javascripts/bp_annotatorplus.js on lines 87..91
        app/assets/javascripts/bp_annotatorplus.js on lines 92..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 47.

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

          if (params.negation) {
            annotationsTable.fnSetColumnVis(BP_COLUMNS.negation, true);
          } else {
            annotationsTable.fnSetColumnVis(BP_COLUMNS.negation, false);
          }
        Severity: Major
        Found in app/assets/javascripts/bp_annotatorplus.js and 3 other locations - About 35 mins to fix
        app/assets/javascripts/bp_annotatorplus.js on lines 82..86
        app/assets/javascripts/bp_annotatorplus.js on lines 92..96
        app/assets/javascripts/bp_annotatorplus.js on lines 97..101

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

        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 get_annotations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function get_annotations() {
          jQuery("#results_error").html("");
          jQuery("#annotator_error").html("");
        
          // Validation
        Severity: Minor
        Found in app/assets/javascripts/bp_annotator.js - About 35 mins 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 check_params_ontologies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def check_params_ontologies(params)
            params[:ontologies] ||= params[:id]
            if params[:ontologies]
              if params[:ontologies].include?(",")
                params[:ontologies] = params[:ontologies].split(",")
        Severity: Minor
        Found in app/controllers/search_controller.rb - About 35 mins 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 check_delete_mapping_permission has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def check_delete_mapping_permission(mappings)
            # ensure mappings is an Array of mappings (some calls may provide only a single mapping instance)
            mappings = [mappings] if mappings.instance_of? LinkedData::Client::Models::Mapping
            return false if mappings.all? {|m| m.id.to_s.empty?}
            delete_mapping_permission = false
        Severity: Minor
        Found in app/controllers/application_controller.rb - About 35 mins 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 _process_errors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def _process_errors(errors, response, remove_trailing_comma = true)
            if errors.is_a?(Hash)
              errors.each do |_, v|
                if v.is_a?(Array)
                  response[:errors] += v.join(', ')
        Severity: Minor
        Found in app/controllers/admin_controller.rb - About 35 mins 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            # Make the contacts an array
            params[:submission][:contact] = params[:submission][:contact].values
            params[:submission][:naturalLanguage].compact_blank!
        
        
        Severity: Minor
        Found in app/controllers/submissions_controller.rb - About 35 mins 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 ajax_process_cls has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        var ajax_process_cls = function() {
          // Check on whether to stop the ajax process
          if( ajax_cls_array.length === 0 ){
            ajax_process_cls_halt();
            return true;
        Severity: Minor
        Found in app/assets/javascripts/bp_ajax_controller.js - About 35 mins 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 simplify_class_model has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def simplify_class_model(cls_model)
            # Simplify the class required required by the UI.
            # No modification of the class ontology here, see simplify_classes.
            # Default simple class model
            cls = { :id => nil, :ontology => nil, :prefLabel => nil, :uri => nil, :ui => nil, :obsolete => false }
        Severity: Minor
        Found in app/controllers/application_controller.rb - About 35 mins 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 submission_status2string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def submission_status2string(sub)
            # Massage the submission status into a UI string
            # submission status values, from:
            # https://github.com/ncbo/ontologies_linked_data/blob/master/lib/ontologies_linked_data/models/submission_status.rb
            # "UPLOADED", "RDF", "RDF_LABELS", "INDEXED", "METRICS", "ANNOTATOR", "ARCHIVED"  and 'ERROR_*' for each.
        Severity: Minor
        Found in app/helpers/ontologies_helper.rb - About 35 mins 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 subscribe_ontology_button has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def subscribe_ontology_button(ontology_id, user = nil)
            user = session[:user] if user.nil?
            if user.nil?
              # subscribe button must redirect to login
              return sanitize("<a href='/login?redirect=#{request.url}' style='font-size: .9em;' class='subscribe_to_ontology'>Subscribe</a>")
        Severity: Minor
        Found in app/helpers/application_helper.rb - About 35 mins 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 classes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def classes
            get_class(params)
        
            if ["application/ld+json", "application/json"].include?(request.accept)
              render plain: @concept.to_jsonld, content_type: request.accept and return
        Severity: Minor
        Found in app/controllers/ontologies_controller.rb - About 35 mins 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            if params[:type].eql?('reply')
              note = LinkedData::Client::Models::Reply.new(values: note_params)
            elsif params[:type].eql?('ontology')
              params[:relatedOntology] = [params.delete(:parent)]
        Severity: Minor
        Found in app/controllers/notes_controller.rb - About 35 mins 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

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

        lunr.SortedSet.prototype.map = function (fn, ctx) {
          return this.elements.map(fn, ctx)
        }
        Severity: Major
        Found in public/browse/lib/lunr.js/lunr.js and 5 other locations - About 35 mins to fix
        public/browse/lib/lunr.js/lib/index.js on lines 50..52
        public/browse/lib/lunr.js/lib/sorted_set.js on lines 72..74
        public/browse/lib/lunr.js/lib/sorted_set.js on lines 87..89
        public/browse/lib/lunr.js/lunr.js on lines 629..631
        public/browse/lib/lunr.js/lunr.js on lines 830..832

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

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

        lunr.Index.prototype.off = function (name, fn) {
          return this.eventEmitter.removeListener(name, fn)
        }
        Severity: Major
        Found in public/browse/lib/lunr.js/lib/index.js and 5 other locations - About 35 mins to fix
        public/browse/lib/lunr.js/lib/sorted_set.js on lines 72..74
        public/browse/lib/lunr.js/lib/sorted_set.js on lines 87..89
        public/browse/lib/lunr.js/lunr.js on lines 614..616
        public/browse/lib/lunr.js/lunr.js on lines 629..631
        public/browse/lib/lunr.js/lunr.js on lines 830..832

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

        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