SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

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

  def create
    group_name = white_list(params[:favourite_group_name])
    already_exists = FavouriteGroup.where(:name => group_name, :user_id => current_user.id).first
    
    unless already_exists
Severity: Minor
Found in app/controllers/favourite_groups_controller.rb - About 55 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 resource_in_tab has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def resource_in_tab
    resource_type = params[:resource_type]
    view_type = params[:view_type]
    scale_title = params[:scale_title] || ''

Severity: Minor
Found in app/controllers/application_controller.rb - About 55 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 detect_for_filter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def detect_for_filter(filter, resource, value)
    case
      #first the special cases
      when filter == 'investigation' && resource.respond_to?(:assays)
        resource.assays.collect { |a| a.study.investigation_id }.include? value.id
Severity: Minor
Found in app/controllers/application_controller.rb - About 55 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_text_from_pdf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_text_from_pdf
      output_directory = converted_storage_directory
      pdf_filepath = filepath('pdf')
      txt_filepath = filepath('txt')

Severity: Minor
Found in lib/seek/pdf_extraction.rb - About 55 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 get_compound_annotation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_compound_annotation compound_name
      url=URI.encode(webservice_base_url + "compounds?compoundName=")
      compound_name = URI.escape(compound_name, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
      url.concat(compound_name)
      doc = get_xml_doc url
Severity: Minor
Found in lib/seek/sabiork_webservices.rb - About 55 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 remove_rdf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def remove_rdf(item,graphs=[get_configuration.public_graph,get_configuration.private_graph].compact,delete_file = true)
          if configured?
            connect_to_repository
            rdf_file_path = last_rdf_file_path(item)
            if !rdf_file_path.nil?
Severity: Minor
Found in lib/seek/rdf/rdf_repository.rb - About 55 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 state_allows_publish? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def state_allows_publish? user=User.current_user
        if self.new_record?
          return true if !self.gatekeeper_required?
          !self.is_waiting_approval?(user) && !self.is_rejected?
        else
Severity: Minor
Found in lib/seek/permissions/publishing_permissions.rb - About 55 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 restart_delayed_job has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def restart_delayed_job
    error = nil
    if Rails.env!="test"
      begin
        Seek::Workers.restart
Severity: Minor
Found in app/controllers/admins_controller.rb - About 55 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 handle_download_zip has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def handle_download_zip asset
        #get the list of filename and filepath, {:filename => filepath}
        files_to_download = {}
        #store content_type for the case of 1 file
        content_type = nil
Severity: Minor
Found in lib/seek/download_handling/data_download.rb - About 55 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 authorization_permissions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def authorization_permissions user=User.current_user
        @@expected_true_value ||= ActiveRecord::Base.connection.quoted_true.gsub("'","")
        permissions = AuthPermissions.new
        user_id = user.nil? ? 0 : user.id
        if Seek::Config.auth_lookup_enabled && self.class.lookup_table_consistent?(user_id)
Severity: Minor
Found in lib/seek/permissions/policy_based_authorization.rb - About 55 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_or_update_associations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def create_or_update_associations asset_ids, asset_type, required_action
    asset_ids.each do |id|
      asset = asset_type.constantize.find_by_id(id)
      if asset && asset.send("can_#{required_action}?")
        unless Relationship.where(:subject_type => asset_type, :subject_id => asset.id, :predicate => Relationship::RELATED_TO_PUBLICATION, :other_object_type => "Publication", :other_object_id => @publication.id).first
Severity: Minor
Found in app/controllers/publications_controller.rb - About 55 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 generate_from_csv_definitions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def generate_from_csv_definitions rdf_graph
        #load template
        path_to_template=File.join(File.dirname(__FILE__), "rdf_mappings.csv")
        rows = Rails.cache.fetch("rdf_definitions",:expires_in=>1.hour) do
          CSV.read(path_to_template)
Severity: Minor
Found in lib/seek/rdf/rdf_generation.rb - About 55 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 url_response_code has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def url_response_code asset_url
        url = URI.parse(URI.encode(asset_url.strip))
        code=""
        begin
          if (["http","https"].include?(url.scheme))
Severity: Minor
Found in lib/seek/download_handling/data_download.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

   def update
      compound_name =  params["#{@compound.id}_title"]

      unless compound_name.blank?
         compound_annotation = {}
Severity: Minor
Found in app/controllers/compounds_controller.rb - About 55 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 get_pdf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def get_pdf
    if @content_blob.url.blank?
      begin
        pdf_or_convert
      rescue Exception=>e
Severity: Minor
Found in app/controllers/content_blobs_controller.rb - About 55 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize
      create_attributes
      
      logs = ActivityLog.where(["(action = ? or action = ?)","create","download"])
      logs.each do |log|
Severity: Minor
Found in lib/seek/activity_stats.rb - About 55 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 merge_conditions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_conditions(*conditions)
      segments = []

      conditions.each do |condition|
        unless condition.blank?
Severity: Minor
Found in lib/grouped_pagination.rb - About 55 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 acts_as_asset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def acts_as_asset
        attr_accessor :parent_name
        include Seek::Taggable

        acts_as_scalable
Severity: Minor
Found in lib/acts_as_asset.rb - About 55 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_treatment_row_and_columns_in_sheet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def find_treatment_row_and_columns_in_sheet sheet
        sheet_name = sheet.attributes["name"]
        treatment_cell_element = sheet.find("//ss:sheet[@name='#{sheet_name}']/ss:rows/ss:row/ss:cell").find do |cell|
          cell.content.match(/treatment.*/i)
        end
Severity: Minor
Found in lib/seek/data/treatments.rb - About 55 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 roles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def roles(project=nil)
      project_id = (project.is_a?(Project)) ? project.id : project.to_i
      role_names.select do |role_name|
        if self.class.is_project_dependent_role?(role_name)
          if project_id.nil?
Severity: Minor
Found in lib/seek/admin_defined_roles.rb - About 55 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