SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

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

  def studies_link_list studies,sorted=true
    #FIXME: make more generic and share with other model link list helper methods
    studies=studies.select{|s| !s.nil?} #remove nil items
    return "<span class='none_text'>Not associated with any #{t('study').pluralize}</span>".html_safe if studies.empty?

Severity: Minor
Found in app/helpers/studies_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 list_item_with_icon has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def list_item_with_icon(icon_type, item, caption, truncate_to, custom_tooltip=nil, size=nil)
Severity: Minor
Found in app/helpers/application_helper.rb - About 45 mins to fix

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

      def cytoscape_edge_elements edges
        cytoscape_edge_elements = []
        edges.each do |edge|
          source, target = edge.split('--')
          source.strip!
    Severity: Minor
    Found in app/helpers/i_s_a_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 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 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 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 related_items_method has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def related_items_method(resource, item_type)
            if item_type == "TavernaPlayer::Run"
              method_name = 'runs'
            else
              method_name = item_type.underscore.pluralize
        Severity: Minor
        Found in app/helpers/assets_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 policy_and_permissions_for_public_scope has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def policy_and_permissions_for_public_scope(policy, permissions, privileged_people, resource_name, updated_can_publish_immediately, send_request_publish_approval)
        Severity: Minor
        Found in app/helpers/policy_helper.rb - About 45 mins to fix

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

            def deep_parse(types, output, zip, index = [])
              content = "<ol>"
              i = 0
              types.each do |type|
                if type.is_a?(Array)
          Severity: Minor
          Found in app/helpers/result_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 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 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 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_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 submit_to_sycamore has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def submit_to_sycamore
              @model = Model.find_by_id(params[:id])
              @display_model = @model.find_version(params[:version])
              error_message = nil
              if !Seek::Config.sycamore_enabled
          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 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

          Severity
          Category
          Status
          Source
          Language