SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

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

  def create
    @person = Person.new(params[:person])

    redirect_action="new"

Severity: Minor
Found in app/controllers/people_controller.rb - About 1 hr to fix

    Method asset_report has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def asset_report
        @no_sidebar=true
        project_assets = @project.assets | @project.assays | @project.studies | @project.investigations
        @types=[DataFile,Model,Sop,Presentation,Investigation,Study,Assay]
        @public_assets = {}
    Severity: Minor
    Found in app/controllers/projects_controller.rb - About 1 hr to fix

      Method update has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def update
          valid = true
          unless params[:author].blank?
            person_ids = params[:author].values.reject {|id_string| id_string == ""}
            if person_ids.uniq.size == person_ids.size
      Severity: Minor
      Found in app/controllers/publications_controller.rb - About 1 hr to fix

        Function changeRowsPerPage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function changeRowsPerPage(){
            var current_href = window.location.href;
            if (current_href.endsWith('#'))
                current_href = current_href.substring(0,current_href.length-1);
        
        
        Severity: Minor
        Found in app/assets/javascripts/spreadsheet_explorer.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 updateRoles has a Cognitive Complexity of 14 (exceeds 5 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

        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 work_group_groups_for_selection has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def work_group_groups_for_selection(person)
            options = []
            last_project=nil
            #if current_user is project manager and not admin, load work_groups of projects he is in
            if project_manager_logged_in? && !admin_logged_in? && !Seek::Config.is_virtualliver
        Severity: Minor
        Found in app/helpers/work_groups_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 image_tag_for_key has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def image_tag_for_key(key, url=nil, alt=nil, html_options={}, label=key.humanize, remote=false, size=nil)
        
            label = 'Delete' if label == 'Destroy'
            
            return nil unless (filename = icon_filename_for_key(key.downcase))
        Severity: Minor
        Found in app/helpers/images_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 create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
            unless params[:avatar].blank? || params[:avatar][:image_file].blank?
              file_specified = true
              
              # the creation of the new Avatar instance needs to have only one parameter - therefore, the rest should be set separately
        Severity: Minor
        Found in app/controllers/avatars_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 project_membership_required has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def project_membership_required
            unless User.logged_in_and_member? || User.admin_logged_in?
              flash[:error] = "Only members of known projects, institutions or work groups are allowed to create new content."
              respond_to do |format|
                format.html do          
        Severity: Minor
        Found in app/controllers/application_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 get_and_process_file has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_and_process_file from_url=true,from_jerm=false
            if from_url
              data_hash = get_data_hash_from_url
              #delete the previous conversion to refresh, but only if a copy of the original exists
              pdf_path = @content_blob.filepath("pdf")
        Severity: Minor
        Found in app/controllers/content_blobs_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 all_authorized_for has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                def all_authorized_for action, user=User.current_user, projects=nil, filter_by_permissions=true
                  projects=Array(projects) unless projects.nil?
                  user_id = user.nil? ? 0 : user.id
                  assets = []
                  programatic_project_filter = !projects.nil? && (!Seek::Config.auth_lookup_enabled || (self==Assay || self==Study))
        Severity: Minor
        Found in lib/seek/permissions/policy_based_authorization.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 create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

           def create
               unless params[:model_image].blank? || params[:model_image][:image_file].blank?
                 file_specified = true
                 @model_image = ModelImage.new params[:model_image]
                 @model_image.model_id = params[:model_id]
        Severity: Minor
        Found in app/controllers/model_images_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 build_assay_mock_json has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_assay_mock_json sheet
        
              if @assay_mapping[:parsing_direction] == "horizontal"
                mapped_field_hunter = method(:hunt_for_horizontal_field_value_mapped)
              else
        Severity: Minor
        Found in lib/seek/data/bio_samples.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 destroy_version has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

                def destroy_version(version_number)
                  if (ver = find_version(version_number))
                    without_update_callbacks do
                      # For fault tolerance (ie: to prevent data loss through premature deletion), first...
                      # Check to see if the current (aka latest) version has to be deleted,
        Severity: Minor
        Found in lib/explicit_versioning.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 build_all_bio_sample_json has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_all_bio_sample_json sheet
        
              # population order should NOT change, DB is populated only if @to_populate is set to be true
        
              # probing number of rows with data in sheet
        Severity: Minor
        Found in lib/seek/data/bio_samples.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 paginate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def paginate(*args)
              options=args.pop unless args.nil?
              options ||= {}                
        
              default_page = options[:default_page] || @default_page
        Severity: Minor
        Found in lib/grouped_pagination.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

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

            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

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