ncbo/bioportal_web_ui

View on GitHub

Showing 306 of 628 total issues

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

    link: function(scope, $element, attr, ctrl, $transclude) {
Severity: Minor
Found in public/browse/lib/angular-route/angular-route.js - About 35 mins to fix

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

            beforeSetClass: function(element, add, remove, animationCompleted, options) {
    Severity: Minor
    Found in public/browse/lib/angular-animate/angular-animate.js - About 35 mins to fix

      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

            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

            Avoid too many return statements within this function.
            Open

                return true;
            Severity: Major
            Found in public/browse/lib/angular-mocks/angular-mocks.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return false;
              Severity: Major
              Found in public/widgets/jquery.ncbo.autocomplete.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return data == d;
                Severity: Major
                Found in public/browse/lib/angular-mocks/angular-mocks.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    if (pivotElem === elem) return pivot
                  Severity: Major
                  Found in public/browse/lib/lunr.js/lib/sorted_set.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language