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

                        context.strokeRect(
                            data.select[0],
                            data.select[1],
                            data.select[2] - data.select[0],
                            data.select[3] - data.select[1]);
Severity: Major
Found in app/assets/javascripts/modified_cytoscape.js and 1 other location - About 1 hr to fix
app/assets/javascripts/modified_cytoscape.js on lines 731..735

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

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

                    context.fillRect(
                        data.select[0],
                        data.select[1],
                        data.select[2] - data.select[0],
                        data.select[3] - data.select[1]);
Severity: Major
Found in app/assets/javascripts/modified_cytoscape.js and 1 other location - About 1 hr to fix
app/assets/javascripts/modified_cytoscape.js on lines 744..748

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

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 updateRoles has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateRoles(editable,group_id) {

    role_ids=new Array();
    role_text=""

Severity: Minor
Found in app/assets/javascripts/people.js - About 1 hr to fix

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

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

        def create
          if handle_upload_data
      
            @data_file = DataFile.new params[:data_file]
      
      
      Severity: Minor
      Found in app/controllers/data_files_controller.rb - About 1 hr to fix

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

            def set_rna_extractions sheet, rna_extraction_protocol, rna_attribute_names       # not used anymore
              sheet_name = sheet.attributes["name"]
        
              row = rna_extraction_protocol.attributes["row"].to_i
              col = rna_extraction_protocol.attributes["column"].to_i
        Severity: Major
        Found in lib/seek/data/bio_samples.rb and 2 other locations - About 1 hr to fix
        lib/seek/data/bio_samples.rb on lines 546..559
        lib/seek/data/bio_samples.rb on lines 578..591

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

        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 3 locations. Consider refactoring.
        Open

            def set_sequencing sheet, sequencing_protocol, sequencing_attribute_names   # not used anymore
              sheet_name = sheet.attributes["name"]
        
              row = sequencing_protocol.attributes["row"].to_i
              col = sequencing_protocol.attributes["column"].to_i
        Severity: Major
        Found in lib/seek/data/bio_samples.rb and 2 other locations - About 1 hr to fix
        lib/seek/data/bio_samples.rb on lines 546..559
        lib/seek/data/bio_samples.rb on lines 562..575

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

        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 3 locations. Consider refactoring.
        Open

            def set_treatments sheet, treatment_protocol, treatment_attribute_names         # not used anymore
              sheet_name = sheet.attributes["name"]
        
              row = treatment_protocol.attributes["row"].to_i
              col = treatment_protocol.attributes["column"].to_i
        Severity: Major
        Found in lib/seek/data/bio_samples.rb and 2 other locations - About 1 hr to fix
        lib/seek/data/bio_samples.rb on lines 562..575
        lib/seek/data/bio_samples.rb on lines 578..591

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

        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 setTheDivStyle has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function setTheDivStyle() {
        if(!readCookie('name_panel')) {
        // if cookie not found display the div and create the cookie
        //document.getElementById("name_panel").style.display="block";
        //createCookie('name_panel', 1);  // 1 day = 24 hours persistence
        Severity: Minor
        Found in app/assets/javascripts/jws/JWSconstructor_panels.js - About 1 hr to fix

          Function addAll has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function addAll(resource_type, source) {
          
              if (source == "target") {
                  for(var key in allLinks[resource_type]) {
                      $(resource_type +"_" + key + "_target_row").hide();
          Severity: Minor
          Found in app/assets/javascripts/link_adder.js - About 1 hr to fix

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

                if (link_hash == null) {
                    link_hash = {};
                    allLinks[resource_type] = link_hash;
                    var source_map = {};
                    checkedSourceMap[resource_type] = source_map
            Severity: Major
            Found in app/assets/javascripts/link_adder.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/link_adder.js on lines 133..140

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

            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 (link_data == null) {
                    link_data = {};
                    allLinksData[resource_type] = link_data;
                    var target_map = {};
                    checkedTargetMap[resource_type] = target_map
            Severity: Major
            Found in app/assets/javascripts/link_adder.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/link_adder.js on lines 123..130

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

            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 specimen_row_data has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def specimen_row_data specimen
                id_column = Seek::Config.is_virtualliver ? 8 : 6
                creators = []
                specimen.creators.each do |creator|
                  creators << link_to(h(creator.name), person_path(creator.id))
            Severity: Minor
            Found in app/helpers/biosamples_helper.rb - About 1 hr to fix

              Method tree_editor_display has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def tree_editor_display type, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selective_display=false, foldable=false
              
                  selected_display_items = nil
              
                  if selected_id && selective_display
              Severity: Minor
              Found in app/helpers/projects_helper.rb - About 1 hr to fix

                Method send_policy_data has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def send_policy_data
                    request_type = white_list(params[:policy_type])
                    entity_type = white_list(params[:entity_type])
                    entity_id = white_list(params[:entity_id])
                    
                Severity: Minor
                Found in app/controllers/policies_controller.rb - About 1 hr to fix

                  Method update_rdf has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def update_rdf(item)
                            if configured?
                              connect_to_repository
                              graphs = rdf_graph_uris(item)
                              rdf_file_path = last_rdf_file_path(item)
                  Severity: Minor
                  Found in lib/seek/rdf/rdf_repository.rb - About 1 hr to fix

                    Method clone_versioned_model has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def clone_versioned_model(orig_model, new_model, process_file_columns=true)
                                self.versioned_attributes.each do |key|
                                  # Make sure to ignore file columns, white list columns, timestamp columns and any other ignore columns
                                  unless self.file_columns.include?(key) ||
                                         self.white_list_columns.include?(key) ||
                    Severity: Minor
                    Found in lib/explicit_versioning.rb - About 1 hr to fix

                      Method populate_treatment has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def populate_treatment treatment_json, specimen=nil, sample=nil
                      
                              start_value = treatment_json["start value"]
                              end_value = treatment_json["end value"]
                              standard_deviation = treatment_json["standard deviation"]
                      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

                          def fs_search_fields
                            flds = studied_factors.collect do |fs|
                              [fs.measured_item.title,
                               fs.substances.collect do |sub|
                                 #FIXME: this makes the assumption that the synonym.substance appears like a Compound
                        Severity: Major
                        Found in app/models/data_file.rb and 1 other location - About 1 hr to fix
                        app/models/sop.rb on lines 60..72

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

                        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 @strain.save
                              if @strain.from_biosamples=='true'
                                #reload to get updated nested attributes,e.g. genotypes/phenotypes
                                @strain.reload
                                render :partial => "biosamples/back_to_biosamples", :locals => {:action => 'update', :object => @strain}
                        Severity: Major
                        Found in app/controllers/strains_controller.rb and 1 other location - About 1 hr to fix
                        app/controllers/strains_controller.rb on lines 40..55

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

                        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