SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

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

        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

          Function addSelected has a Cognitive Complexity of 22 (exceeds 5 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 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 permissions_to_people_group has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            def permissions_to_people_group permissions, people_in_group
                permissions.each do |permission|
                  contributor_id = permission.contributor_id
                  access_type = permission.access_type
                  case permission.contributor_type
          Severity: Minor
          Found in app/models/policy.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 do_projects_belong_to_project_manager_projects has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            def do_projects_belong_to_project_manager_projects
                if (params[:person] and params[:person][:work_group_ids])
                  if User.project_manager_logged_in? && !User.admin_logged_in?
                    projects = []
                    params[:person][:work_group_ids].each do |id|
          Severity: Minor
          Found in app/controllers/people_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 edit_tag has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            def edit_tag
              if request.post?
                @tag=TextValue.find(params[:id])
                replacement_tags = []
          
          
          Severity: Minor
          Found in app/controllers/admins_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 clone_versioned_model has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

                    def clone_versioned_model(orig_model, new_model, process_file_columns=true)
                      self.versioned_attributes.each do |key|
                        # Make sure to ignore file columns, white list columns, timestamp columns and any other ignore columns
                        unless self.file_columns.include?(key) ||
                               self.white_list_columns.include?(key) ||
          Severity: Minor
          Found in lib/explicit_versioning.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 duesseldorf_bode_mapping has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def duesseldorf_bode_mapping
          
                concentration_regex = /(\d*,?\.?\d*).*/
                gene_modification_regex = /([\w\d]+)([\/+-]+)/
          
          
          Severity: Major
          Found in lib/seek/parser_mapper.rb - About 3 hrs to fix

            Class Project has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Project < ActiveRecord::Base
            
              include Seek::Rdf::RdfGeneration
              include Seek::Rdf::ReactToAssociatedChange
            
            
            Severity: Minor
            Found in app/models/project.rb - About 3 hrs to fix

              Function Position has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function Position(x, y)
              {
                this.X = x;
                this.Y = y;
                
              Severity: Major
              Found in app/assets/javascripts/jws/Resizeable_Textbox/javascript.js - About 2 hrs to fix

                Function Position has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function Position(x, y)
                {
                  this.X = x;
                  this.Y = y;
                  
                Severity: Major
                Found in app/assets/javascripts/jws/Resizeable_Container/javascript.js - About 2 hrs to fix

                  Method display_single_entry has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def display_single_entry entry
                        html=''
                        unless entry.blank?
                            #get the link of the entry
                            entry_link = entry.url
                  Severity: Minor
                  Found in app/helpers/homes_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 delete_or_cancel_button has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def delete_or_cancel_button(run, redirect_to)
                      if run.can_delete?
                        if run.complete?
                        # Delete
                          unless current_user.guest?
                  Severity: Minor
                  Found in app/helpers/runs_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 forgot_password has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def forgot_password    
                      if request.get?
                        # forgot_password.rhtml
                      elsif request.post?      
                        user = User.find_by_login(params[:login])
                  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 update has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      if params[:workflow]
                        [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
                          params[:workflow].delete(column_name)
                        end
                  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 new_version has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def new_version
                      if handle_upload_data
                        comments=params[:revision_comment]
                  
                        respond_to do |format|
                  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

                  Severity
                  Category
                  Status
                  Source
                  Language