sanger/sequencescape

View on GitHub

Showing 5,448 of 5,450 total issues

Complex method BatchesController#update (30.8)
Open

  def update # rubocop:todo Metrics/AbcSize
    if batch_parameters[:assignee_id]
      user = User.find(batch_parameters[:assignee_id])
      assigned_message = "Assigned to #{user.name} (#{user.login})."
    else
Severity: Minor
Found in app/controllers/batches_controller.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method Core::Io::Json::Grammar::Intermediate#merge_children_with (30.8)
Open

    def merge_children_with(node) # rubocop:todo Metrics/AbcSize
      (node.children.keys + @children.keys)
        .uniq
        .each_with_object({}) do |k, store|
          cloned =
Severity: Minor
Found in app/api/core/io/json/grammar.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method Batch::StateMachineBehaviour#create_release_batch_event_for (30.8)
Open

  def create_release_batch_event_for(user) # rubocop:todo Metrics/AbcSize
    lab_events
      .create!(batch: self, user: user, description: 'Released')
      .tap do |event|
        event.add_descriptor Descriptor.new(name: 'workflow_id', value: workflow.id)

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method SampleManifestExcel::Tags::Validator::Uniqueness#check_tags (30.8)
Open

        def check_tags # rubocop:todo Metrics/CyclomaticComplexity
          i7s = upload.data_at(:i7)
          i5s = upload.data_at(:i5)

          tag_groups = upload.data_at(:tag_group)

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method QcReport::StateMachine::included (30.5)
Open

    def self.included(base) # rubocop:todo Metrics/AbcSize
      base.class_eval do
        # When adding new states, please make sure you update the config/locals/en.yml file
        # with descriptions.

Severity: Minor
Found in app/models/qc_report.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Method file_addition has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def file_addition(action, http_method) # rubocop:todo Metrics/AbcSize
        send(
          http_method,
          %r{/([\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12})(?:/([^/]+(?:/[^/]+)*))?},
          file_attached: true
Severity: Minor
Found in app/middleware/api/endpoint_handler.rb - About 1 hr to fix

    Method create_request has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_request # rubocop:todo Metrics/AbcSize
        @request_type = RequestType.find(params[:request_type_id])
        @study = Study.find(params[:study_id]) if params[:cross_study_request].blank?
        @project = Project.find(params[:project_id]) if params[:cross_project_request].blank?
    
    
    Severity: Minor
    Found in app/controllers/receptacles_controller.rb - About 1 hr to fix

      Method studies_from_scope has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def studies_from_scope(scope) # rubocop:todo Metrics/CyclomaticComplexity
          studies =
            case scope
            when 'interesting'
              Study.of_interest_to(current_user)
      Severity: Minor
      Found in app/controllers/studies_controller.rb - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          it("shows Fetching batch information when loading the batch", () => {
            const wrapper = shallowMount(PicksSectionBatch, {
              propsData: {
                id: "12345",
              },
        app/frontend/plate-picks/components/PicksSectionBatch.test.js on lines 7..14

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 59.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          it("shows the batch id", () => {
            const wrapper = shallowMount(PicksSectionBatch, {
              propsData: {
                id: "12345",
              },
        app/frontend/plate-picks/components/PicksSectionBatch.test.js on lines 16..23

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 59.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Complex method Accessionable::Study#initialize (30.3)
        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 by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method Studies::InformationController#show (30.3)
        Open

          def show # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
            @summary = params[:summary] || 'sample-progress'
            @request_types = RequestType.where(id: @study.requests.distinct.pluck(:request_type_id)).standard.order(:order, :id)
            @summaries = BASIC_TABS + @request_types.pluck(:key, :name)
        
        

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method Ability::Administrator#grant_privileges (30.2)
        Open

          def grant_privileges # rubocop:todo Metrics/AbcSize
            Rails.logger.debug { 'Granting Administrator privileges' }
        
            # Labware
            can %i[edit rename change_purpose edit_retention_instruction], Labware
        Severity: Minor
        Found in app/models/ability/administrator.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method Endpoints::Searches::SearchActions#search_action (30.1)
        Open

            def search_action(name) # rubocop:todo Metrics/AbcSize
              bind_action(:create, to: name.to_s, as: name.to_sym) do |action, request, response|
                request.json['search']['page'] ||= request.path.fetch(1).to_i if request.path.fetch(1, false)
                scope = request.target.scope(request.json['search']).send(name)
        
        
        Severity: Minor
        Found in app/api/endpoints/searches.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method Transfer::State::PlateState::included (30.0)
        Open

            def self.included(base) # rubocop:todo Metrics/MethodLength
              base.class_eval do
                scope :in_state,
                      lambda { |states|
                        states = Array(states).map(&:to_s)
        Severity: Minor
        Found in app/models/transfer/state.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method TransferRequestCollection#transfer_requests_io= (29.9)
        Open

          def transfer_requests_io=(parameters) # rubocop:todo Metrics/AbcSize
            uuid_cache = UuidCache.new(parameters)
        
            updated_attributes =
              parameters.map do |parameter|

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Method check_inputs_to_volume_to_cherrypick_by_nano_grams! has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def check_inputs_to_volume_to_cherrypick_by_nano_grams!(minimum_volume, maximum_volume, target_ng, source_well)
            raise 'Source well not found' if source_well.nil?
        
            if minimum_volume.blank? || minimum_volume <= 0.0
              raise Cherrypick::VolumeError,
        Severity: Minor
        Found in app/models/cherrypick/volume_by_nano_grams.rb - About 1 hr to fix

          Method generate_tecan_data has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def generate_tecan_data # rubocop:todo Metrics/AbcSize
              source_barcode = "#{plate.machine_barcode}_s"
              destination_barcode = "#{plate.machine_barcode}_d"
              data_object = {
                'user' => user.login,
          Severity: Minor
          Found in app/models/stock_stamper.rb - About 1 hr to fix

            Method included has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
                base.class_eval do
                  include AASM
                  aasm column: :state, whiny_persistence: true do
                    state :pending, initial: true
            Severity: Minor
            Found in app/models/batch/state_machine_behaviour.rb - About 1 hr to fix

              Method grant_privileges has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def grant_privileges # rubocop:todo Metrics/AbcSize
                  Rails.logger.debug { 'Granting Administrator privileges' }
              
                  # Labware
                  can %i[edit rename change_purpose edit_retention_instruction], Labware
              Severity: Minor
              Found in app/models/ability/administrator.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language