SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Method acts_as_asset has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def acts_as_asset
        attr_accessor :parent_name
        include Seek::Taggable

        acts_as_scalable
Severity: Major
Found in lib/acts_as_asset.rb - About 2 hrs to fix

    Class Assay has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Assay < ActiveRecord::Base
    
      include Seek::Rdf::RdfGeneration
      include Seek::OntologyTypeHandling
      include Seek::OntologyExtensionWithSuggestedType
    Severity: Minor
    Found in app/models/assay.rb - About 2 hrs to fix

      Method get_stats has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_stats
          collection = []
          type = nil
          title = nil
          @page=params[:id]
      Severity: Major
      Found in app/controllers/admins_controller.rb - About 2 hrs to fix

        Method associate_tissue_and_cell_type has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def associate_tissue_and_cell_type tissue_and_cell_type_id,tissue_and_cell_type_title
               tissue_and_cell_type=nil
            if !tissue_and_cell_type_title.blank?
              if ( tissue_and_cell_type_id =="0" )
                  found = TissueAndCellType.where(:title => tissue_and_cell_type_title).first
        Severity: Minor
        Found in app/models/sample.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 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
        
            #FIXME: would be better to resolve the differences, rather than keep clearing and reading the assets and organisms
            #DOES resolve differences for assets now
            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 reset_password has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def reset_password
            user = User.find_by_reset_password_code(params[:reset_code] || "")
        
            respond_to do |format|
              if user
        Severity: Minor
        Found in app/controllers/users_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 administer_update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def administer_update
            had_no_projects = @person.work_groups.empty?
        
            passed_params=    {:roles                 =>  User.admin_logged_in?,
                               :roles_mask            => User.admin_logged_in?,
        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 find_and_authorize_requested_item has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def find_and_authorize_requested_item
            begin
              name = self.controller_name.singularize
              action = translate_action(action_name)
        
        
        Severity: Minor
        Found in app/controllers/application_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 included has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.included klass
                klass.class_eval do
                  include ActsAsCachedTree
                  after_update :touch_for_hierarchy_updates
                  #add institution to ancestor projects
        Severity: Major
        Found in lib/seek/project_hierarchies/project_extension.rb - About 2 hrs to fix

          Function displayNormal has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function displayNormal() {
              var xmlHttp;
              try {  // Firefox, Opera 8.0+, Safari  
                  xmlHttp = new XMLHttpRequest(); 
                  if (xmlHttp.overrideMimeType) {
          Severity: Major
          Found in app/assets/javascripts/jws/webMathematica.js - About 2 hrs to fix

            Method new_or_update_mapping_links has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def new_or_update_mapping_links compound, compound_annotation
                #create the mappings and mapping_links
                 sabiork_id = compound_annotation["sabiork_id"]
                 chebi_ids = compound_annotation["chebi_ids"]
                 kegg_ids = compound_annotation["kegg_ids"]
            Severity: Major
            Found in lib/seek/factor_studied.rb - About 2 hrs to fix

              File publications_controller.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class PublicationsController < ApplicationController
                
                include IndexPager
                include DotGenerator
                include Seek::AssetsCommon
              Severity: Minor
              Found in app/controllers/publications_controller.rb - About 2 hrs to fix

                Method uniq_people_permissions_and_privileged_people has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def uniq_people_permissions_and_privileged_people(permissions, privileged_people)
                    uniq_permissions_by_contributor permissions
                
                    people_from_permissions = permissions.select{|p| p.contributor_type == 'Person'}.collect(&:contributor)
                
                
                Severity: Minor
                Found in app/helpers/policy_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 initialize_default_folders has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.initialize_default_folders project, yaml_path=File.join(Rails.root,"config","default_data","default_project_folders.yml")
                    raise Exception.new("This #{I18n.t('project')} already has folders defined") unless ProjectFolder.root_folders(project).empty?
                
                    yaml = YAML.load(ERB.new(File.read(yaml_path)).result)
                    folders={}
                Severity: Minor
                Found in app/models/project_folder.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 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    if handle_upload_data
                      @presentation = Presentation.new(params[:presentation])
                
                      @presentation.policy.set_attributes_with_sharing params[:sharing], @presentation.projects
                Severity: Minor
                Found in app/controllers/presentations_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 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def update
                    # remove protected columns (including a "link" to content blob - actual data cannot be updated!)
                    if params[:data_file]
                      [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
                        params[:data_file].delete(column_name)
                Severity: Minor
                Found in app/controllers/data_files_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 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def update
                    valid = true
                    unless params[:author].blank?
                      person_ids = params[:author].values.reject {|id_string| id_string == ""}
                      if person_ids.uniq.size == person_ids.size
                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 paginate_after_fetch has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    def paginate_after_fetch(collection, *args)
                      options=args.pop unless args.nil?
                      options ||= {}
                      reorder = options[:reorder].nil? ? true : options[:reorder]
                
                
                Severity: Minor
                Found in lib/grouped_pagination.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

                File config.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'simple_crypt'
                
                
                module Seek
                
                
                Severity: Minor
                Found in lib/seek/config.rb - About 2 hrs to fix

                  Function add_selected_people has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function add_selected_people() {
                      var people = determine_selected_people();
                  
                      $j.each(people, function (index, value) {
                          var person_id = value["person_id"];
                  Severity: Major
                  Found in app/assets/javascripts/projects.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language