sanger/sequencescape

View on GitHub

Showing 5,424 of 5,426 total issues

Class StudiesController has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

class StudiesController < ApplicationController
  # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour.
  # It should be removed wherever possible and the correct Strong  Parameter options applied in its place.
  before_action :evil_parameter_hack!
  include REXML
Severity: Minor
Found in app/controllers/studies_controller.rb - About 3 hrs to fix

    Class TestWorksheet has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class TestWorksheet < SequencescapeExcel::Worksheet::Base # rubocop:todo Metrics/ClassLength
          include SequencescapeExcel::Helpers::Worksheet
    
          self.worksheet_name = 'DNA Collections Form'
    
    

      Class Row has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Row # rubocop:todo Metrics/ClassLength
            include ActiveModel::Model
            include Converters
      
            attr_accessor :number, :data, :columns, :cache
      Severity: Minor
      Found in app/sample_manifest_excel/sample_manifest_excel/upload/row.rb - About 3 hrs to fix

        Complex method SampleManifestExcel::Worksheet::TestWorksheet#record_plate_samples (61.6)
        Open

              def record_plate_samples # rubocop:todo Metrics/AbcSize
                sm_sample_assets = sample_manifest.sample_manifest_assets.to_a
        
                first_to_last.each_with_index do |sheet_row, sample_index|
                  cur_sm_sample_asset = sm_sample_assets.fetch(sample_index)

        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

        File bulk_submission.rb has 325 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module ArrayWithFieldList
          refine Array do
            def comma_separate_field_list_for_display(*fields)
              field_list(*fields).join(', ')
            end
        Severity: Minor
        Found in app/models/bulk_submission.rb - About 3 hrs to fix

          File batches_controller.rb has 325 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class BatchesController < ApplicationController # rubocop:todo Metrics/ClassLength
            # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behaviour.
            # It should be removed wherever possible and the correct Strong  Parameter options applied in its place.
          
            before_action :evil_parameter_hack!
          Severity: Minor
          Found in app/controllers/batches_controller.rb - About 3 hrs to fix

            Method prepare_order has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

              def prepare_order(details) # rubocop:todo Metrics/CyclomaticComplexity
                # Retrieve common attributes
                study = Study.find_by_id_or_name!(details['study id'], details['study name'])
                project = Project.find_by_id_or_name!(details['project id'], details['project name'])
                user = User.find_by(login: details['user login']) or
            Severity: Minor
            Found in app/models/bulk_submission.rb - About 3 hrs 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

            Complex method namespace(sequencing)::namespace(novaseq)::task#setup (60.5)
            Open

                task setup: :environment do
                  # rubocop:todo Metrics/BlockLength
                  ActiveRecord::Base.transaction do
                    unless RequestType.exists?(key: 'illumina_htp_novaseq_6000_paired_end_sequencing')
                      RequestType
            Severity: Minor
            Found in lib/tasks/sequencing.rake 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 namespace(pac_bio_run)::task#rebroadcast_duplicates (60.5)
            Open

              task rebroadcast_duplicates: :environment do
                # This task resends messages
            
                list_of_runs = [
                  10_056,

            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

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

              $("#asset_scan").bind("keydown", function (e) {
                /* We don't take tab index into account here */
                var ENTER = 13,
                  TAB = 9,
                  code;
            Severity: Major
            Found in app/frontend/entrypoints/report_fails.js and 2 other locations - About 3 hrs to fix
            app/frontend/entrypoints/labwhere_reception.js on lines 50..62
            app/frontend/entrypoints/pooling.js on lines 32..44

            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 109.

            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 3 locations. Consider refactoring.
            Open

                $("#asset_scan").bind("keydown", function (e) {
                  /* We don't take tab index into account here */
                  var ENTER = 13,
                    TAB = 9,
                    code;
            Severity: Major
            Found in app/frontend/entrypoints/labwhere_reception.js and 2 other locations - About 3 hrs to fix
            app/frontend/entrypoints/pooling.js on lines 32..44
            app/frontend/entrypoints/report_fails.js on lines 27..39

            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 109.

            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 3 locations. Consider refactoring.
            Open

              $("#asset_scan").bind("keydown", function (e) {
                /* We don't take tab index into account here */
                var ENTER = 13,
                  TAB = 9,
                  code;
            Severity: Major
            Found in app/frontend/entrypoints/pooling.js and 2 other locations - About 3 hrs to fix
            app/frontend/entrypoints/labwhere_reception.js on lines 50..62
            app/frontend/entrypoints/report_fails.js on lines 27..39

            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 109.

            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

            File plate.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'lab_where_client'
            
            # https://github.com/sanger/sequencescape/raw/master/docs/images/plate.jpg
            #
            # A plate is a piece of labware made up of a number of {Well wells}. This class represents the physical piece of
            Severity: Minor
            Found in app/models/plate.rb - About 3 hrs to fix

              Method do_cherrypick_task has 92 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def do_cherrypick_task(_task, params) # rubocop:todo Metrics/CyclomaticComplexity
                  plates = params[:plate]
                  size = params[:plate_size]
                  plate_type = params[:plate_type]
              
              
              Severity: Major
              Found in app/models/tasks/cherrypick_handler.rb - About 3 hrs to fix

                Class Receptacle has 30 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Receptacle < Asset # rubocop:todo Metrics/ClassLength
                  include Uuid::Uuidable
                  include Commentable
                  include Transfer::State
                  include Aliquot::Remover
                Severity: Minor
                Found in app/models/receptacle.rb - About 3 hrs to fix

                  Complex method StudiesController#create (59.6)
                  Open

                    def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
                      ActiveRecord::Base.transaction do
                        @study = Study.new(params['study'].merge(user: current_user))
                        @study.save!
                        current_user.grant_manager(@study)
                  Severity: Minor
                  Found in app/controllers/studies_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

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

                      const wrapper = shallowMount(PlatesSectionPlate, {
                        mocks: {
                          $store: {
                            state: { ...defaultState() },
                            getters: {},
                  app/frontend/plate-picks/components/PlatesSectionPlate.test.js on lines 157..174

                  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 107.

                  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

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

                      const wrapper = shallowMount(PlatesSectionPlate, {
                        mocks: {
                          $store: {
                            state: { ...defaultState() },
                            getters: {},
                  app/frontend/plate-picks/components/PlatesSectionPlate.test.js on lines 112..129

                  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 107.

                  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 namespace(jsorm)::task#create_config (58.7)
                  Open

                    task create_config: :environment do
                      puts <<~HEREDOC
                        /*
                         * Autogenerated by sequencescape on #{Time.zone.now}"
                         * bundle exec rake jsorm:create_config"
                  Severity: Minor
                  Found in lib/tasks/jsorm.rake 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 Submission#next_requests_via_submission (58.5)
                  Open

                    def next_requests_via_submission(request) # rubocop:todo Metrics/CyclomaticComplexity
                      raise "Request #{request.id} is not part of submission #{id}" unless request.submission_id == id
                  
                      # Pick out the siblings of the request, so we can work out where it is in the list, and all of
                      # the requests in the subsequent request type, so that we can tie them up.  We order by ID
                  Severity: Minor
                  Found in app/models/submission.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

                  Severity
                  Category
                  Status
                  Source
                  Language