SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Method search_in_sabiork has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def search_in_sabiork
     unless params[:compound_name].blank?
       compound_annotation = Seek::SabiorkWebservices.new().get_compound_annotation(params[:compound_name])
       unless compound_annotation.blank?
           synonyms = compound_annotation['synonyms'].inject{|result, s| result.concat("; #{s}")}
Severity: Minor
Found in app/controllers/compounds_controller.rb - About 2 hrs 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 associate_authors has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def associate_authors
    publication = @publication
    projects = publication.projects
    projects = current_user.person.projects if projects.empty?
    association = {}
Severity: Minor
Found in app/controllers/publications_controller.rb - About 2 hrs 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 authorized_required_access_for_owner? has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        def authorized_required_access_for_owner?
          result = true
          if self.class.respond_to?(:associations_requiring_access_for_owner)
            enforced_associations = self.class.associations_requiring_access_for_owner.keys
            unless enforced_associations.empty?
Severity: Minor
Found in lib/seek/permissions/authorization_enforcement.rb - About 2 hrs 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 log_event has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def log_event
    User.with_current_user current_user do
      c = self.controller_name.downcase
      a = self.action_name.downcase

Severity: Major
Found in app/controllers/application_controller.rb - About 2 hrs to fix

    File assets_helper.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module AssetsHelper
      include ApplicationHelper
    
      #the prefix used on some field id's, e.g. data_files_data_url
      def asset_field_prefix
    Severity: Minor
    Found in app/helpers/assets_helper.rb - About 2 hrs to fix

      Class AdminsController has 25 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class AdminsController < ApplicationController
        include CommonSweepers
      
        RESTART_MSG = "Your settings have been updated. If you changed some settings e.g. search, you need to restart some processes.
                       Please see the buttons and explanations below."
      Severity: Minor
      Found in app/controllers/admins_controller.rb - About 2 hrs to fix

        Method duesseldorf_bode_surgical_mapping has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def duesseldorf_bode_surgical_mapping
        
              gene_modification_regex = /([\w\d]+)([\/+-]+)/
        
              {
        Severity: Major
        Found in lib/seek/parser_mapper.rb - About 2 hrs to fix

          Method matching_data_files has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def matching_data_files params_only=false
              
              results = {}
          
              if Seek::Config.solr_enabled && is_jws_supported?
          Severity: Minor
          Found in app/models/model.rb - About 2 hrs 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_node_elements has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def cytoscape_node_elements nodes
              cytoscape_node_elements = []
              nodes.each do |node|
                item_type, item_id = node.split('_')
                item = item_type.constantize.find_by_id(item_id)
          Severity: Minor
          Found in app/helpers/i_s_a_helper.rb - About 2 hrs 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 render_ontology_class_tree has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def render_ontology_class_tree clz, type, selected_uri,depth=0
              list = []
              uri = clz.uri.try(:to_s)
              path = send("#{type}_types_path", :uri => uri, :label => clz.label)
              assays = clz.assays
          Severity: Minor
          Found in app/helpers/suggested_assay_types_helper.rb - About 2 hrs 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 a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def avatar(object, size=200, return_image_tag_only=false, url=nil, alt=nil, show_tooltip=true)
              alternative = ""
              title = get_object_title(object)
              if show_tooltip
                tooltip_text = (alt.nil? ? h(title) : alt)
          Severity: Minor
          Found in app/helpers/avatars_helper.rb - About 2 hrs 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 runs_table has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def runs_table(runs, redirect_to=nil)
              runs.map do |run|
                workflow = run.workflow
                version = run.workflow_version
                workflow_version = workflow.find_version(version)
          Severity: Minor
          Found in app/helpers/runs_helper.rb - About 2 hrs 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 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              params[:assay_class_id] ||= AssayClass.for_type("experimental").id
              @assay        = Assay.new(params[:assay])
          
              organisms     = params[:assay_organism_ids] || []
          Severity: Minor
          Found in app/controllers/assays_controller.rb - About 2 hrs 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 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              @person = Person.new(params[:person])
          
              redirect_action="new"
          
          
          Severity: Minor
          Found in app/controllers/people_controller.rb - About 2 hrs 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 set_runlet_parameters has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def set_runlet_parameters
          
              shared_input_values_for_all_runs = params[:sweep].delete(:shared_input_values_for_all_runs)
              params[:sweep][:runs_attributes].each_with_index do |(run_id, run_attributes), iteration_index|
                run_attributes[:workflow_id] = params[:sweep][:workflow_id]
          Severity: Minor
          Found in app/controllers/sweeps_controller.rb - About 2 hrs 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_rdf has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

                  def update_rdf(item)
                    if configured?
                      connect_to_repository
                      graphs = rdf_graph_uris(item)
                      rdf_file_path = last_rdf_file_path(item)
          Severity: Minor
          Found in lib/seek/rdf/rdf_repository.rb - About 2 hrs 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 add has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            def add
              if request.post?
                if params[:id]=="drag_search" #needs to create the SavedSearch resource first
                  saved_search = SavedSearch.new(:user_id => current_user.id, :search_query => params[:search_query], :search_type => params[:search_type],:include_external_search=>params[:include_external_search]=="1")
                  if SavedSearch.find_by_user_id_and_search_query_and_search_type_and_include_external_search(current_user,params[:search_query],params[:search_type],params[:include_external_search]=="1").nil? && saved_search.save
          Severity: Minor
          Found in app/controllers/favourites_controller.rb - About 2 hrs 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 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

                def update
                  raise Exception.new("No ID") if seek_id.blank?
                  person_record=Person.find_by_id(seek_id)
                  raise Exception.new("Unable to find person with ID: #{seek_id}") if person_record.nil?
                  raise Exception.new("Person is not a member of Translucent") unless person_record.projects.include?(@project)  
          Severity: Minor
          Found in lib/jerm/translucent_person_harvester.rb - About 2 hrs 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 prototype has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Search.prototype = $.extend({}, Navigation, new function() {
            var suid = 1;
          
            this.init = function() {
              var _this = this;
          Severity: Major
          Found in doc/seek/js/search.js - About 2 hrs to fix

            File policy_based_authorization.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'project_compat'
            module Seek
              module Permissions
                module PolicyBasedAuthorization
            
            
            Severity: Minor
            Found in lib/seek/permissions/policy_based_authorization.rb - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language