SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Method new has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def new
    @assay=Assay.new
    @assay.create_from_asset = params[:create_from_asset]
    study = Study.find(params[:study_id]) if params[:study_id]
    @assay.study = study if params[:study_id] if study.try :can_edit?
Severity: Minor
Found in app/controllers/assays_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 create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def create    

    if handle_upload_data
      @sop = Sop.new(params[:sop])
      @sop.policy.set_attributes_with_sharing params[:sharing], @sop.projects
Severity: Minor
Found in app/controllers/sops_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 destroy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy
    object=params[:class].capitalize.constantize.find(params[:id])
    if object && object.is_a?(Sample)
       specimen = object.specimen
       id_column = Seek::Config.is_virtualliver ? 8 : 6
Severity: Minor
Found in app/controllers/biosamples_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 filter_size has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def filter_size size
    max_size=1500
    matches = size.match /([0-9]+)x([0-9]+).*/
    if matches
      width = matches[1].to_i
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 auth has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def auth
      # Skip certain auth if run is embedded
      if @run.embedded
        if ['cancel','read_interaction','write_interaction'].include?(action_name)
          return true
Severity: Minor
Found in app/controllers/taverna_player/runs_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 uri_for_object has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.uri_for_object(resource_obj, *args)
      options = args.extract_options!
      # defaults:
      options.reverse_merge!(:params => nil,
                             :sub_path => nil)
Severity: Minor
Found in lib/seek/api.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 add_roles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def add_roles roles
      new_mask = self.roles_mask || 0
      roles.each do |role_details|
        rolename = role_details[0]
        raise UnknownRoleException.new("Unrecognised role name #{rolename}") unless ROLES.include?(rolename)
Severity: Minor
Found in lib/seek/admin_defined_roles.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 updateModels has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateModels() {
    model_text='<ul class="related_asset_list">';
    type="Model";
    model_ids=new Array();

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

    Function updateDataFiles has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function updatePublications has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function updatePublications() {
          publication_text='<ul class="related_asset_list">'
          
          for (var i=0;i<publication_array.length;i++) {        
              publication=publication_array[i];
      Severity: Minor
      Found in app/assets/javascripts/publication.js - About 1 hr to fix

        Method populate_assay has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def populate_assay assay_json, filename
        
              investigation_title = assay_json["investigation title"]
              assay_type_title = assay_json["assay type title"]
              study_title = assay_json["study title"]
        Severity: Minor
        Found in lib/seek/data/bio_samples.rb - About 1 hr to fix

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

                def self.included klass
                  klass.class_eval do
                    include Seek::Search::CommonFields
          
                    searchable do
          Severity: Minor
          Found in lib/seek/search/search_sunspot.rb - About 1 hr to fix

            Function parse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function parse(nodes, tree, id) {
                    for (var i = 0; i < nodes.length; i++) {
                        if (1 != nodes[i].nodeType) {
                            continue;
                        }
            Severity: Minor
            Found in app/assets/javascripts/dropMenu.js - About 1 hr to fix

              Function updateSops has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function updateSops() {
                  sop_text='<ul class="related_asset_list">';
              
                  sop_ids=new Array();
              
              
              Severity: Minor
              Found in app/assets/javascripts/assays.js - About 1 hr to fix

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

                  def create
                    if handle_upload_data
                      @presentation = Presentation.new(params[:presentation])
                
                      @presentation.policy.set_attributes_with_sharing params[:sharing], @presentation.projects
                Severity: Minor
                Found in app/controllers/presentations_controller.rb - About 1 hr to fix

                  Method perform_search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def perform_search
                      @search_query = params[:search_query]
                      @search=@search_query # used for logging, and logs the origin search query - see ApplicationController#log_event
                      @search_query||=""
                      @search_type = params[:search_type]
                  Severity: Minor
                  Found in app/controllers/search_controller.rb - About 1 hr to fix

                    Method edit_tag has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def edit_tag
                        if request.post?
                          @tag=TextValue.find(params[:id])
                          replacement_tags = []
                    
                    
                    Severity: Minor
                    Found in app/controllers/admins_controller.rb - About 1 hr to fix

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

                        def create
                          @publication = Publication.new(params[:publication])
                          @publication.pubmed_id=nil if @publication.pubmed_id.blank?
                          @publication.doi=nil if @publication.doi.blank?
                          pubmed_id,doi = preprocess_doi_or_pubmed @publication.pubmed_id,@publication.doi
                      Severity: Minor
                      Found in app/controllers/publications_controller.rb - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                  unless sample.specimen == specimen &&
                                      sample.sample_type == sample_type &&
                                      (sample.tissue_and_cell_types.member?(tissue_and_cell_type) || tissue_and_cell_type_title == "") &&
                                      sample.donation_date == Time.zone.parse(donation_date).utc &&
                                      sample.institution == institution &&
                        Severity: Critical
                        Found in lib/seek/data/bio_samples.rb - About 1 hr to fix

                          Function init has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  var init = function(){
                                      // merge user-supplied options with the defaults
                                      slider.settings = $.extend({}, defaults, options);
                                      // parse slideWidth setting
                                      slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
                          Severity: Minor
                          Found in app/assets/javascripts/jquery.bxslider.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language