SysMO-DB/seek

View on GitHub

Showing 714 of 1,025 total issues

Method auth_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def auth_params
    restricted_params={:sharing => User.admin_logged_in?,
                       :site_root_uri => User.admin_logged_in?,
                       :site_username => User.admin_logged_in?,
                       :site_password => User.admin_logged_in?,
Severity: Minor
Found in app/controllers/projects_controller.rb - About 25 mins 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def new
    @project = Project.new

    possible_unsaved_data = "unsaved_#{@project.class.name}_#{@project.id}".to_sym
    if session[possible_unsaved_data]
Severity: Minor
Found in app/controllers/projects_controller.rb - About 25 mins 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def edit
    
    possible_unsaved_data = "unsaved_#{@project.class.name}_#{@project.id}".to_sym
    if session[possible_unsaved_data]
      # if user was redirected to this 'edit' page from avatar upload page - use session
Severity: Minor
Found in app/controllers/projects_controller.rb - About 25 mins 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 existing_specimens has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def existing_specimens
    specimens_of_strains = []
    strains = []
    specimens_with_default_strain =[]
    if params[:strain_ids]
Severity: Minor
Found in app/controllers/biosamples_controller.rb - About 25 mins 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_avatars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def find_avatars
    # all avatars for current object are only shown to the owner of the object OR to any admin (if the object is not an admin themself);
    # also, show avatars to all members of a project/institution
    if User.admin_logged_in? || (@avatar_owner_instance.class.name == "Person" && @avatar_for_id.to_i == current_user.person.id.to_i) ||
     (["Project", "Institution"].include?(@avatar_for) && @avatar_owner_instance.can_be_edited_by?(current_user))
Severity: Minor
Found in app/controllers/avatars_controller.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    update_annotations @strain
    if params[:sharing]
      @strain.policy.set_attributes_with_sharing params[:sharing], @strain.projects
    end
Severity: Minor
Found in app/controllers/strains_controller.rb - About 25 mins 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 test_email_configuration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def test_email_configuration
    smtp_hash_old = ActionMailer::Base.smtp_settings
    smtp_hash_new = {:address => params[:address], :enable_starttls_auto => params[:enable_starttls_auto]=="1", :domain => params[:domain], :authentication => params[:authentication], :user_name => (params[:user_name].blank? ? nil : params[:user_name]), :password => (params[:password].blank? ? nil : params[:password])}
    smtp_hash_new[:port] = params[:port] if only_integer params[:port], 'port'
    ActionMailer::Base.smtp_settings = smtp_hash_new
Severity: Minor
Found in app/controllers/admins_controller.rb - About 25 mins 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 show_via_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def show_via_url asset, content_blob=nil
        content_blob = content_blob.nil? ? asset.content_blob : content_blob
        code = url_response_code(content_blob.url)
        if (["301","302", "401"].include?(code))
          redirect_to(content_blob.url, :target=>"_blank")
Severity: Minor
Found in lib/seek/download_handling/data_download.rb - About 25 mins 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 resolve_tags_from_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve_tags_from_params params, attr
      tags=[]

        selected_key = "#{attr}_autocompleter_selected_ids".to_sym
        unrecognized_key = "#{attr}_autocompleter_unrecognized_items".to_sym
Severity: Minor
Found in lib/seek/taggable.rb - About 25 mins 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 simulate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def simulate model_or_file

        @@builder ||= Seek::JWS::Builder.new

        if (model_or_file.is_a?(String))
Severity: Minor
Found in lib/seek/jws/simulator_applet.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @experimental_condition=ExperimentalCondition.new(params[:experimental_condition])
    @experimental_condition.sop=@sop
    @experimental_condition.sop_version = params[:version]
    new_substances = params[:substance_autocompleter_unrecognized_items] || []
Severity: Minor
Found in app/controllers/experimental_conditions_controller.rb - About 25 mins 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 included has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.included klass
        attr_accessor :permission_for
        klass.extend AuthLookupClassMethods
        klass.class_eval do
          belongs_to :contributor, :polymorphic => true unless method_defined? :contributor
Severity: Minor
Found in lib/seek/permissions/policy_based_authorization.rb - About 25 mins 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 configure_exception_notification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def configure_exception_notification
      if exception_notification_enabled && !Rails.application.config.consider_all_requests_local
        SEEK::Application.config.middleware.use ExceptionNotification::Rack,
          :email=>{
            :sender_address         => [self.noreply_sender],
Severity: Minor
Found in lib/seek/config.rb - About 25 mins 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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.start number=0,restart=false
      number = Seek::Config.workflows_enabled ? number : 0

      action = restart ? "restart" : "start"

Severity: Minor
Found in lib/seek/workers.rb - About 25 mins 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 check_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_content blob, str, max_length=1500
      char_count=0
      filepath=blob.filepath
      begin
        f = File.open(filepath, "r")
Severity: Minor
Found in lib/seek/content_type_detection.rb - About 25 mins 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def delete
    if request.delete?
      id=params[:id].split("_")[1].to_i
      f=Favourite.find(id)
      f.resource.destroy if f.resource.instance_of?(SavedSearch)
Severity: Minor
Found in app/controllers/favourites_controller.rb - About 25 mins 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 convert_to_pdf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_to_pdf dat_filepath=filepath, pdf_filepath=filepath('pdf')
      begin
        unless File.exists?(pdf_filepath)
          #copy dat file to original file extension in order to convert to pdf on this file
          file_extension = mime_extensions(content_type).first
Severity: Minor
Found in lib/seek/pdf_extraction.rb - About 25 mins 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 check_for_data_or_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def check_for_data_or_url(blob_params)
        if (blob_params[:data]).blank? && (blob_params[:data_url]).blank?
          if blob_params.include?(:data_url)
            flash.now[:error] = 'Please select a file to upload or provide a URL to the data.'
          else
Severity: Minor
Found in lib/seek/upload_handling/parameter_handling.rb - About 25 mins 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 extract_main_parameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def extract_main_parameters doc
        params={}
        doc.find("//form[@id='main']/*/parameter").each do |node|
          unless node.attributes['id'].nil?
            id=node.attributes['id']
Severity: Minor
Found in lib/seek/jws/api_handling.rb - About 25 mins 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 publish! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def publish! comment=nil
        if can_publish?
          if gatekeeper_required? && !User.current_user.person.is_gatekeeper_of?(self)
            false
          else
Severity: Minor
Found in lib/seek/permissions/publishing_permissions.rb - About 25 mins 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