SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Method update_others has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def update_others
    update_flag = true
    if Seek::Config.tag_threshold.to_s != params[:tag_threshold] || Seek::Config.max_visible_tags.to_s!=params[:max_visible_tags]
      expire_annotation_fragments
    end
Severity: Minor
Found in app/controllers/admins_controller.rb - About 1 hr 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 fetch_preview has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch_preview
    #trim the PubMed or Doi Id
    params[:key] = params[:key].strip() unless params[:key].blank?
    params[:publication][:project_ids].reject!(&:blank?).map! { |id| id.split(',') }.flatten!
    @publication = Publication.new(params[:publication])
Severity: Minor
Found in app/controllers/publications_controller.rb - About 1 hr 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 show has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    respond_to do |format|
      format.html do
        # see notes in application.rb on how this works
        update_last_seen_at
Severity: Minor
Found in app/controllers/topics_controller.rb - About 1 hr 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 filter_size has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def filter_size size
        size = size[0..-($1.length.to_i + 2)] if size =~ /[0-9]+x[0-9]+\.([a-z0-9]+)/ # trim file extension
        max_size=MAX_SIZE
        matches = size.match /([0-9]+)x([0-9]+).*/
        if matches
Severity: Minor
Found in lib/seek/acts_as_fleximage_extension.rb - About 1 hr 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_substance has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def update_substance(substance)
    unless substance.blank?
         #call the webservice to retrieve the substance annotation from sabiork
         #the annotation is stored in a hash, which keys: recommended_name, synonyms, sabiork_id, chebi_ids, kegg_ids
         compound_annotation = Seek::SabiorkWebservices.new().get_compound_annotation(substance)
Severity: Minor
Found in lib/seek/factor_studied.rb - About 1 hr 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 duesseldorf_bode_surgical_mapping has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def duesseldorf_bode_surgical_mapping

      gene_modification_regex = /([\w\d]+)([\/+-]+)/

      {
Severity: Minor
Found in lib/seek/parser_mapper.rb - About 1 hr 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 open_id_authentication has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def open_id_authentication(identity_url)
    # Pass optional :required and :optional keys to specify what sreg fields you want.
    # Be sure to yield registration, a third argument in the #authenticate_with_open_id block.
    authenticate_with_open_id(identity_url,        
        :required => [:email, :fullname,
Severity: Minor
Found in app/controllers/users_controller.rb - About 1 hr to fix

    Method update has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def update
        # remove protected columns (including a "link" to content blob - actual data cannot be updated!)
        if params[:model]
          [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
            params[:model].delete(column_name)
    Severity: Minor
    Found in app/controllers/models_controller.rb - About 1 hr to fix

      Method insert_results has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def insert_results
          resources=[]
          @project=Project.find(params[:project])
          params.keys.each do |key|
            if key.start_with?("title")
      Severity: Minor
      Found in app/controllers/jerm_controller.rb - About 1 hr to fix

        Method update has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def update
            # remove protected columns (including a "link" to content blob - actual data cannot be updated!)
            if params[:presentation]
              [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
                params[:presentation].delete(column_name)
        Severity: Minor
        Found in app/controllers/presentations_controller.rb - About 1 hr to fix

          Function performSearch has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function performSearch(data, regexps, queries, highlighters, state) {
              var searchIndex = data.searchIndex;
              var longSearchIndex = data.longSearchIndex;
              var info = data.info;
              var result = [];
          Severity: Minor
          Found in doc/seek/js/searcher.js - About 1 hr to fix

            Method create has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create
                @topic = Topic.find_by_id_and_forum_id(params[:topic_id],params[:forum_id])
                if @topic.locked?
                  respond_to do |format|
                    format.html do
            Severity: Minor
            Found in app/controllers/posts_controller.rb - About 1 hr to fix

              Method search_in_sabiork has 38 lines of code (exceeds 25 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 1 hr to fix

                Method update has 38 lines of code (exceeds 25 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 1 hr to fix

                  Method runs_table has 37 lines of code (exceeds 25 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 1 hr to fix

                    Method menu_definitions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def menu_definitions
                        definitions=[
                            {:title=>t("menu.yellow_pages"), :sections=>[
                                {:controller=>"programmes",:title=>t('programme').pluralize,:hide=>!Seek::Config.programmes_enabled},
                                {:controller=>"people",:title=>"People"},
                    Severity: Minor
                    Found in app/helpers/menu_helper.rb - About 1 hr to fix

                      Method update has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def update
                          # remove protected columns (including a "link" to content blob - actual data cannot be updated!)
                          if params[:sop]
                            [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
                              params[:sop].delete(column_name)
                      Severity: Minor
                      Found in app/controllers/sops_controller.rb - About 1 hr to fix

                        Method associate_authors has 37 lines of code (exceeds 25 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 1 hr to fix

                          Function updateOrganisms has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function updateOrganisms() {
                              organism_text=''
                              type="Organism"
                              organism_ids=new Array();
                          
                          
                          Severity: Minor
                          Found in app/assets/javascripts/projects.js - About 1 hr to fix

                            Function updateDisciplines has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function updateDisciplines() {
                                discipline_text=''
                                type="Discipline"
                                discipline_ids=new Array();
                            
                            
                            Severity: Minor
                            Found in app/assets/javascripts/people.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language