ncbo/bioportal_web_ui

View on GitHub

Showing 306 of 628 total issues

Avoid too many return statements within this function.
Open

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

    Avoid too many return statements within this method.
    Open

            return
    Severity: Major
    Found in app/controllers/ontologies_controller.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return
      Severity: Major
      Found in app/controllers/ontologies_controller.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return
        Severity: Major
        Found in app/controllers/ontologies_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return
          Severity: Major
          Found in app/controllers/ontologies_controller.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return
            Severity: Major
            Found in app/controllers/ontologies_controller.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return
              Severity: Major
              Found in app/controllers/ontologies_controller.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return
                Severity: Major
                Found in app/controllers/ontologies_controller.rb - About 30 mins to fix

                  Function tokenizer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  lunr.tokenizer = function (obj) {
                    if (!arguments.length || obj == null || obj == undefined) return []
                    if (Array.isArray(obj)) return obj.map(function (t) { return t.toLowerCase() })
                  
                    var str = obj.toString().replace(/^\s+/, '')
                  Severity: Minor
                  Found in public/browse/lib/lunr.js/lib/tokenizer.js - About 25 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 dot has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  lunr.Vector.prototype.dot = function (otherVector) {
                    var node = this.list,
                        otherNode = otherVector.list,
                        dotProduct = 0
                  
                  
                  Severity: Minor
                  Found in public/browse/lib/lunr.js/lib/vector.js - About 25 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_ont has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var ajax_process_ont = function() {
                    if( ajax_ont_array.length === 0 ){
                      ajax_process_ont_halt();
                      return true;
                    }
                  Severity: Minor
                  Found in app/assets/javascripts/bp_ajax_controller.js - About 25 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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  lunr.Index.prototype.add = function (doc, emitEvent) {
                    var docTokens = {},
                        allDocumentTokens = new lunr.SortedSet,
                        docRef = doc[this._ref],
                        emitEvent = emitEvent === undefined ? true : emitEvent
                  Severity: Minor
                  Found in public/browse/lib/lunr.js/lib/index.js - About 25 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 clean_empty_strings_from_params_arrays has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def clean_empty_strings_from_params_arrays(params = nil)
                      params ||= params()
                      params.keys.each do |k|
                        clean_empty_strings_from_params_arrays(params[k]) if params[k].is_a?(Hash)
                        params[k] = params[k].select {|e| !e.eql?("")} if params[k].is_a?(Array)
                  Severity: Minor
                  Found in app/controllers/application_controller.rb - About 25 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_button has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def subscribe_button(ontology_id)
                      user = session[:user]
                  
                      if user.nil?
                        return link_to('Subscribe to notes emails', login_index_path, class: 'link_button')
                  Severity: Minor
                  Found in app/helpers/notes_helper.rb - About 25 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 populate_csv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def populate_csv(clicks)
                      rows = []
                      rows << %w[
                        query position_clicked ontology_clicked higher_rated_ontologies additional_result exact_match
                        concept_id time user bp_slice ip_address
                  Severity: Minor
                  Found in app/controllers/analytics_controller.rb - About 25 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 track has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def track
                      params = analytic_params
                      Analytics.create do |a|
                        a.segment = params[:segment]
                        a.action = params[:analytics_action]
                  Severity: Minor
                  Found in app/controllers/analytics_controller.rb - About 25 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 params_string_for_redirect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def params_string_for_redirect(params, options = {})
                      prefix = options[:prefix] || "?"
                      stop_words = options[:stop_words] || ["ontology", "controller", "action", "id", "acronym"]
                      params_array = []
                      params.each do |key,value|
                  Severity: Minor
                  Found in app/controllers/application_controller.rb - About 25 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 truncate_with_more has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def truncate_with_more(text, options = {})
                      length ||= options[:length] ||= 30
                      trailing_text ||= options[:trailing_text] ||= " ... "
                      link_more ||= options[:link_more] ||= "[more]"
                      link_less ||= options[:link_less] ||= "[less]"
                  Severity: Minor
                  Found in app/helpers/application_helper.rb - About 25 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 parse_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def parse_json(uri)
                      begin
                        response = Net::HTTP.get(URI(uri), { 'Authorization' => "apikey token=#{get_apikey}" })
                      rescue StandardError => e
                        @retries ||= 0
                  Severity: Minor
                  Found in app/controllers/application_controller.rb - About 25 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 Analytics has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function Analytics() {
                    this.track = function(segment, analytics_action, params, callback) {
                      params["segment"] = segment;
                      params["analytics_action"] = analytics_action;
                      jQuery.ajax({
                  Severity: Minor
                  Found in app/assets/javascripts/bp_analytics.js - About 25 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

                  Severity
                  Category
                  Status
                  Source
                  Language