SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Avoid too many return statements within this method.
Open

            return false
Severity: Major
Found in lib/explicit_versioning.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                  return true
    Severity: Major
    Found in lib/explicit_versioning.rb - About 30 mins to fix

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

      function addSelectedDataFile() {
          selected_option_index=$("possible_data_files").selectedIndex;
          selected_option=$("possible_data_files").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 hookSearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function hookSearch() {
        var input  = $('#search-field').eq(0);
        var result = $('#search-results').eq(0);
        $(result).show();
      
      
      Severity: Minor
      Found in doc/seek/js/darkfish.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 bio_reference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def bio_reference
          if pubmed_id
            Bio::MEDLINE.new(Bio::PubMed.efetch(pubmed_id).first).reference
          else
            #TODO: Bio::Reference supports a 'url' option. Should this be the URL on seek, or the URL of the 'View Publication' button, or neither?
      Severity: Minor
      Found in app/models/publication.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 updateModels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function updateModels() {
          model_text='<ul class="related_asset_list">';
          type="Model";
          model_ids=new Array();
      
      
      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 updateEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function updateEvents() {
          event_text = '<ul class="related_asset_list">'
          for (var i = 0; i < events_array.length; i++) {
              var event = events_array[i];
              var title = event[0];
      Severity: Minor
      Found in app/assets/javascripts/associate_events.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 updateSops has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function updateSops() {
          sop_text='<ul class="related_asset_list">';
      
          sop_ids=new Array();
      
      
      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 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 setTheDivStyle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function setTheDivStyle() {
      if(!readCookie('name_panel')) {
      // if cookie not found display the div and create the cookie
      //document.getElementById("name_panel").style.display="block";
      //createCookie('name_panel', 1);  // 1 day = 24 hours persistence
      Severity: Minor
      Found in app/assets/javascripts/jws/JWSconstructor_panels.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 addSelectedPublication has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function addSelectedPublication() {
          selected_option_index=$("possible_publications").selectedIndex;
          selected_option=$("possible_publications").options[selected_option_index];
          title=selected_option.text;
          id=selected_option.value;
      Severity: Minor
      Found in app/assets/javascripts/publication.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 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 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 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 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 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 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 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

      Severity
      Category
      Status
      Source
      Language