SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Function addAll has a Cognitive Complexity of 16 (exceeds 5 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 2 hrs 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 samples_link_list has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def samples_link_list samples
    #FIXME: make more generic and share with other model link list helper methods
    samples=samples.select{|s| !s.nil?} #remove nil items
    return "<span class='none_text'>Not Specified</span>".html_safe if samples.empty?

Severity: Minor
Found in app/helpers/samples_helper.rb - About 2 hrs 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 16 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    if handle_upload_data

      @workflow = Workflow.new params[:workflow]
      @workflow.policy.set_attributes_with_sharing params[:sharing], @workflow.projects
Severity: Minor
Found in app/controllers/workflows_controller.rb - About 2 hrs 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 upload_from_email has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def upload_from_email
    if current_user.is_admin? && Seek::Config.admin_impersonation_enabled
      User.with_current_user Person.find(params[:sender_id]).user do
        if handle_upload_data
          @data_file = DataFile.new params[:data_file]
Severity: Minor
Found in app/controllers/data_files_controller.rb - About 2 hrs 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 open_id_authentication has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def open_id_authentication(identity_url)
    # Pass optional :required and :optional keys to specify what sreg fields you want.
    # Be sure to yield registration, a third argument in the #authenticate_with_open_id block.
    authenticate_with_open_id(identity_url,        
        :required => [:email, :fullname,
Severity: Minor
Found in app/controllers/users_controller.rb - About 2 hrs 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_selected_projects has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def get_selected_projects project_ids, resource_name
    if (resource_name == 'study') and (!project_ids.blank?)
      investigation = Investigation.find_by_id(project_ids.to_i)
      projects = investigation.nil? ? [] : investigation.projects

Severity: Minor
Found in app/controllers/policies_controller.rb - About 2 hrs 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_policy_data has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def send_policy_data
    request_type = white_list(params[:policy_type])
    entity_type = white_list(params[:entity_type])
    entity_id = white_list(params[:entity_id])
    
Severity: Minor
Found in app/controllers/policies_controller.rb - About 2 hrs 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 managers has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def managers
        #FIXME: how to handle projects as contributors - return all people or just specific people (pals or other role)?
        people=[]
        unless self.contributor.nil?
          people << self.contributor.person if self.contributor.kind_of?(User)
Severity: Minor
Found in lib/seek/permissions/policy_based_authorization.rb - About 2 hrs 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 tag_with has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def tag_with tags, attr="tag", owner=User.current_user,owned_tags_only=false
      tags = Array(tags)
      #FIXME: yuck! - this is required so that self has an id and can be assigned to an Annotation.annotatable
      return if self.new_record? && !self.save

Severity: Minor
Found in lib/seek/taggable.rb - About 2 hrs 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 handle_download has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_download disposition='attachment', image_size=nil
      if @content_blob.url.blank?
        if @content_blob.file_exists?
          if image_size && @content_blob.is_image?
            @content_blob.copy_image
Severity: Minor
Found in lib/seek/content_blob_common.rb - About 2 hrs 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 new_or_update_mapping_links has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def new_or_update_mapping_links compound, compound_annotation
    #create the mappings and mapping_links
     sabiork_id = compound_annotation["sabiork_id"]
     chebi_ids = compound_annotation["chebi_ids"]
     kegg_ids = compound_annotation["kegg_ids"]
Severity: Minor
Found in lib/seek/factor_studied.rb - About 2 hrs 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_breadcrumbs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def add_breadcrumbs
      #Home
      add_breadcrumb "Home", :root_path
      #process for nested attributes
      if controller_name == 'studied_factors'
Severity: Minor
Found in lib/seek/breadcrumbs.rb - About 2 hrs 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 parse_xml_with_extension has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_xml_with_extension(article)
          doi_record = parse_xml_without_extension(article)
          begin
            #bug fix for empty/missing book title
            doi_record.journal ||= article.find_first("//book_metadata/titles/title").try(&:content)
Severity: Minor
Found in lib/doi_query_tool_extension.rb - About 2 hrs 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 duesseldorf_bode_mapping has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def duesseldorf_bode_mapping

      concentration_regex = /(\d*,?\.?\d*).*/
      gene_modification_regex = /([\w\d]+)([\/+-]+)/

Severity: Minor
Found in lib/seek/parser_mapper.rb - About 2 hrs 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 detect_browser has 50 lines of code (exceeds 25 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 2 hrs to fix

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

      def update
        group_name = white_list(params[:favourite_group_name])
        found = FavouriteGroup.where(:name => group_name, :user_id => current_user.id).first
        
        # if the found group with the same is the current one - that's fine; otherwise - can't rename a group with such new name 
    Severity: Minor
    Found in app/controllers/favourite_groups_controller.rb - About 2 hrs to fix

      Method explicit_versioning has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def explicit_versioning(options = {}, &extension)
                # don't allow multiple calls
                return if self.included_modules.include?(Jits::Acts::ExplicitVersioning::ActMethods)
      
                send :include, Jits::Acts::ExplicitVersioning::ActMethods
      Severity: Minor
      Found in lib/explicit_versioning.rb - About 2 hrs to fix

        Method jena_mapping has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def jena_mapping
              {
                  :name => "jena",
                  :data_row_offset => 2,
        
        
        Severity: Minor
        Found in lib/seek/parser_mapper.rb - About 1 hr to fix

          Method empty_mapping has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def empty_mapping # defines basic mapping to start with, not that useful for the real parsing business ;-)
                {
                    :name => "",
                    :data_row_offset => 1, # add this to the row of a header column to get to row with the first data element
          
          
          Severity: Minor
          Found in lib/seek/parser_mapper.rb - About 1 hr to fix

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

            function validateResourceFields(is_new_file, resource_name, is_managed) {
                // check if sharing rights are defined
                if (!($(document.getElementById('sharing_scope_0')).checked) &&
                    !($(document.getElementById('sharing_scope_2')).checked) &&
                    !($(document.getElementById('sharing_scope_4')).checked))
            Severity: Minor
            Found in app/assets/javascripts/resource.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

            Severity
            Category
            Status
            Source
            Language