SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Method included has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.included klass
        klass.class_eval do
          searchable do
            text :title do
              if self.respond_to?(:title)
Severity: Minor
Found in lib/seek/search/search_sunspot.rb - About 1 hr to fix

    Method populate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def populate      
          begin
            @translucent_id = @node.find_first("id").content unless @node.find_first("id").nil?
            @author_seek_id = @node.find_first("submitter").content unless @node.find_first("submitter").nil?
            if @type=="Model"
    Severity: Minor
    Found in lib/jerm/translucent_resource.rb - About 1 hr to fix

      Function onclick has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          click_tab.onclick = function(){
              deactivate_previous_tab(this);
              click_tab.parentElement.className = 'tabberactive';
      
              //if the content of the click_tab is already loaded, just show it, otherwise call ajax to get the content
      Severity: Minor
      Found in app/assets/javascripts/tab_lazy_load.js - About 1 hr to fix

        Function activateSheet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function activateSheet(sheet, sheetTab) {
            if (sheetTab == null) {
                var i = sheet - 1;
                sheetTab = $j("a.sheet_tab:eq(" + i + ")");
            }
        Severity: Minor
        Found in app/assets/javascripts/spreadsheet_explorer.js - About 1 hr to fix

          Function animateNode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function animateNode(node){
              var nodes = cy.$('node');
              var edges = cy.$('edge');
          
              //first normalizing all nodes and fading all nodes and edges
          Severity: Minor
          Found in app/assets/javascripts/isa_graph.js - About 1 hr to fix

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

              Method rows_to_flot_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def rows_to_flot_data rows
                  data = {}
                  labels = []
                  rows.each_with_index do |row,y|
                    t=nil
              Severity: Minor
              Found in app/helpers/data_fuse_helper.rb - About 1 hr to fix

                Method index has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def index
                
                    if Seek::Config.solr_enabled
                      perform_search
                    else
                Severity: Minor
                Found in app/controllers/search_controller.rb - About 1 hr to fix

                  Method fetch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def fetch    
                      @project=Project.find(params[:project])
                      @project.decrypt_credentials
                      if @project.site_root_uri.blank?
                        flash.now[:error]="No remote site location defined"
                  Severity: Minor
                  Found in app/controllers/jerm_controller.rb - About 1 hr to fix

                    Method new_version has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def new_version
                        if handle_upload_data
                          comments=params[:revision_comment]
                    
                          respond_to do |format|
                    Severity: Minor
                    Found in app/controllers/data_files_controller.rb - About 1 hr to fix

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

                        Method handle_download has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def handle_download disposition='attachment', image_size=nil
                              if @content_blob.url.blank?
                                if @content_blob.file_exists?
                                  if image_size && @content_blob.is_image?
                                    @content_blob.copy_image
                        Severity: Minor
                        Found in lib/seek/content_blob_common.rb - About 1 hr to fix

                          Method update_features_enabled has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def update_features_enabled
                              Seek::Config.public_seek_enabled= string_to_boolean(params[:public_seek_enabled] || true)
                              Seek::Config.events_enabled= string_to_boolean params[:events_enabled]
                              Seek::Config.jerm_enabled= string_to_boolean params[:jerm_enabled]
                              Seek::Config.email_enabled= string_to_boolean params[:email_enabled]
                          Severity: Minor
                          Found in app/controllers/admins_controller.rb - About 1 hr to fix

                            Method builder_content has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def builder_content content_blob
                                      filepath=content_blob.filepath
                            
                                      #this is necessary to get the correct filename and especially extension, which JWS relies on
                                      tmpfile = Tempfile.new([content_blob.original_filename,File.extname(content_blob.original_filename)])
                            Severity: Minor
                            Found in lib/seek/jws/builder.rb - About 1 hr to fix

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

                                def create
                                  group_name = white_list(params[:favourite_group_name])
                                  already_exists = FavouriteGroup.where(:name => group_name, :user_id => current_user.id).first
                                  
                                  unless already_exists
                              Severity: Minor
                              Found in app/controllers/favourite_groups_controller.rb - About 1 hr to fix

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

                                  def create
                                    topic_saved, post_saved = false, false
                                        # this is icky - move the topic/first post workings into the topic model?
                                    Topic.transaction do
                                        @topic  = @forum.topics.build(:title => params[:topic][:title])
                                Severity: Minor
                                Found in app/controllers/topics_controller.rb - About 1 hr to fix

                                  Method extract_from_document has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def extract_from_document doc
                                        doc.root.namespaces.default_prefix = "ss"
                                  
                                  
                                        template_sheet = nil
                                  Severity: Minor
                                  Found in lib/seek/data/bio_samples.rb - About 1 hr to fix

                                    Method cell_range= has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def cell_range= range
                                        start_cell, end_cell = range.split(":")
                                        unless start_cell.nil? || start_cell.match(/^[a-zA-Z]+[1-9][0-9]*$/).nil?
                                          start_cell = start_cell.upcase
                                          self.start_column, self.start_row = from_alpha(start_cell.sub(/[0-9]+/,"")), start_cell.sub(/[A-Z]+/,"").to_i
                                    Severity: Minor
                                    Found in app/models/cell_range.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

                                    Function tipShow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        tipShow : function() {        
                                            var scrX = Number(this.xCord);
                                            var scrY = Number(this.yCord);
                                            var tp = parseInt(scrY+15);
                                            var lt = parseInt(scrX+10);
                                    Severity: Minor
                                    Found in app/assets/javascripts/jws/sweetTitles.js - 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 perform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def perform
                                        todo = ReindexingQueue.order("id ASC").limit(BATCHSIZE).collect do |queued|
                                          todo = queued.item
                                          queued.destroy
                                          todo
                                    Severity: Minor
                                    Found in app/jobs/reindexing_job.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language