SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if cls.nil?
      flash.now[:error] = "Unrecognised technology type"
    elsif !params[:label].blank? && params[:label].downcase != cls.label.downcase
      flash.now[:notice] = "Undefined technology type with label <b> #{params[:label]} </b>. Did you mean #{view_context.link_to(cls.label, technology_types_path(:uri=>uri, :label=> cls.label),{:style=> "font-style:italic;font-weight:bold;"})}?".html_safe
    else
Severity: Major
Found in app/controllers/technology_types_controller.rb and 1 other location - About 1 hr to fix
app/controllers/assay_types_controller.rb on lines 32..38

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 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 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 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 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 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 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 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 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 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 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 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 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 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 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

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                                               {:url => url_for(:action => 'related_items_tab_ajax'),
                                                                :method => "get",
                                                                :condition => "check_tab_content('#{tab_content_view_some}', '#{tab_content_view_all}')",
                                                                :with => "'resource_type=' + '#{resource_type}'
                                                                                                         +  '&scale_title=' + '#{scale_title}'
                                Severity: Major
                                Found in app/helpers/assets_helper.rb and 1 other location - About 1 hr to fix
                                app/helpers/assets_helper.rb on lines 309..318

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 51.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                                               {:url => url_for(:action => 'related_items_tab_ajax'),
                                                                :method => "get",
                                                                :condition => "check_tab_content('#{tab_content_view_all}', '#{tab_content_view_some}')",
                                                                :with => "'resource_type=' + '#{resource_type}'
                                                                          +  '&scale_title=' + '#{scale_title}'
                                Severity: Major
                                Found in app/helpers/assets_helper.rb and 1 other location - About 1 hr to fix
                                app/helpers/assets_helper.rb on lines 333..342

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 51.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                                if(slider.settings.mode == 'horizontal'){
                                                    distance = slider.touch.end.x - slider.touch.start.x;
                                                    value = slider.touch.originalPos.left;
                                                }else{
                                Severity: Major
                                Found in app/assets/javascripts/jquery.bxslider.js and 1 other location - About 1 hr to fix
                                app/assets/javascripts/jquery.bxslider.js on lines 1040..1043

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 57.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Similar blocks of code found in 2 locations. Consider refactoring.
                                Open

                                                }else{
                                                    distance = slider.touch.end.y - slider.touch.start.y;
                                                    value = slider.touch.originalPos.top;
                                                }
                                Severity: Major
                                Found in app/assets/javascripts/jquery.bxslider.js and 1 other location - About 1 hr to fix
                                app/assets/javascripts/jquery.bxslider.js on lines 1037..1040

                                Duplicated Code

                                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                Tuning

                                This issue has a mass of 57.

                                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                Refactorings

                                Further Reading

                                Severity
                                Category
                                Status
                                Source
                                Language