SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Method parse_spreadsheet_xml has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_spreadsheet_xml(spreadsheet_xml)
        workbook = Workbook.new

        doc = LibXML::XML::Parser.string(spreadsheet_xml).parse
        doc.root.namespaces.default_prefix="ss"
Severity: Minor
Found in lib/seek/data/spreadsheet_explorer_representation.rb - About 3 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 populate has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def populate      
      begin
        @translucent_id = @node.find_first("id").content unless @node.find_first("id").nil?
        @author_seek_id = @node.find_first("submitter").content unless @node.find_first("submitter").nil?
        if @type=="Model"
Severity: Minor
Found in lib/jerm/translucent_resource.rb - About 3 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

Class Publication has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class Publication < ActiveRecord::Base
  include Seek::Rdf::RdfGeneration
  title_trimmer
  alias_attribute :description, :abstract
  #searchable must come before acts_as_asset is called
Severity: Minor
Found in app/models/publication.rb - About 3 hrs to fix

    Class Workflow has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Workflow < ActiveRecord::Base
    
      acts_as_asset
    
      scope :default_order, order('title')
    Severity: Minor
    Found in app/models/workflow.rb - About 3 hrs to fix

      Class ModelsController has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class ModelsController < ApplicationController
      
        include WhiteListHelper
        include IndexPager
        include DotGenerator
      Severity: Minor
      Found in app/controllers/models_controller.rb - About 3 hrs to fix

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

                        for (var index = 0; index < elesNotInDragLayer.length; index++) {
                            element = elesNotInDragLayer[index];
        
                            if (element._private.group == "nodes") {
                                r.drawNode(context, element);
        Severity: Major
        Found in app/assets/javascripts/modified_cytoscape.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/modified_cytoscape.js on lines 667..675

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

        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 index = 0; index < elesInDragLayer.length; index++) {
                            element = elesInDragLayer[index];
        
                            if (element._private.group == "nodes") {
                                r.drawNode(context, element);
        Severity: Major
        Found in app/assets/javascripts/modified_cytoscape.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/modified_cytoscape.js on lines 598..607

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

        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

          def update
              @experimental_condition = ExperimentalCondition.find(params[:id])
        
              new_substances = params["#{@experimental_condition.id}_substance_autocompleter_unrecognized_items"] || []
              known_substance_ids_and_types = params["#{@experimental_condition.id}_substance_autocompleter_selected_ids"] || []
        Severity: Major
        Found in app/controllers/experimental_conditions_controller.rb and 1 other location - About 3 hrs to fix
        app/controllers/studied_factors_controller.rb on lines 100..127

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

        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

          def update
            @studied_factor = StudiedFactor.find(params[:id])
        
            new_substances = params["#{@studied_factor.id}_substance_autocompleter_unrecognized_items"] || []
            known_substance_ids_and_types = params["#{@studied_factor.id}_substance_autocompleter_selected_ids"] || []
        Severity: Major
        Found in app/controllers/studied_factors_controller.rb and 1 other location - About 3 hrs to fix
        app/controllers/experimental_conditions_controller.rb on lines 97..124

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

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

          def self.add_items_to_queue items, t=5.seconds.from_now, priority=0, queuepriority=priority
            if Seek::Config.auth_lookup_enabled
        
              items = [items] if items.nil?
              items = Array(items)
        Severity: Minor
        Found in app/jobs/auth_lookup_update_job.rb - About 3 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 a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        Search.prototype = $.extend({}, Navigation, new function() {
          var suid = 1;
        
          this.init = function() {
            var _this = this;
        Severity: Minor
        Found in doc/seek/js/search.js - About 3 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 authorized_list has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          def authorized_list all_items, attribute, sort=true, max_length=75, count_hidden_items=false
            items = all_items.select &:can_view?
            if Seek::Config.is_virtualliver
              title_only_items = (all_items - items).select &:title_is_public?
            else
        Severity: Minor
        Found in app/helpers/application_helper.rb - About 3 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 asset_report has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          def asset_report
            @no_sidebar=true
            project_assets = @project.assets | @project.assays | @project.studies | @project.investigations
            @types=[DataFile,Model,Sop,Presentation,Investigation,Study,Assay]
            @public_assets = {}
        Severity: Minor
        Found in app/controllers/projects_controller.rb - About 3 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 sharing_params_to_policy has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          def sharing_params_to_policy params=params
              policy =Policy.new()
              policy.sharing_scope = params["sharing_scope"].to_i unless params[:sharing_scope].blank?
              policy.access_type = params[:access_type].blank? ? 0 : params["access_type"].to_i
              policy.use_whitelist = params["use_whitelist"] == 'true' ? true : false
        Severity: Minor
        Found in app/controllers/policies_controller.rb - About 3 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 api_helper.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module ApiHelper
          
          def xml_root_attributes
            { "xmlns" => "http://www.sysmo-db.org/2010/xml/rest",
              "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
        Severity: Minor
        Found in app/helpers/api_helper.rb - About 3 hrs to fix

          File explicit_versioning.rb has 299 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Jits
            module Acts
              # Based heavily on the acts_as_versioned plugin
              module ExplicitVersioning
                CALLBACKS = [:sync_latest_version]
          Severity: Minor
          Found in lib/explicit_versioning.rb - About 3 hrs to fix

            Class PeopleController has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class PeopleController < ApplicationController
            
              include Seek::AnnotationCommon
              include Seek::Publishing::PublishingCommon
              include Seek::Publishing::GatekeeperPublish
            Severity: Minor
            Found in app/controllers/people_controller.rb - About 3 hrs to fix

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

              function cancelEvent(e)
              {
                e = e ? e : window.event;
                if(e.stopPropagation)
                  e.stopPropagation();
              app/assets/javascripts/jws/Resizeable_Textbox/javascript.js on lines 115..126

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

              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

              function cancelEvent(e)
              {
                e = e ? e : window.event;
                if(e.stopPropagation)
                  e.stopPropagation();
              Severity: Major
              Found in app/assets/javascripts/jws/Resizeable_Textbox/javascript.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/jws/Resizeable_Container/javascript.js on lines 115..126

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

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

                  def populate_sample sample_json, specimen, assay=nil
              
              
                      sample_title = sample_json["title"]
                      sample_type = sample_json["type"]
              Severity: Major
              Found in lib/seek/data/bio_samples.rb - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language