sanger/sequencescape

View on GitHub

Showing 282 of 5,432 total issues

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

  def alternate_position(well_position, size, *dimensions)
    return nil unless Map.valid_well_position?(well_position)

    divisor, multiplier = dimensions.map { |n| send(:"plate_#{n}", size) }
    column, row = (well_position - 1).divmod(divisor)
Severity: Minor
Found in app/models/asset_shape.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 build_details has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def build_details(asset)
        {
          project_name: asset.projects.one? ? asset.projects.first.name : '',
          study_name: asset.studies.one? ? asset.studies.first.name : '',
          barcode: asset.labware_human_barcode,

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

  def validate_each(record, attribute, value)
    return true if value.blank?

    value.encode('cp1252')
    true if value.encode('cp1252').valid_encoding?
Severity: Minor
Found in app/validators/latin1_validator.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 permissions_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def permissions_for(ability)
    sorted_permissions.each_with_object({}) do |(klass, actions), granted|
      actions.each do |action|
        next unless ability.can?(action, klass.constantize)

Severity: Minor
Found in lib/ability_analysis/spec_generator.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 lookup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def lookup # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
    return unless params[:asset] && params[:asset][:barcode]

    @assets = Labware.with_barcode(params[:asset][:barcode]).limit(50).page(params[:page])

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

  def index # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
    if params[:study_id]
      @study = Study.find(params[:study_id])
      @assets = @study.assets_through_aliquots.order(:name).page(params[:page])
    else
Severity: Minor
Found in app/controllers/labware_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 handle_belongs_to has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_belongs_to(attributes, attribute, json, object) # rubocop:todo Metrics/MethodLength
      if json.is_a?(Hash)
        uuid = json.delete('uuid')
        associated = association_class(attribute, object)
        if uuid.present?
Severity: Minor
Found in app/api/core/io/base/json_formatting_behaviour/input.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 # rubocop:todo Metrics/AbcSize
    @request = Request.find(params[:id])
    authorize! :update, @request

    unless params[:request][:request_type_id].nil?
Severity: Minor
Found in app/controllers/requests_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 action_for_qc_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def action_for_qc_state(state) # rubocop:todo Metrics/MethodLength
    ActiveRecord::Base.transaction do
      if @last_event.present?
        # If we already have an event we check to see its state. If it matches,
        # we just continue to rendering, otherwise we blow up.
Severity: Minor
Found in app/controllers/npg_actions/assets_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 taxon_lookup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def taxon_lookup # rubocop:todo Metrics/AbcSize
    if params[:term]
      url = configatron.taxon_lookup_url + "/esearch.fcgi?db=taxonomy&term=#{params[:term].gsub(/\s/, '_')}"
    elsif params[:id]
      url = configatron.taxon_lookup_url + "/efetch.fcgi?db=taxonomy&mode=xml&id=#{params[:id]}"
Severity: Minor
Found in app/controllers/samples_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 pagination_actions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def pagination_actions
    {
      first: action_for_page(1),
      last: action_for_page(@last_page),
      read: action_for_page(@current_page)
Severity: Minor
Found in app/api/core/io/list.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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add(type, link, options = nil) # rubocop:todo Metrics/CyclomaticComplexity
    o = Informatics::Support::Options.collect(options)
    l = Informatics::Support::Options.collect(link)
    case type
    when :menu
Severity: Minor
Found in lib/informatics/lib/informatics/controller_helper.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_columns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_columns(columns, conditional_formattings) # rubocop:todo Metrics/MethodLength
      columns.each do |k, v|
        add_with_number(
          if v.is_a?(Hash)
            SequencescapeExcel::Column.new(SequencescapeExcel::Column.build_arguments(v, k, conditional_formattings))
Severity: Minor
Found in app/sequencescape_excel/sequencescape_excel/column_list.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 rack_well has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def rack_well(well_data) # rubocop:todo Metrics/MethodLength
    return unless well_data && well_data['sample_tube_uuid']
    raise SampleTubeNotExists unless well_data['sample_tube_resource']

    sample_tube = well_data['sample_tube_resource']
Severity: Minor
Found in app/models/extraction_attribute.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 managed_update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def managed_update # rubocop:todo Metrics/AbcSize
    @project = Project.find(params[:id])
    authorize! :managed_update, @project

    if params[:project][:uploaded_data].present?
Severity: Minor
Found in app/controllers/admin/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 lookup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def lookup # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
    return unless params[:asset] && params[:asset][:barcode]

    @assets = Labware.with_barcode(params[:asset][:barcode]).limit(50).page(params[:page])

Severity: Minor
Found in app/controllers/labware_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 create_bulk! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.create_bulk!(list_of_attributes)
      raise CriteriaInvalid, 'should be an array of tuples' if list_of_attributes.nil?
      raise CriteriaInvalid, 'should be an array of tuples' unless list_of_attributes.is_a?(Array)
      raise CriteriaInvalid, "can't be blank" if list_of_attributes.blank?
      raise CriteriaInvalid, 'should be a tuple' unless list_of_attributes.all?(Hash)
Severity: Minor
Found in app/api/endpoints/uuids.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 cancel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def cancel # rubocop:todo Metrics/AbcSize
    @request = Request.find(params[:id])
    if @request.try(:may_cancel_before_started?)
      if @request.cancel_before_started && @request.save
        flash[:notice] = "Request #{@request.id} has been cancelled"
Severity: Minor
Found in app/controllers/requests_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 process_if_present has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def process_if_present(json, path)
    value =
      path.inject(json) do |current, step|
        return unless current.respond_to?(:key?) # Could be nested attribute but not present!
        return unless current.key?(step)
Severity: Minor
Found in app/api/core/io/base/json_formatting_behaviour/input.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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def index # rubocop:todo Metrics/CyclomaticComplexity, Metrics/MethodLength
    @study, @item = nil, nil

    # Ok, here we pick the initial source for the Requests.  They either come from Request (as in all Requests), or they
    # are limited by the Asset / Item.
Severity: Minor
Found in app/controllers/requests_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

Severity
Category
Status
Source
Language