SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Function setPositionProperty has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        var setPositionProperty = function(value, type, duration, params){
            // use CSS transform
            if(slider.usingCSS){
                // determine the translate3d value
                var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
Severity: Minor
Found in app/assets/javascripts/jquery.bxslider.js - About 1 hr to fix

    Function generate_json_data has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function generate_json_data() {
        var cells = $j('td.selected_cell');
        var columns = $j('.col_heading.selected_heading').size();
        var headings;
        var rows = new Array();
    Severity: Minor
    Found in app/assets/javascripts/spreadsheet_explorer_plot.js - About 1 hr to fix

      Method avatar has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def avatar(object, size=200, return_image_tag_only=false, url=nil, alt=nil, show_tooltip=true)
          alternative = ""
          title = get_object_title(object)
          if show_tooltip
            tooltip_text = (alt.nil? ? h(title) : alt)
      Severity: Minor
      Found in app/helpers/avatars_helper.rb - About 1 hr to fix

        Method indented_tree_child_options has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def indented_tree_child_options parent, depth=0, show_edit=true, show_delete=true, selected_id=nil, related_resource_type="Person",selected_display_items=nil, foldable=true
            result = []
            unless parent.children.empty?
              parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|
                display_style = (foldable==true) ? "display:none" : "display:block"
        Severity: Minor
        Found in app/helpers/projects_helper.rb - About 1 hr to fix

          Method fetch_preview has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def fetch_preview
              #trim the PubMed or Doi Id
              params[:key] = params[:key].strip() unless params[:key].blank?
              params[:publication][:project_ids].reject!(&:blank?).map! { |id| id.split(',') }.flatten!
              @publication = Publication.new(params[:publication])
          Severity: Minor
          Found in app/controllers/publications_controller.rb - About 1 hr to fix

            Method included has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.included(base)
                  raise "Only People can have roles" unless base==Person
            
                  base.extend(ClassMethods)
                  ROLES.each do |role|
            Severity: Minor
            Found in lib/seek/admin_defined_roles.rb - About 1 hr to fix

              Function updateOrganisms has a Cognitive Complexity of 12 (exceeds 5 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: Minor
              Found in app/assets/javascripts/assays.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

              Function toggleDynamicMenu has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

              function toggleDynamicMenu(element) {
              
                  function documentClickedHandler(event) {
                      if (!event.element().hasClassName("dynamic_menu_li")) {
                          switch (event.element().id) {
              Severity: Minor
              Found in app/assets/javascripts/dynamic_menu.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 send_announcement_emails has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def send_announcement_emails site_announcement, from_notifiee_id
                  if Seek::Config.email_enabled
                    NotifieeInfo.where(["id IN (?) AND receive_notifications=?", (from_notifiee_id .. (from_notifiee_id + BATCHSIZE)), true]).each do |notifiee_info|
                      begin
                        unless notifiee_info.notifiee.nil?
              Severity: Minor
              Found in app/jobs/send_announcement_emails_job.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 process_queue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def process_queue
                  #including item_type in the order, encourages assets to be processed before users (since they are much quicker), due to tha happy coincidence
                  #that User falls last alphabetically. Its not that important if a new authorized type is added after User in the future.
                  todo = AuthLookupUpdateQueue.order("priority,item_type,id").limit(BATCHSIZE).collect do |queued|
                    todo = queued.item
              Severity: Minor
              Found in app/jobs/auth_lookup_update_job.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_uniqueness_of_identifier_within_project has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def check_uniqueness_of_identifier_within_project
                  if !doi.blank?
                    existing = Publication.find_all_by_doi(doi) - [self]
                    if !existing.empty?
                      matching_projects = existing.collect(&:projects).flatten.uniq & projects
              Severity: Minor
              Found in app/models/publication.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 list_item_visibility has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def list_item_visibility item,css_class="visibility_icon"
                  title = ""
                  html  = ""
                  policy = item.policy
              
              
              Severity: Minor
              Found in app/helpers/resource_list_item_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 value_for_key has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def value_for_key config_for_key, object
                  facet_values = []
                  value_from = config_for_key['value_from']
                  value_from.split(',').each do |from|
                    facet_value = object
              Severity: Minor
              Found in app/helpers/faceted_browsing_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 windowed_pagination_links has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def windowed_pagination_links(pagingEnum, options)
                  link_to_current_page = options[:link_to_current_page]
                  always_show_anchors = options[:always_show_anchors]
                  padding = options[:window_size]
              
              
              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 file_extension has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def file_extension
                    if metadata.nil?
                      nil
                    else
                      if metadata[:type].is_a?(Array)
              Severity: Minor
              Found in app/models/taverna_player/run_port.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 concat_roles_to_name has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def concat_roles_to_name grouped_people_by_access_type, creators, asset_managers
                  creator_id_array = creators.collect{|c| c.id unless c.blank?}
                  asset_manage_id_array = asset_managers.collect{|am| am.id unless am.blank?}
                   grouped_people_by_access_type = grouped_people_by_access_type.reject{|key,value| key == Policy::DETERMINED_BY_GROUP}.each_value do |value|
                     value.each do |person|
              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 builder has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def builder
                  saved_file=params[:saved_file]
                  error=nil
                  supported=false
                  begin
              Severity: Minor
              Found in app/controllers/models_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 extract_workflow_metadata has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def extract_workflow_metadata
                  @t2flow = T2Flow::Parser.new.parse(@workflow.content_blob.data_io_object.read)
              
                  @workflow.title = @t2flow.annotations.titles.last unless @t2flow.annotations.titles.last.blank?
                  @workflow.description = @t2flow.annotations.descriptions.last
              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 preview_permissions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def preview_permissions
                    policy = sharing_params_to_policy
                    current_person = User.current_user.try(:person)
                    contributor_person = (params['is_new_file'] == 'false') ?  User.find_by_id(params['contributor_id'].to_i).try(:person) : current_person
                    creators = (params["creators"].blank? ? [] : ActiveSupport::JSON.decode(params["creators"])).uniq
              Severity: Minor
              Found in app/controllers/policies_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 index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  if (params[:discipline_id])
                    @discipline=Discipline.find(params[:discipline_id])
                    #FIXME: strips out the disciplines that don't match
                    @people=Person.where(["disciplines.id=?",@discipline.id]).includes(:disciplines)
              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

              Severity
              Category
              Status
              Source
              Language