SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Method administer_update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def administer_update
    had_no_projects = @person.work_groups.empty?

    passed_params=    {:roles                 =>  User.admin_logged_in?,
                       :roles_mask            => User.admin_logged_in?,
Severity: Minor
Found in app/controllers/people_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 reset_password has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def reset_password
    user = User.find_by_reset_password_code(params[:reset_code] || "")

    respond_to do |format|
      if user
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 find_and_authorize_requested_item has a Cognitive Complexity of 19 (exceeds 5 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 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (specimen_table.length != 0){
        var selected_specimen_rows = fnGetSelected(specimen_table);
        for (var i=0; i< selected_specimen_rows.length; i++){
            var id_index = getAttributeColumn(specimen_table,"Seek ID");
            specimen_ids.push(specimen_table.fnGetData(selected_specimen_rows[i])[id_index+1]);
Severity: Major
Found in app/assets/javascripts/biosample.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/biosample.js on lines 51..57

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 85.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
        browser.name = "Opera";
        browser.fullVersion = nAgt.substring(verOffset+6);
        if ((verOffset=nAgt.indexOf("Version"))!=-1)
            browser.fullVersion = nAgt.substring(verOffset+8);
Severity: Major
Found in app/assets/javascripts/detect_browser.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/detect_browser.js on lines 34..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 85.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (strain_table && strain_table.length != 0){
        var selected_strain_rows = fnGetSelected(strain_table);
        for (var i=0; i< selected_strain_rows.length; i++){
            var id_index = getAttributeColumn(strain_table,"Seek ID");
            strain_ids.push(strain_table.fnGetData(selected_strain_rows[i])[id_index+1]);
Severity: Major
Found in app/assets/javascripts/biosample.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/biosample.js on lines 63..69

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 85.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
        browser.name = "Safari";
        browser.fullVersion = nAgt.substring(verOffset+7);
        if ((verOffset=nAgt.indexOf("Version"))!=-1)
            browser.fullVersion = nAgt.substring(verOffset+8);
Severity: Major
Found in app/assets/javascripts/detect_browser.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/detect_browser.js on lines 17..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 85.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      def self.included klass
        klass.class_eval do
          include ActsAsCachedTree
          after_update :touch_for_hierarchy_updates
          #add institution to ancestor projects
Severity: Major
Found in lib/seek/project_hierarchies/project_extension.rb - About 2 hrs to fix

    Function displayNormal has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function displayNormal() {
        var xmlHttp;
        try {  // Firefox, Opera 8.0+, Safari  
            xmlHttp = new XMLHttpRequest(); 
            if (xmlHttp.overrideMimeType) {
    Severity: Major
    Found in app/assets/javascripts/jws/webMathematica.js - About 2 hrs to fix

      Method new_or_update_mapping_links has 61 lines of code (exceeds 25 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: Major
      Found in lib/seek/factor_studied.rb - About 2 hrs to fix

        File publications_controller.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class PublicationsController < ApplicationController
          
          include IndexPager
          include DotGenerator
          include Seek::AssetsCommon
        Severity: Minor
        Found in app/controllers/publications_controller.rb - About 2 hrs to fix

          Method initialize_default_folders has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.initialize_default_folders project, yaml_path=File.join(Rails.root,"config","default_data","default_project_folders.yml")
              raise Exception.new("This #{I18n.t('project')} already has folders defined") unless ProjectFolder.root_folders(project).empty?
          
              yaml = YAML.load(ERB.new(File.read(yaml_path)).result)
              folders={}
          Severity: Minor
          Found in app/models/project_folder.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 uniq_people_permissions_and_privileged_people has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

            def uniq_people_permissions_and_privileged_people(permissions, privileged_people)
              uniq_permissions_by_contributor permissions
          
              people_from_permissions = permissions.select{|p| p.contributor_type == 'Person'}.collect(&:contributor)
          
          
          Severity: Minor
          Found in app/helpers/policy_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 18 (exceeds 5 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 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 update has a Cognitive Complexity of 18 (exceeds 5 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 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 update has a Cognitive Complexity of 18 (exceeds 5 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 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 paginate_after_fetch has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

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

          File config.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'simple_crypt'
          
          
          module Seek
          
          
          Severity: Minor
          Found in lib/seek/config.rb - About 2 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        for( var i = 0; i < subgraph.length; i++ ){
                            var depth = id2depth[ subgraph[i].id() ];
            
                            if( depth !== undefined ){
                                depths[depth].push( node );
            Severity: Major
            Found in app/assets/javascripts/modified_cytoscape.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/modified_cytoscape.js on lines 76..84

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 83.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        for( var i = 0; i < neighbors.length; i++ ){
                            var depth = id2depth[ neighbors[i].id() ];
            
                            if( depth !== undefined ){
                                depths[depth].push( node );
            Severity: Major
            Found in app/assets/javascripts/modified_cytoscape.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/modified_cytoscape.js on lines 99..107

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 83.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language