SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Method tree_single_select_tag has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def tree_single_select_tag type, id, selected_item=nil, disabled_items=[], name=nil, html_options={:multiple => false, :size => 10, :style => "width:600px;"}
Severity: Minor
Found in app/helpers/projects_helper.rb - About 45 mins to fix

    Method get_people_in_network has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_people_in_network access_type
        people_in_network = [] #id, name, access_type
        projects = Project.all
        projects.each do |project|
          project.people.each do |person|
    Severity: Minor
    Found in app/models/policy.rb - About 45 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 list_item_with_icon has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def list_item_with_icon(icon_type, item, caption, truncate_to, custom_tooltip=nil, size=nil)
        list_item = "<li>"
        if icon_type.downcase == "flag"
          list_item += flag_icon(item.country)
        elsif icon_type == "data_file" || icon_type == "sop"
    Severity: Minor
    Found in app/helpers/application_helper.rb - About 45 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 resource_tab_item_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def resource_tab_item_name resource_type,pluralize=true
        resource_type = resource_type.singularize
        if resource_type == "Speciman"
          result = t('biosamples.sample_parent_term')
        elsif resource_type == "Assay"
    Severity: Minor
    Found in app/helpers/application_helper.rb - About 45 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 recently_downloaded_item_logs_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def recently_downloaded_item_logs_hash time=1.month.ago, number_of_item=10
        Rails.cache.fetch("download_activity_#{current_user_id}") do
          activity_logs = ActivityLog.no_spider.where(["action = ? AND created_at > ?", 'download', time]).order("created_at DESC")
          selected_activity_logs = []
          selected_items = []
    Severity: Minor
    Found in app/helpers/homes_helper.rb - About 45 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 recently_added_item_logs_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def recently_added_item_logs_hash time=1.month.ago, number_of_item=10
        Rails.cache.fetch("create_activity_#{current_user_id}") do
          item_types = Seek::Util.user_creatable_types.collect{|type| type.name} | [Project,Programme]
          activity_logs = ActivityLog.where(["action = ? AND created_at > ? AND activity_loggable_type in (?)", 'create', time, item_types]).order("created_at DESC")
          selected_activity_logs = []
    Severity: Minor
    Found in app/helpers/homes_helper.rb - About 45 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 avatar has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def avatar(object, size=200, return_image_tag_only=false, url=nil, alt=nil, show_tooltip=true)
    Severity: Minor
    Found in app/helpers/avatars_helper.rb - About 45 mins to fix

      Method list_item_expandable_text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def list_item_expandable_text attribute, text, length=200
          full_text  = text_or_not_specified(text, :description => false, :auto_link=>false)
          trunc_text = text_or_not_specified(text, :description => false, :auto_link=>false, :length=>length)
          #Don't bother with fancy stuff if not enough text to expand
          if full_text == trunc_text
      Severity: Minor
      Found in app/helpers/resource_list_item_helper.rb - About 45 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 get_people_in_FG has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_people_in_FG contributor, fg_id=nil, is_white_list=nil, is_black_list=nil
          if is_white_list
            f_group = FavouriteGroup.where(["name = ? AND user_id = ?", "__whitelist__", contributor.user.id]).first
          elsif is_black_list
            f_group = FavouriteGroup.where(["name = ? AND user_id = ?", "__blacklist__", contributor.user.id]).first
      Severity: Minor
      Found in app/models/policy.rb - About 45 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 allow_model_comparison has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def allow_model_comparison model,displayed_model,user=User.current_user
          return false unless model.is_a?(Model)
          return false unless model.can_download?(user)
          return false unless displayed_model.contains_sbml?
          return false unless model.versions.select{|v| v.contains_sbml?}.count > 1
      Severity: Minor
      Found in app/helpers/models_helper.rb - About 45 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 update_members has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def update_members
          groups_to_remove = params[:group_memberships_to_remove] || []
          people_and_institutions_to_add = params[:people_and_institutions_to_add] || []
          groups_to_remove.each do |group|
            g = GroupMembership.find(group)
      Severity: Minor
      Found in app/controllers/projects_controller.rb - About 45 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 delete_model_format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def delete_model_format params
          id=params[:selected_model_format_id]
          model_format=ModelFormat.find(id)
          success=false
          if (model_format.models.empty?)
      Severity: Minor
      Found in app/controllers/models_controller.rb - About 45 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_from_existing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def create_from_existing
          studied_factor_ids = []
          new_studied_factors = []
          #retrieve the selected FSes
      
      
      Severity: Minor
      Found in app/controllers/studied_factors_controller.rb - About 45 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 determine_return_url_after_login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def determine_return_url_after_login
          if !params[:called_from].blank? && !params[:called_from][:url].blank?
            return_to_url = params[:called_from][:url]
          elsif !params[:called_from].blank? && params[:called_from][:controller] != "sessions"
            if params[:called_from][:id].blank?
      Severity: Minor
      Found in app/controllers/sessions_controller.rb - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def destroy
          respond_to do |format|
            if @suggested_technology_type.can_destroy?
              title = @suggested_technology_type.label
              @suggested_technology_type.destroy
      Severity: Minor
      Found in app/controllers/suggested_technology_types_controller.rb - About 45 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 core_xlink has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def core_xlink object,include_title=true
          if (object.class.name.include?("::Version"))
            xlink=xlink_attributes(uri_for_object(object.parent,{:params=>{:version=>object.version}}))
          else
            xlink=xlink_attributes(uri_for_object(object))  
      Severity: Minor
      Found in app/helpers/api_helper.rb - About 45 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 new_strain has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def new_strain strain_params
          strain = Strain.new
          # to delete id hash which is saved in the hidden id field (automatically generated in form with fields_for)
          # try_block {
          #delete id hashes of genotypes/phenotypes
      Severity: Minor
      Found in app/controllers/strains_controller.rb - About 45 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 determine_submitter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def determine_submitter object
          #FIXME: needs to be the creators for assets
          return object.owner if object.respond_to?("owner")
          result = object.contributor if object.respond_to?("contributor") && !object.kind_of?(Permission)
          if (result)
      Severity: Minor
      Found in app/helpers/api_helper.rb - About 45 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 delete_model_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def delete_model_type params
          id=params[:selected_model_type_id]
          model_type=ModelType.find(id)
          success=false
          if (model_type.models.empty?)
      Severity: Minor
      Found in app/controllers/models_controller.rb - About 45 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 deeply nested control flow statements.
      Open

                    unless  bio_samples.errors.blank?
                      flash[:notice] << "<br/> However, Sample database population failed."
                      flash[:error] = bio_samples.errors.html_safe
                      #respond_to do |format|
                      #  format.html{
      Severity: Major
      Found in app/controllers/data_files_controller.rb - About 45 mins to fix
        Severity
        Category
        Status
        Source
        Language