SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Method access_type_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def access_type_for person
    #FIXME: move the access type out of the favourite group, if possible
    if !person.nil? && contributor_type == 'FavouriteGroup'
      group = person.favourite_group_memberships.find_by_favourite_group_id(contributor.id)
      group.nil? ? self.access_type : group.access_type
Severity: Minor
Found in app/models/permission.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 addSelectedAssay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function addSelectedAssay() {
    selected_option_index=$("possible_assays").selectedIndex;
    selected_option=$("possible_assays").options[selected_option_index];
    title=selected_option.text;
    id=selected_option.value;
Severity: Minor
Found in app/assets/javascripts/assays.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 update_annotation_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  function update_annotation_field(element_id,prefix,annotations) {
      text="";
      for (var key in annotations[prefix]) {
          triplets=annotations[prefix][key];
          for (var i=0;i<triplets.length;i++) {
Severity: Minor
Found in app/assets/javascripts/jws/jws_annotator.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 compare_model_version_selection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def compare_model_version_selection versioned_model, displayed_resource_version
    versions=versioned_model.versions.reverse
    disabled=versions.size==1
    options=""
    versions.each do |v|
Severity: Minor
Found in app/helpers/models_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 exhibit_item_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def exhibit_item_for object, facets_for_object
    exhibit_item = {}
    object_type = object.class.name
    object_id = object.id

Severity: Minor
Found in app/helpers/faceted_browsing_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 precedence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def precedence array1, array2
    result = []
    result |= array2
     array1.each do |a1|
       check = false
Severity: Minor
Found in app/models/policy.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 strain_row_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def strain_row_data strain
    creator = strain.contributor.try(:person)
    creator_link = creator ? link_to(creator.name, person_path(creator.id)) : ""
    parent_strain_link = strain.parent.nil? ? nil : link_to(h(strain.parent.title),strain.parent)
    [(link_to h(strain.organism.title), organism_path(strain.organism.id)),
Severity: Minor
Found in app/helpers/biosamples_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 convert_logs_to_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def convert_logs_to_hash logs
    logs.collect do |log|
      item = log.activity_loggable
      {
          type: text_for_resource(item),
Severity: Minor
Found in app/helpers/homes_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 fav_image_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def fav_image_tag favourite
    item = favourite.resource
    title = get_object_title(item)
    tiny_image = ""

Severity: Minor
Found in app/helpers/favourites_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 discipline_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def discipline_list person
    unless person.disciplines.empty?
      text=""
      person.disciplines.each do |d|
        text += link_to(h(d.title),people_path(:discipline_id=>d.id))
Severity: Minor
Found in app/helpers/people_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 display_single_log_item_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def display_single_log_item_hash item, action
      html=''
       unless item.blank?
         image=item[:avatar_image]
          icon  = link_to(image, item[:url], :class=> "asset", :title => tooltip_title_attrib(item[:type]))
Severity: Minor
Found in app/helpers/homes_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 fancy_multiselect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def fancy_multiselect object, association, options = {}
      options[:object_type_text] = options[:object_class].name.underscore.humanize unless options[:object_type_text]
      with_new_link = options[:with_new_link] || false
      object_type_text = options[:object_type_text]
      object_type_text = (I18n.t 'biosamples.sample_parent_term').capitalize if object_type_text == 'Specimen'
Severity: Minor
Found in app/helpers/fancy_multiselect_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 hidden_item_contributor_links has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def hidden_item_contributor_links hidden_items
    contributor_links = []
    hidden_items = hidden_items.select { |hi| !hi.contributing_user.try(:person).nil? }
    hidden_items.sort! { |a, b| a.contributing_user.person.name <=> b.contributing_user.person.name }
    hidden_items.each do |hi|
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 project_role_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def project_role_list person
    unless person.project_roles.empty?
      text=""
      person.project_roles.each do |r|
        text += link_to(h(r.title),people_path(:project_role_id=>r.id))
Severity: Minor
Found in app/helpers/people_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 build_sop_masters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def build_sop_masters sop_ids
    # map string ids to int ids for ["1","2"].include? 1 == false
    sop_ids = sop_ids.map &:to_i
    sop_ids.each do |sop_id|
      if sop = Sop.find(sop_id)
Severity: Minor
Found in app/models/specimen.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 tab_definition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def tab_definition(options={})
    options[:gap_before] ||= false
    options[:title] ||= options[:controllers].first.capitalize
    options[:path] ||= eval "#{options[:controllers].first}_path"

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

  def flag_icon(country, text=country, margin_right='0.3em')
    return '' unless country && !country.empty?

    code = country_code(country)
    
Severity: Minor
Found in app/helpers/images_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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy

    respond_to do |format|
      if @sample.destroy
        format.html { redirect_to samples_url }
Severity: Minor
Found in app/controllers/samples_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 project_managers_of_selected_projects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def project_managers_of_selected_projects projects_param
    project_manager_list = []
    unless projects_param.blank?
      projects_param.each do |project_param|
        project = Project.find_by_id(project_param)
Severity: Minor
Found in app/controllers/people_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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @help_document = HelpDocument.new(params[:help_document]) 
    if params[:commit] == "Preview"
      @preview = true
    end
Severity: Minor
Found in app/controllers/help_documents_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

Severity
Category
Status
Source
Language