SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

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

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

              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

                Function updateAssays has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function updateAssays() {
                    assay_text = '<ul class="related_asset_list">'
                    for (var i=0;i<assays_array.length;i++) {
                        assay=assays_array[i];
                        title=assay[0];
                Severity: Minor
                Found in app/assets/javascripts/assays.js - About 1 hr to fix

                  Method tag_with has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def tag_with tags, attr="tag", owner=User.current_user,owned_tags_only=false
                        tags = Array(tags)
                        #FIXME: yuck! - this is required so that self has an id and can be assigned to an Annotation.annotatable
                        return if self.new_record? && !self.save
                  
                  
                  Severity: Minor
                  Found in lib/seek/taggable.rb - About 1 hr to fix

                    Function displayNormal has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function displayNormal() {
                        var xmlHttp;
                        try {  // Firefox, Opera 8.0+, Safari  
                            xmlHttp = new XMLHttpRequest(); 
                            if (xmlHttp.overrideMimeType) {
                    Severity: Minor
                    Found in app/assets/javascripts/jws/webMathematica.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 dump_tmp_io_object_to_file has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def dump_tmp_io_object_to_file
                        raise Exception.new("You cannot define both :data content and a :tmp_io_object") unless @data.nil? || @tmp_io_object.nil?
                        t1 = Time.now
                        unless @tmp_io_object.nil?
                          begin
                    Severity: Minor
                    Found in app/models/content_blob.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

                    Method set_parameters_for_sharing_form has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def set_parameters_for_sharing_form object=nil
                        object ||= eval "@#{controller_name.singularize}"
                        policy = nil
                        policy_type = ""
                    
                    
                    Severity: Minor
                    Found in app/helpers/application_helper.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

                    Method policy_to_people_group has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def policy_to_people_group people_in_group, contributor=User.current_user.person
                          if sharing_scope == Policy::ALL_SYSMO_USERS
                             people_in_network = get_people_in_network access_type
                             people_in_group['Network'] |= people_in_network unless people_in_network.blank?
                          elsif sharing_scope == Policy::EVERYONE
                    Severity: Minor
                    Found in app/models/policy.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

                    Method resource_title_draggable_avatar has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def resource_title_draggable_avatar resource, version=nil
                    
                        icon=""
                        image=nil
                        if resource.avatar_key
                    Severity: Minor
                    Found in app/helpers/assets_helper.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

                    Method people_by_project_options has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def people_by_project_options(projects)
                        options = ""
                        projects.each do |project|
                          project_options = "<optgroup id=#{project.id} title=\"#{h project.title}\" label=\"#{h truncate(project.title)}\">"
                          project.people.sort{|a,b| (a.last_name.nil? ? nil : a.last_name.capitalize) <=> (b.last_name.nil? ? nil : b.last_name.capitalize)}.each do |person|
                    Severity: Minor
                    Found in app/helpers/publications_helper.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

                    Method date_as_string has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def date_as_string date,show_time_of_day=false,year_only_1st_jan=false
                        #for publications, if it is the first of jan, then it can be assumed it is just the year (unlikely have a publication on New Years Day)
                        if (year_only_1st_jan && !date.blank? && date.month==1 && date.day==1)
                          str=date.year.to_s
                        else
                    Severity: Minor
                    Found in app/helpers/application_helper.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

                    Method associate_organism has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def associate_organism(organism,strain_id=nil,culture_growth_type=nil,tissue_and_cell_type_id="0",tissue_and_cell_type_title=nil)
                        organism = Organism.find(organism) if organism.kind_of?(Numeric) || organism.kind_of?(String)
                        strain=organism.strains.find_by_id(strain_id)
                        assay_organism=AssayOrganism.new(:assay=>self,:organism=>organism,:culture_growth_type=>culture_growth_type,:strain=>strain)
                    
                    
                    Severity: Minor
                    Found in app/models/assay.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

                    Method find_and_filter_workflows has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def find_and_filter_workflows
                        find_assets
                    
                        # Has the user cleared the search box? - return all items.
                        uploader = params[:uploader_id]
                    Severity: Minor
                    Found in app/controllers/workflows_controller.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

                    Method update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def update
                        @person.disciplines.clear if params[:discipline_ids].nil?
                    
                        # extra check required to see if any avatar was actually selected (or it remains to be the default one)
                        
                    Severity: Minor
                    Found in app/controllers/people_controller.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

                    Method check_for_override has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def check_for_override context, options
                          unless options[:seek_template].nil?
                            value = @@alternative_map[{:controller => context.controller_name, :seek_template => options[:seek_template].to_s}]
                            unless value.nil?
                              options[:template]=value
                    Severity: Minor
                    Found in lib/seek/seek_render_override.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