SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

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

  def create
    @person = Person.new(params[:person])

    redirect_action="new"

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

  def set_runlet_parameters

    shared_input_values_for_all_runs = params[:sweep].delete(:shared_input_values_for_all_runs)
    params[:sweep][:runs_attributes].each_with_index do |(run_id, run_attributes), iteration_index|
      run_attributes[:workflow_id] = params[:sweep][:workflow_id]
Severity: Minor
Found in app/controllers/sweeps_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 add has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def add
    if request.post?
      if params[:id]=="drag_search" #needs to create the SavedSearch resource first
        saved_search = SavedSearch.new(:user_id => current_user.id, :search_query => params[:search_query], :search_type => params[:search_type],:include_external_search=>params[:include_external_search]=="1")
        if SavedSearch.find_by_user_id_and_search_query_and_search_type_and_include_external_search(current_user,params[:search_query],params[:search_type],params[:include_external_search]=="1").nil? && saved_search.save
Severity: Minor
Found in app/controllers/favourites_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_rdf has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        def update_rdf(item)
          if configured?
            connect_to_repository
            graphs = rdf_graph_uris(item)
            rdf_file_path = last_rdf_file_path(item)
Severity: Minor
Found in lib/seek/rdf/rdf_repository.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 20 (exceeds 5 allowed). Consider refactoring.
Open

      def update
        raise Exception.new("No ID") if seek_id.blank?
        person_record=Person.find_by_id(seek_id)
        raise Exception.new("Unable to find person with ID: #{seek_id}") if person_record.nil?
        raise Exception.new("Person is not a member of Translucent") unless person_record.projects.include?(@project)  
Severity: Minor
Found in lib/jerm/translucent_person_harvester.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 prototype has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Search.prototype = $.extend({}, Navigation, new function() {
  var suid = 1;

  this.init = function() {
    var _this = this;
Severity: Major
Found in doc/seek/js/search.js - About 2 hrs to fix

    File policy_based_authorization.rb has 280 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'project_compat'
    module Seek
      module Permissions
        module PolicyBasedAuthorization
    
    
    Severity: Minor
    Found in lib/seek/permissions/policy_based_authorization.rb - About 2 hrs to fix

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

      function check_show_add_event() {
          i = $('possible_events').selectedIndex;
          selected_id = $('possible_events').options[i].value;
          if (selected_id == '0') {
              $('add_event_link').hide();
      Severity: Major
      Found in app/assets/javascripts/associate_events.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/assays.js on lines 289..298

      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 89.

      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

      function check_show_add_assay() {
          i = $('possible_assays').selectedIndex;
          selected_id = $('possible_assays').options[i].value;
          if (selected_id == '0') {
              $('add_assay_link').hide();
      Severity: Major
      Found in app/assets/javascripts/assays.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/associate_events.js on lines 2..11

      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 89.

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

            def acts_as_asset
              attr_accessor :parent_name
              include Seek::Taggable
      
              acts_as_scalable
      Severity: Major
      Found in lib/acts_as_asset.rb - About 2 hrs to fix

        Class Assay has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Assay < ActiveRecord::Base
        
          include Seek::Rdf::RdfGeneration
          include Seek::OntologyTypeHandling
          include Seek::OntologyExtensionWithSuggestedType
        Severity: Minor
        Found in app/models/assay.rb - About 2 hrs to fix

          Method get_stats has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def get_stats
              collection = []
              type = nil
              title = nil
              @page=params[:id]
          Severity: Major
          Found in app/controllers/admins_controller.rb - About 2 hrs to fix

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

                            if( !drawAll ){
                                context.setTransform(1, 0, 0, 1, 0, 0);
                                context.clearRect(0, 0, context.canvas.width, context.canvas.height);
            
                                context.translate(effectivePan.x, effectivePan.y);
            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 651..657

            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 87.

            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 3 locations. Consider refactoring.
            Open

                                    context.strokeStyle = "rgba("
                                        + coreStyle["selection-box-border-color"].value[0] + ","
                                        + coreStyle["selection-box-border-color"].value[1] + ","
                                        + coreStyle["selection-box-border-color"].value[2] + ","
                                        + coreStyle["selection-box-opacity"].value + ")";
            Severity: Major
            Found in app/assets/javascripts/modified_cytoscape.js and 2 other locations - About 2 hrs to fix
            app/assets/javascripts/modified_cytoscape.js on lines 725..729
            app/assets/javascripts/modified_cytoscape.js on lines 756..760

            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 87.

            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 3 locations. Consider refactoring.
            Open

                                context.fillStyle = "rgba("
                                    + coreStyle["active-bg-color"].value[0] + ","
                                    + coreStyle["active-bg-color"].value[1] + ","
                                    + coreStyle["active-bg-color"].value[2] + ","
                                    + coreStyle["active-bg-opacity"].value + ")";
            Severity: Major
            Found in app/assets/javascripts/modified_cytoscape.js and 2 other locations - About 2 hrs to fix
            app/assets/javascripts/modified_cytoscape.js on lines 725..729
            app/assets/javascripts/modified_cytoscape.js on lines 738..742

            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 87.

            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

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

                            if( !drawAll ){
                                context.setTransform(1, 0, 0, 1, 0, 0);
                                context.clearRect(0, 0, context.canvas.width, context.canvas.height);
            
                                context.translate(effectivePan.x, effectivePan.y);
            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 704..710

            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 87.

            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 3 locations. Consider refactoring.
            Open

                                context.fillStyle = "rgba("
                                    + coreStyle["selection-box-color"].value[0] + ","
                                    + coreStyle["selection-box-color"].value[1] + ","
                                    + coreStyle["selection-box-color"].value[2] + ","
                                    + coreStyle["selection-box-opacity"].value + ")";
            Severity: Major
            Found in app/assets/javascripts/modified_cytoscape.js and 2 other locations - About 2 hrs to fix
            app/assets/javascripts/modified_cytoscape.js on lines 738..742
            app/assets/javascripts/modified_cytoscape.js on lines 756..760

            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 87.

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

              def associate_tissue_and_cell_type tissue_and_cell_type_id,tissue_and_cell_type_title
                   tissue_and_cell_type=nil
                if !tissue_and_cell_type_title.blank?
                  if ( tissue_and_cell_type_id =="0" )
                      found = TissueAndCellType.where(:title => tissue_and_cell_type_title).first
            Severity: Minor
            Found in app/models/sample.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 19 (exceeds 5 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 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

            Severity
            Category
            Status
            Source
            Language