SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

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

        el.goToSlide = function(slideIndex, direction){
            // if plugin is currently in motion, ignore request
            if(slider.working || slider.active.index == slideIndex) return;
            // declare that plugin is in motion
            slider.working = true;
Severity: Major
Found in app/assets/javascripts/jquery.bxslider.js - About 2 hrs to fix

    Class RdfRepository has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class RdfRepository
    
            #provides a singleton instance of the configured repository
            def self.instance
              #TODO: in the future, when/if we support more repository flavours, the instance we return will need to be configurable
    Severity: Minor
    Found in lib/seek/rdf/rdf_repository.rb - About 2 hrs to fix

      Function setup has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              var setup = function(){
                  // wrap el in a wrapper
                  el.wrap('<div class="bx-wrapper"><div class="bx-viewport"></div></div>');
                  // store a namspace reference to .bx-viewport
                  slider.viewport = el.parent();
      Severity: Major
      Found in app/assets/javascripts/jquery.bxslider.js - About 2 hrs to fix

        Method parse_spreadsheet_xml has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def parse_spreadsheet_xml(spreadsheet_xml)
                workbook = Workbook.new
        
                doc = LibXML::XML::Parser.string(spreadsheet_xml).parse
                doc.root.namespaces.default_prefix="ss"
        Severity: Major
        Found in lib/seek/data/spreadsheet_explorer_representation.rb - About 2 hrs to fix

          Method initialize has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def initialize file, xml=nil, to_populate=true, institution_id = nil
                @file = file
          
                @investigation = nil
                @study = nil
          Severity: Major
          Found in lib/seek/data/bio_samples.rb - About 2 hrs to fix

            Method add_as_new has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def add_as_new resource
                  #FIXME: this method is too long 
                  begin
                    warning=nil
                    warning_code=0
            Severity: Major
            Found in lib/jerm/embedded_populator.rb - About 2 hrs to fix

              Method matching_models has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                def matching_models
              
                  results = {}
              
                  if Seek::Config.solr_enabled && contains_extractable_spreadsheet?
              Severity: Minor
              Found in app/models/data_file.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 list_item_title has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                def list_item_title resource, options={}
                  cache_key = "rli_title_#{resource.cache_key}_#{resource.authorization_supported? && resource.can_manage?}"
                  result = Rails.cache.fetch(cache_key) do
                    title=options[:title]
                    url=options[:url]
              Severity: Minor
              Found in app/helpers/resource_list_item_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 update has a Cognitive Complexity of 17 (exceeds 5 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 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 17 (exceeds 5 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 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 new_object_based_on_existing_one has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                def new_object_based_on_existing_one
                  @existing_assay =  Assay.find(params[:id])
                  @assay = @existing_assay.clone_with_associations
                  params[:data_file_ids]=@existing_assay.data_file_masters.collect{|d|"#{d.id},None"}
                  params[:related_publication_ids]= @existing_assay.related_publications.collect{|p| "#{p.id},None"}
              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 17 (exceeds 5 allowed). Consider refactoring.
              Open

                def create
                  if handle_upload_data
                    @model = Model.new(params[:model])
              
                    @model.policy.set_attributes_with_sharing params[:sharing], @model.projects
              Severity: Minor
              Found in app/controllers/models_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 extract_as_table has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                    def extract_as_table treatments_heading_row, sample_col, treatments_first_col,treatments_last_col,sheet
                      table = []
                      sheet_name = sheet.attributes["name"]
                      cells = sheet.find("//ss:sheet[@name='#{sheet_name}']/ss:rows/ss:row/ss:cell[@row >= '#{(treatments_heading_row).to_s}' and (@column = '#{sample_col.to_s}' or (@column>='#{treatments_first_col.to_s}' and @column<='#{treatments_last_col.to_s}'))]")
              
              
              Severity: Minor
              Found in lib/seek/data/treatments.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_or_new_substances has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def find_or_new_substances(new_substances, known_substance_ids_and_types)
                  result = []
                  known_substances = known_substances known_substance_ids_and_types
                  new_substances, known_substances = check_if_new_substances_are_known new_substances, known_substances
                  result |= known_substances
              Severity: Minor
              Found in lib/seek/factor_studied.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 append_list_assay_organisms has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def append_list_assay_organisms assay_organisms
                  result=""
              
                  organism=nil
                  strain = nil
              Severity: Major
              Found in app/helpers/assays_helper.rb - About 2 hrs to fix

                Method extended_xml has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def extended_xml builder,object        
                    
                    submitter = determine_submitter object
                    builder.tag! "submitter" do 
                      api_partial(builder,submitter)
                Severity: Major
                Found in app/helpers/api_helper.rb - About 2 hrs to fix

                  Class ContentBlob has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ContentBlob < ActiveRecord::Base
                  
                    include Seek::ContentTypeDetection
                    include Seek::PdfExtraction
                    include Seek::MimeTypes
                  Severity: Minor
                  Found in app/models/content_blob.rb - About 2 hrs to fix

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

                    function updateOrganisms() {
                        organism_text='<ul class="related_asset_list">';    
                    
                        for (var i=0;i<organisms.length;i++) {
                            organism=organisms[i];
                    Severity: Major
                    Found in app/assets/javascripts/assays.js - About 2 hrs to fix

                      Method submit_to_jws has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def submit_to_jws
                          following_action=params.delete("following_action")
                          error=nil
                      
                          #FIXME: currently we have to assume that a model with multiple files only contains 1 model file that would be executed on jws online, and only the first one is chosen
                      Severity: Major
                      Found in app/controllers/models_controller.rb - About 2 hrs to fix

                        Function addSelectedOrganism has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function addSelectedOrganism() {
                            selected_option_index=$("possible_organisms").selectedIndex;
                            selected_option=$("possible_organisms").options[selected_option_index];
                            title=selected_option.text;
                            id=selected_option.value;
                        Severity: Minor
                        Found in app/assets/javascripts/assays.js - 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

                        Severity
                        Category
                        Status
                        Source
                        Language