SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

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

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

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

                  function Listen(yes)
                  {
                    if(yes)
                    {
                      _rightHandleDrag.StartListening();
                app/assets/javascripts/jws/Resizeable_Textbox/javascript.js on lines 437..451

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

                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

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

                  function Listen(yes)
                  {
                    if(yes)
                    {
                      _rightHandleDrag.StartListening();
                Severity: Major
                Found in app/assets/javascripts/jws/Resizeable_Textbox/javascript.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/jws/Resizeable_Container/javascript.js on lines 430..444

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

                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

                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
                      Severity
                      Category
                      Status
                      Source
                      Language