sanger/sequencescape

View on GitHub

Showing 283 of 5,433 total issues

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

    def associate_built_requests!
      downstream_requests.each do |request|
        request.update!(initial_study: nil) if request.initial_study != study
        request.update!(initial_project: nil) if request.initial_project != project
        comments.each { |comment| request.comments.create!(user: user, description: comment) } if comments.present?
Severity: Minor
Found in app/models/submission/flexible_request_graph.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 substitute_tags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def substitute_tags
    Aliquot
      .where(id: matching_aliquots)
      .find_each do |aliquot|
        aliquot.tag_id = substitute_tag_id if substitute_tag?
Severity: Minor
Found in app/models/tag_substitution/substitution.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 determine_model_from_parts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def determine_model_from_parts(*parts) # rubocop:todo Metrics/MethodLength
      parts
        .length
        .downto(1) do |n|
          model_name, remainder = parts.slice(0, n), parts.slice(n, parts.length)
Severity: Minor
Found in app/middleware/api/endpoint_handler.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 & has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def &(other) # rubocop:todo Metrics/AbcSize
    raise StandardError, "Attempted to combine #{key} with #{other.key} FieldInfos" unless key == other.key

    dup.tap do |combined|
      # Use set selector to filter to those common to all attributes
Severity: Minor
Found in app/models/field_info.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_profile_via_ldap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update_profile_via_ldap # rubocop:todo Metrics/AbcSize
    ldap = Net::LDAP.new(host: configatron.ldap_server, port: configatron.ldap_port)

    filter = Net::LDAP::Filter.eq('uid', login)
    treebase = 'ou=people,dc=sanger,dc=ac,dc=uk'
Severity: Minor
Found in app/models/user/authentication.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 validate_ena_required_fields! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_ena_required_fields!
    (valid?(:accession) && valid?(accession_service.provider)) || raise(ActiveRecord::RecordInvalid, self)
  rescue ActiveRecord::RecordInvalid => e
    ena_study.errors.full_messages.each { |message| errors.add(:base, "#{message} on study") } unless ena_study.nil?
    raise e
Severity: Minor
Found in app/models/sample.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 xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def xml # rubocop:todo Metrics/AbcSize
    xml = Builder::XmlMarkup.new
    xml.instruct!
    xml.SUBMISSION(
      'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
Severity: Minor
Found in app/models/accessionable/submission.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_data_release_and_accession_for_submission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def check_data_release_and_accession_for_submission # rubocop:todo Metrics/AbcSize
    return if configatron.disable_accession_check == true

    if not study.valid_data_release_properties?
      errors.add(:study, "#{study.name}: Please fill in the study data release information")
Severity: Minor
Found in app/models/submission/accession_behaviour.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 perform_decision_change! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def perform_decision_change!
    begin
      ActiveRecord::Base.transaction do
        perform_decision_change_request_state! if state_change?
        perform_decision_change_asset_qc_state! unless asset_qc_state_absent?
Severity: Minor
Found in app/models/request/change_decision.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 assess! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def assess! # rubocop:todo Metrics/AbcSize
    @qc_decision = 'passed'
    STATE_ORDER.each do |decision|
      params
        .fetch(decision, [])
Severity: Minor
Found in app/models/product_criteria/advanced.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 valid? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def valid? # rubocop:todo Metrics/MethodLength
    return invalid("#{filename} was not a csv file") unless is_a_csv?
    unless is_a_report?
      return(
        invalid(
Severity: Minor
Found in app/models/qc_report/file.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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def perform
      # Process each request that has been selected in the front end
      # by default all requests are selected, but in rare circumstances the user
      # can uncheck a request to exclude it from the step
      requests.each do |request|
Severity: Minor
Found in app/models/tasks/set_descriptors_handler.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def resolve
    barcodes_wells.flat_map do |labware_barcode, well_locations|
      labware = Labware.find_by_barcode(labware_barcode)
      raise InvalidInputException, "No labware found for barcode #{labware_barcode}." if labware.nil?

Severity: Minor
Found in app/models/asset/finder.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(study) # rubocop:todo Metrics/AbcSize
      @study = study
      data = {}

      study_title = study.study_metadata.study_study_title
Severity: Minor
Found in app/models/accessionable/study.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 all_parents_acceptable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def all_parents_acceptable # rubocop:todo Metrics/MethodLength
    @parents.each do |location, parent|
      case parent
      when Plate, TubeRack
        next if parent.size == 96
Severity: Minor
Found in app/models/plate/quad_creator.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 plate_parameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def plate_parameters(_plate, parent_plate = nil) # rubocop:todo Metrics/MethodLength
    params = @params.clone

    parent_dilution_factor = plate_dilution_factor(parent_plate)
    if params_has_dilution_factor?(params)
Severity: Minor
Found in app/models/plate/creator_parameters.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 truncate_errors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def truncate_errors # rubocop:todo Metrics/MethodLength
    if last_errors && last_errors.join.length > LIMIT_ERROR_LENGTH
      # First we truncate individual error messages. This ensures that it the first message is already
      # longer than out max limit, we still show something.
      full_last_errors = last_errors.map { |error| error.truncate(INDIVIDUAL_ERROR_LIMIT) }
Severity: Minor
Found in app/models/sample_manifest.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 run! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def run!
    # Validation outside the transaction because we want to return the errors
    return false unless valid?

    # Rails 6.1 doesn't allow return value from transaction block
Severity: Minor
Found in app/models/sample_manifest/uploader.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

Function ajaxXMLRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const ajaxXMLRequest = function (url, field, callbacks) {
  var xmlSelect = function (element, name) {
    let elements = $(name, element);
    if (elements.length == 0) {
      return undefined;
Severity: Minor
Found in app/frontend/entrypoints/organism_validation.js - 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 qc_result_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def qc_result_for(key)
    result =
      if key == 'quantity_in_nano_grams'
        well_attribute.quantity_in_nano_grams
      else
Severity: Minor
Found in app/models/well.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