SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Function detect_browser has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

function detect_browser(){
    var browser = new Object();
    browser.name  = navigator.appName;
    browser.fullVersion  = ''+parseFloat(navigator.appVersion);
    browser.majorVersion = parseInt(navigator.appVersion,10);
Severity: Minor
Found in app/assets/javascripts/detect_browser.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 to_presentation_version has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def to_presentation_version
      Presentation::Version.new.tap do |presentation_version|
        presentation_version.attributes.keys.each do |attr|
          presentation_version.send("#{attr}=", send("#{attr}")) if respond_to? attr and attr!="id"
        end
Severity: Minor
Found in app/models/data_file.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 authorize_related_items has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def authorize_related_items(related)
    related.each do |key, res|
      res[:items].uniq!
      res[:items].compact!
      unless res[:items].empty?
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 filter_feeds_entries_with_chronological_order has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def filter_feeds_entries_with_chronological_order feeds, number_of_entries=10
    filtered_entries = []
    unless feeds.blank?
      feeds.each do |feed|
         entries = try_block{feed.entries}
Severity: Minor
Found in app/helpers/homes_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 recent_project_changes_hash has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def recent_project_changes_hash

    projects=current_user.person.projects
    
    people=Person.order('updated_at DESC')
Severity: Minor
Found in app/helpers/homes_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 process_permissions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def process_permissions permissions, resource_name, display_no_access=false
    #remove the permissions with access_type=NO_ACCESS
    permissions.select!{ |p| p.access_type != Policy::NO_ACCESS } unless display_no_access

    html = ''
Severity: Minor
Found in app/helpers/policy_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 update has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    data_file_ids = (params[:sample_data_file_ids].nil? ? [] : params[:sample_data_file_ids].reject(&:blank?)) || []
    model_ids = (params[:sample_model_ids].nil? ? [] : params[:sample_model_ids].reject(&:blank?)) || []
    sop_ids = (params[:sample_sop_ids].nil? ? [] : params[:sample_sop_ids].reject(&:blank?)) || []
    @sample.attributes = params[:sample]
Severity: Minor
Found in app/controllers/samples_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 15 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    # remove protected columns (including a "link" to content blob - actual data cannot be updated!)
    if params[:sop]
      [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
        params[:sop].delete(column_name)
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 builder_content has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def builder_content content_blob
          filepath=content_blob.filepath

          #this is necessary to get the correct filename and especially extension, which JWS relies on
          tmpfile = Tempfile.new([content_blob.original_filename,File.extname(content_blob.original_filename)])
Severity: Minor
Found in lib/seek/jws/builder.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_params_for_batch has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def update_params_for_batch(params)
        data = []
        data_urls = []
        original_filenames = []
        make_local_copy = []
Severity: Minor
Found in lib/seek/upload_handling/parameter_handling.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_db has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def populate_db data

      assay = nil
      assay_json = data["assay"]

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

    def initialize file, xml=nil, to_populate=true, institution_id = nil
      @file = file

      @investigation = nil
      @study = nil
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 spreadsheet_contents_for_search has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def spreadsheet_contents_for_search obj=self
        if obj.content_blob.is_extractable_spreadsheet?
          content = Rails.cache.fetch("#{obj.content_blob.cache_key}-ss-content-for-search") do
            begin
              xml=obj.spreadsheet_xml
Severity: Minor
Found in lib/seek/data/search_extraction.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 is_authorized? has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.is_authorized?(action, thing_type, thing, user=nil)

        # initially not authorized, so if all tests fail -
        # safe result of being not authorized will get returned
        is_authorized = false
Severity: Minor
Found in lib/seek/permissions/authorization.rb - About 1 hr to fix

    Function addSelected has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function addSelected(resource_type, source) {
        if (source == "target") {
            for(var key in checkedTargetMap[resource_type]) {
                if (allLinks[resource_type][key] == true) {
    
    
    Severity: Minor
    Found in app/assets/javascripts/link_adder.js - About 1 hr to fix

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

        def create
          @sample = Sample.new(params[:sample])
          # create new specimen only for combined form
          is_new_spec = params[:sample][:specimen_id].nil? ? true : false
      
      
      Severity: Minor
      Found in app/controllers/samples_controller.rb - About 1 hr to fix

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

          def update
        
            #FIXME: would be better to resolve the differences, rather than keep clearing and reading the assets and organisms
            #DOES resolve differences for assets now
            organisms             = params[:assay_organism_ids]||[]
        Severity: Minor
        Found in app/controllers/assays_controller.rb - About 1 hr to fix

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

            def create
              params[:assay_class_id] ||= AssayClass.for_type("experimental").id
              @assay        = Assay.new(params[:assay])
          
              organisms     = params[:assay_organism_ids] || []
          Severity: Minor
          Found in app/controllers/assays_controller.rb - About 1 hr to fix

            Method find_and_authorize_requested_item has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def find_and_authorize_requested_item
                begin
                  name = self.controller_name.singularize
                  action = translate_action(action_name)
            
            
            Severity: Minor
            Found in app/controllers/application_controller.rb - About 1 hr to fix

              Function addSelectedOrganism has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function addSelectedOrganism() {
                  selected_option_index=$("possible_organisms").selectedIndex;
                  selected_option=$("possible_organisms").options[selected_option_index];
                  title=selected_option.text;
                  id=selected_option.value;
              Severity: Minor
              Found in app/assets/javascripts/assays.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language