SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Method create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    topic_saved, post_saved = false, false
        # this is icky - move the topic/first post workings into the topic model?
    Topic.transaction do
        @topic  = @forum.topics.build(:title => params[:topic][:title])
Severity: Minor
Found in app/controllers/topics_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 10 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @suggested_assay_type = SuggestedAssayType.new(params[:suggested_assay_type])
    @suggested_assay_type.contributor_id= User.current_user.try(:person_id)
    saved = @suggested_assay_type.save
    if @suggested_assay_type.link_from == "assays"
Severity: Minor
Found in app/controllers/suggested_assay_types_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 fetch_item has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def fetch_item item_id
        yaml = Rails.cache.fetch("biomodels_search_#{item_id}") do
          connection = SysMODB::SearchBiomodel.instance
          biomodel_result = connection.getSimpleModel(item_id)
          unless biomodel_result.blank?
Severity: Minor
Found in lib/seek/biomodels_search/search_biomodels_adaptor.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 10 (exceeds 5 allowed). Consider refactoring.
Open

   def create
      compound = params[:compound]
      compound_name =  compound[:title]

        unless compound_name.blank?
Severity: Minor
Found in app/controllers/compounds_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 10 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @study = Study.new(params[:study])

    @study.policy.set_attributes_with_sharing params[:sharing], @study.projects

Severity: Minor
Found in app/controllers/studies_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 10 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    @suggested_assay_type=SuggestedAssayType.find(params[:id])
    @suggested_assay_type.attributes = params[:suggested_assay_type]
    saved = @suggested_assay_type.save
    if params[:commit_popup]
Severity: Minor
Found in app/controllers/suggested_assay_types_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 find_display_asset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def find_display_asset asset=eval("@#{self.controller_name.singularize}");
      name = asset.class.name.underscore
      if asset
          #if no version is specified, show the latest version
          #otherwise, show the specified version, if (this version is correct for login and project member user or if (this is the latest version and the user doesn't login or is not project member')
Severity: Minor
Found in lib/seek/assets_common.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 log_publishing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def log_publishing
        User.with_current_user current_user do
          c = self.controller_name.downcase
          a = self.action_name.downcase

Severity: Minor
Found in lib/seek/publishing/publishing_common.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 determine_filename has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def determine_filename f            
      return @@filename_cache[f.base_uri] unless @@filename_cache[f.base_uri].nil?      
      disp=f.meta["content-disposition"]
      result=nil
      unless disp.nil?        
Severity: Minor
Found in lib/seek/remote_downloader.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 read has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def read ( how_much = nil )
    how_much ||= size
    if @part_no >= @parts.size
      return nil;
    end
Severity: Minor
Found in lib/multipart.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 remove_roles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_roles roles
      new_mask = self.roles_mask
      roles.each do |role_details|
        rolename = role_details[0]
        project_ids = Array(role_details[1]).collect{|p| p.is_a?(Project) ? p.id : p.to_i}
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

Method populate_assay has a Cognitive Complexity of 10 (exceeds 5 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

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

        def update_version(version_number_to_update, attributes)
          return false if version_number_to_update.nil? or version_number_to_update.to_i < 1
          return false if attributes.nil? or attributes.empty?
          return false unless (ver = find_version(version_number_to_update))

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

  def matching_models

    results = {}

    if Seek::Config.solr_enabled && contains_extractable_spreadsheet?
Severity: Minor
Found in app/models/data_file.rb - About 1 hr to fix

    Function initTicker has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            var initTicker = function(){
                var startPosition = 0;
                // if autoDirection is "next", append a clone of the entire slider
                if(slider.settings.autoDirection == 'next'){
                    el.append(slider.children.clone().addClass('bx-clone'));
    Severity: Minor
    Found in app/assets/javascripts/jquery.bxslider.js - About 1 hr to fix

      Function tipShow has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          tipShow : function() {        
              var scrX = Number(this.xCord);
              var scrY = Number(this.yCord);
              var tp = parseInt(scrY+15);
              var lt = parseInt(scrX+10);
      Severity: Minor
      Found in app/assets/javascripts/jws/sweetTitles.js - About 1 hr to fix

        Function imageSwapZoomOut has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function imageSwapZoomOut(curImage, newImage) {
                    $(curImage).css({'opacity':'1'});
                    $(newImage).css({'opacity':'0'});
                    $(newImage).css({'height':'250%', 'marginLeft':'-120px', 'marginTop':'-222px'});
                    $(curImage).css({'display':'inline'});
        Severity: Minor
        Found in app/assets/javascripts/scales/scales.js - About 1 hr to fix

          Function onkeydown has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            this.onkeydown = function(e) {
              if (!this.navigationActive) return;
              switch(e.keyCode) {
                case 37: //Event.KEY_LEFT:
                  if (this.moveLeft()) e.preventDefault();
          Severity: Minor
          Found in doc/seek/js/navigation.js - About 1 hr to fix

            Method to_presentation has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def to_presentation
                presentation_attrs = attributes.delete_if { |k, v| !(::Presentation.new.attributes.include?(k))}
            
                Presentation.new(presentation_attrs).tap do |presentation|
                  DataFile.reflect_on_all_associations.select { |a| [:has_many, :has_and_belongs_to_many, :has_one].include?(a.macro) && !a.through_reflection }.each do |a|
            Severity: Minor
            Found in app/models/data_file.rb - About 1 hr to fix

              Function changeRowsPerPage has 27 lines of code (exceeds 25 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
                Severity
                Category
                Status
                Source
                Language