sanger/sequencescape

View on GitHub
app/sample_manifest_excel/sample_manifest_excel/worksheet/test_worksheet.rb

Summary

Maintainability
C
1 day
Test Coverage
A
100%

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'

    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

    Complex method SampleManifestExcel::Worksheet::TestWorksheet#record_tube_samples (50.0)
    Open

          def record_tube_samples # rubocop:todo Metrics/AbcSize
            tube_counter = 0
            first_to_last.each do |sheet_row|
              row = dynamic_attributes[sheet_row]
              build_tube_sample_manifest_asset do |sample_manifest_asset|

    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::Worksheet::TestWorksheet#add_cell_data (48.1)
    Open

          def add_cell_data(column, row_num, partial) # rubocop:todo Metrics/CyclomaticComplexity
            if partial && empty_row?(row_num)
              (data[column.name] || dynamic_attributes[row_num][column.name]) unless empty_columns.include?(column.name)
            elsif validation_errors.include?(:insert_size_from) && column.name == 'insert_size_from' &&
                  row_num == computed_first_row

    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 test_worksheet.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_dependency 'sample_manifest_excel/tags'
    
    module SampleManifestExcel
      module Worksheet
        ##

      Method record_tube_samples has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def record_tube_samples # rubocop:todo Metrics/AbcSize
              tube_counter = 0
              first_to_last.each do |sheet_row|
                row = dynamic_attributes[sheet_row]
                build_tube_sample_manifest_asset do |sample_manifest_asset|

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

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

            def add_cell_data(column, row_num, partial) # rubocop:todo Metrics/CyclomaticComplexity
              if partial && empty_row?(row_num)
                (data[column.name] || dynamic_attributes[row_num][column.name]) unless empty_columns.include?(column.name)
              elsif validation_errors.include?(:insert_size_from) && column.name == 'insert_size_from' &&
                    row_num == computed_first_row

      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

      SampleManifestExcel::Worksheet::TestWorksheet#add_cell_data is controlled by argument 'partial'
      Open

              if partial && empty_row?(row_num)

      Control Parameter is a special case of Control Couple

      Example

      A simple example would be the "quoted" parameter in the following method:

      def write(quoted)
        if quoted
          write_quoted @value
        else
          write_unquoted @value
        end
      end

      Fixing those problems is out of the scope of this document but an easy solution could be to remove the "write" method alltogether and to move the calls to "writequoted" / "writeunquoted" in the initial caller of "write".

      SampleManifestExcel::Worksheet::TestWorksheet#chromium_tags contains iterators nested 2 deep
      Open

              wells = ('A'..'H').flat_map { |row| (1..12).map { |col| "#{row}#{col}" } }

      A Nested Iterator occurs when a block contains another block.

      Example

      Given

      class Duck
        class << self
          def duck_names
            %i!tick trick track!.each do |surname|
              %i!duck!.each do |last_name|
                puts "full name is #{surname} #{last_name}"
              end
            end
          end
        end
      end

      Reek would report the following warning:

      test.rb -- 1 warning:
        [5]:Duck#duck_names contains iterators nested 2 deep (NestedIterators)

      SampleManifestExcel::Worksheet::TestWorksheet#add_data contains iterators nested 3 deep
      Open

                  columns.each do |column|

      A Nested Iterator occurs when a block contains another block.

      Example

      Given

      class Duck
        class << self
          def duck_names
            %i!tick trick track!.each do |surname|
              %i!duck!.each do |last_name|
                puts "full name is #{surname} #{last_name}"
              end
            end
          end
        end
      end

      Reek would report the following warning:

      test.rb -- 1 warning:
        [5]:Duck#duck_names contains iterators nested 2 deep (NestedIterators)

      SampleManifestExcel::Worksheet::TestWorksheet#add_extra_cells_for_tube_rack contains iterators nested 2 deep
      Open

                axlsx_worksheet.add_row do |row|

      A Nested Iterator occurs when a block contains another block.

      Example

      Given

      class Duck
        class << self
          def duck_names
            %i!tick trick track!.each do |surname|
              %i!duck!.each do |last_name|
                puts "full name is #{surname} #{last_name}"
              end
            end
          end
        end
      end

      Reek would report the following warning:

      test.rb -- 1 warning:
        [5]:Duck#duck_names contains iterators nested 2 deep (NestedIterators)

      SampleManifestExcel::Worksheet::TestWorksheet#record_plate_samples has approx 11 statements
      Open

            def record_plate_samples # rubocop:todo Metrics/AbcSize

      A method with Too Many Statements is any method that has a large number of lines.

      Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

      So the following method would score +6 in Reek's statement-counting algorithm:

      def parse(arg, argv, &error)
        if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
          return nil, block, nil                                         # +1
        end
        opt = (val = parse_arg(val, &error))[1]                          # +2
        val = conv_arg(*val)                                             # +3
        if opt and !arg
          argv.shift                                                     # +4
        else
          val[0] = nil                                                   # +5
        end
        val                                                              # +6
      end

      (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

      SampleManifestExcel::Worksheet::TestWorksheet#chromium_tags has approx 6 statements
      Open

            def chromium_tags

      A method with Too Many Statements is any method that has a large number of lines.

      Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

      So the following method would score +6 in Reek's statement-counting algorithm:

      def parse(arg, argv, &error)
        if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
          return nil, block, nil                                         # +1
        end
        opt = (val = parse_arg(val, &error))[1]                          # +2
        val = conv_arg(*val)                                             # +3
        if opt and !arg
          argv.shift                                                     # +4
        else
          val[0] = nil                                                   # +5
        end
        val                                                              # +6
      end

      (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

      SampleManifestExcel::Worksheet::TestWorksheet#add_title_and_description has approx 7 statements
      Open

            def add_title_and_description(study, supplier, count)

      A method with Too Many Statements is any method that has a large number of lines.

      Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

      So the following method would score +6 in Reek's statement-counting algorithm:

      def parse(arg, argv, &error)
        if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
          return nil, block, nil                                         # +1
        end
        opt = (val = parse_arg(val, &error))[1]                          # +2
        val = conv_arg(*val)                                             # +3
        if opt and !arg
          argv.shift                                                     # +4
        else
          val[0] = nil                                                   # +5
        end
        val                                                              # +6
      end

      (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

      SampleManifestExcel::Worksheet::TestWorksheet has at least 31 methods
      Open

          class TestWorksheet < SequencescapeExcel::Worksheet::Base # rubocop:todo Metrics/ClassLength

      Too Many Methods is a special case of LargeClass.

      Example

      Given this configuration

      TooManyMethods:
        max_methods: 3

      and this code:

      class TooManyMethods
        def one; end
        def two; end
        def three; end
        def four; end
      end

      Reek would emit the following warning:

      test.rb -- 1 warning:
        [1]:TooManyMethods has at least 4 methods (TooManyMethods)

      SampleManifestExcel::Worksheet::TestWorksheet#record_tube_samples has approx 14 statements
      Open

            def record_tube_samples # rubocop:todo Metrics/AbcSize

      A method with Too Many Statements is any method that has a large number of lines.

      Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

      So the following method would score +6 in Reek's statement-counting algorithm:

      def parse(arg, argv, &error)
        if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
          return nil, block, nil                                         # +1
        end
        opt = (val = parse_arg(val, &error))[1]                          # +2
        val = conv_arg(*val)                                             # +3
        if opt and !arg
          argv.shift                                                     # +4
        else
          val[0] = nil                                                   # +5
        end
        val                                                              # +6
      end

      (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

      SampleManifestExcel::Worksheet::TestWorksheet#record_tube_samples contains iterators nested 2 deep
      Open

                build_tube_sample_manifest_asset do |sample_manifest_asset|

      A Nested Iterator occurs when a block contains another block.

      Example

      Given

      class Duck
        class << self
          def duck_names
            %i!tick trick track!.each do |surname|
              %i!duck!.each do |last_name|
                puts "full name is #{surname} #{last_name}"
              end
            end
          end
        end
      end

      Reek would report the following warning:

      test.rb -- 1 warning:
        [5]:Duck#duck_names contains iterators nested 2 deep (NestedIterators)

      SampleManifestExcel::Worksheet::TestWorksheet#add_extra_cells_for_tube_rack has approx 6 statements
      Open

            def add_extra_cells_for_tube_rack(count)

      A method with Too Many Statements is any method that has a large number of lines.

      Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

      So the following method would score +6 in Reek's statement-counting algorithm:

      def parse(arg, argv, &error)
        if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
          return nil, block, nil                                         # +1
        end
        opt = (val = parse_arg(val, &error))[1]                          # +2
        val = conv_arg(*val)                                             # +3
        if opt and !arg
          argv.shift                                                     # +4
        else
          val[0] = nil                                                   # +5
        end
        val                                                              # +6
      end

      (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

      SampleManifestExcel::Worksheet::TestWorksheet#add_cell_data calls 'dynamic_attributes[row_num][column.name]' 2 times
      Open

                (data[column.name] || dynamic_attributes[row_num][column.name]) unless empty_columns.include?(column.name)
              elsif validation_errors.include?(:insert_size_from) && column.name == 'insert_size_from' &&
                    row_num == computed_first_row
                nil
              elsif validation_errors.include?(:sanger_sample_id_invalid) && column.name == 'sanger_sample_id' &&

      Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

      Reek implements a check for Duplicate Method Call.

      Example

      Here's a very much simplified and contrived example. The following method will report a warning:

      def double_thing()
        @other.thing + @other.thing
      end

      One quick approach to silence Reek would be to refactor the code thus:

      def double_thing()
        thing = @other.thing
        thing + thing
      end

      A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

      class Other
        def double_thing()
          thing + thing
        end
      end

      The approach you take will depend on balancing other factors in your code.

      SampleManifestExcel::Worksheet::TestWorksheet#add_cell_data calls 'row_num == computed_first_row' 2 times
      Open

                    row_num == computed_first_row
                nil
              elsif validation_errors.include?(:sanger_sample_id_invalid) && column.name == 'sanger_sample_id' &&
                    row_num == computed_first_row

      Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

      Reek implements a check for Duplicate Method Call.

      Example

      Here's a very much simplified and contrived example. The following method will report a warning:

      def double_thing()
        @other.thing + @other.thing
      end

      One quick approach to silence Reek would be to refactor the code thus:

      def double_thing()
        thing = @other.thing
        thing + thing
      end

      A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

      class Other
        def double_thing()
          thing + thing
        end
      end

      The approach you take will depend on balancing other factors in your code.

      SampleManifestExcel::Worksheet::TestWorksheet#record_plate_samples calls 'dynamic_attributes[sheet_row]' 3 times
      Open

                dynamic_attributes[sheet_row][:sanger_sample_id] = cur_sm_sample_asset.sanger_sample_id
      
                # set the plate barcode
                plate_id = cur_sm_sample_asset.asset.plate.id
      
      

      Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

      Reek implements a check for Duplicate Method Call.

      Example

      Here's a very much simplified and contrived example. The following method will report a warning:

      def double_thing()
        @other.thing + @other.thing
      end

      One quick approach to silence Reek would be to refactor the code thus:

      def double_thing()
        thing = @other.thing
        thing + thing
      end

      A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

      class Other
        def double_thing()
          thing + thing
        end
      end

      The approach you take will depend on balancing other factors in your code.

      SampleManifestExcel::Worksheet::TestWorksheet#add_cell_data calls 'column.name' 7 times
      Open

                (data[column.name] || dynamic_attributes[row_num][column.name]) unless empty_columns.include?(column.name)
              elsif validation_errors.include?(:insert_size_from) && column.name == 'insert_size_from' &&
                    row_num == computed_first_row
                nil
              elsif validation_errors.include?(:sanger_sample_id_invalid) && column.name == 'sanger_sample_id' &&

      Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

      Reek implements a check for Duplicate Method Call.

      Example

      Here's a very much simplified and contrived example. The following method will report a warning:

      def double_thing()
        @other.thing + @other.thing
      end

      One quick approach to silence Reek would be to refactor the code thus:

      def double_thing()
        thing = @other.thing
        thing + thing
      end

      A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

      class Other
        def double_thing()
          thing + thing
        end
      end

      The approach you take will depend on balancing other factors in your code.

      SampleManifestExcel::Worksheet::TestWorksheet#record_plate_samples calls 'cur_sm_sample_asset.asset.plate' 2 times
      Open

                plate_id = cur_sm_sample_asset.asset.plate.id
      
                # Validation errors here indicates problems we WANT not problems we HAVE
                dynamic_attributes[sheet_row][:sanger_plate_id] =
                  if cgap

      Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

      Reek implements a check for Duplicate Method Call.

      Example

      Here's a very much simplified and contrived example. The following method will report a warning:

      def double_thing()
        @other.thing + @other.thing
      end

      One quick approach to silence Reek would be to refactor the code thus:

      def double_thing()
        thing = @other.thing
        thing + thing
      end

      A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

      class Other
        def double_thing()
          thing + thing
        end
      end

      The approach you take will depend on balancing other factors in your code.

      SampleManifestExcel::Worksheet::TestWorksheet#add_cell_data calls 'data[column.name]' 2 times
      Open

                (data[column.name] || dynamic_attributes[row_num][column.name]) unless empty_columns.include?(column.name)
              elsif validation_errors.include?(:insert_size_from) && column.name == 'insert_size_from' &&
                    row_num == computed_first_row
                nil
              elsif validation_errors.include?(:sanger_sample_id_invalid) && column.name == 'sanger_sample_id' &&

      Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

      Reek implements a check for Duplicate Method Call.

      Example

      Here's a very much simplified and contrived example. The following method will report a warning:

      def double_thing()
        @other.thing + @other.thing
      end

      One quick approach to silence Reek would be to refactor the code thus:

      def double_thing()
        thing = @other.thing
        thing + thing
      end

      A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

      class Other
        def double_thing()
          thing + thing
        end
      end

      The approach you take will depend on balancing other factors in your code.

      SampleManifestExcel::Worksheet::TestWorksheet#add_cell_data calls 'dynamic_attributes[row_num]' 2 times
      Open

                (data[column.name] || dynamic_attributes[row_num][column.name]) unless empty_columns.include?(column.name)
              elsif validation_errors.include?(:insert_size_from) && column.name == 'insert_size_from' &&
                    row_num == computed_first_row
                nil
              elsif validation_errors.include?(:sanger_sample_id_invalid) && column.name == 'sanger_sample_id' &&

      Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

      Reek implements a check for Duplicate Method Call.

      Example

      Here's a very much simplified and contrived example. The following method will report a warning:

      def double_thing()
        @other.thing + @other.thing
      end

      One quick approach to silence Reek would be to refactor the code thus:

      def double_thing()
        thing = @other.thing
        thing + thing
      end

      A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

      class Other
        def double_thing()
          thing + thing
        end
      end

      The approach you take will depend on balancing other factors in your code.

      SampleManifestExcel::Worksheet::TestWorksheet#record_plate_samples calls 'cur_sm_sample_asset.asset' 3 times
      Open

                plate_id = cur_sm_sample_asset.asset.plate.id
      
                # Validation errors here indicates problems we WANT not problems we HAVE
                dynamic_attributes[sheet_row][:sanger_plate_id] =
                  if cgap

      Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

      Reek implements a check for Duplicate Method Call.

      Example

      Here's a very much simplified and contrived example. The following method will report a warning:

      def double_thing()
        @other.thing + @other.thing
      end

      One quick approach to silence Reek would be to refactor the code thus:

      def double_thing()
        thing = @other.thing
        thing + thing
      end

      A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

      class Other
        def double_thing()
          thing + thing
        end
      end

      The approach you take will depend on balancing other factors in your code.

      SampleManifestExcel::Worksheet::TestWorksheet#num_plates is a writable attribute
      Open

                          :num_plates,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#validation_errors is a writable attribute
      Open

                          :validation_errors,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#missing_columns is a writable attribute
      Open

                          :missing_columns,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#partial is a writable attribute
      Open

                          :partial,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#type is a writable attribute
      Open

                          :type,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#count is a writable attribute
      Open

                          :count,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#no_of_rows is a writable attribute
      Open

                          :no_of_rows,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#cgap is a writable attribute
      Open

                          :cgap,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#num_filled_wells_per_plate is a writable attribute
      Open

                          :num_filled_wells_per_plate

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#num_rows_per_well is a writable attribute
      Open

            attr_writer :manifest_type, :num_rows_per_well

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#manifest_type is a writable attribute
      Open

            attr_writer :manifest_type, :num_rows_per_well

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#supplier is a writable attribute
      Open

                          :supplier,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      SampleManifestExcel::Worksheet::TestWorksheet#data is a writable attribute
      Open

            attr_accessor :data,

      A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

      The same holds to a lesser extent for getters, but Reek doesn't flag those.

      Example

      Given:

      class Klass
        attr_accessor :dummy
      end

      Reek would emit the following warning:

      reek test.rb
      
      test.rb -- 1 warning:
        [2]:Klass declares the writable attribute dummy (Attribute)

      Complex method SampleManifestExcel::Worksheet::TestWorksheet#create_sample_manifest (20.3)
      Open

            def create_sample_manifest # rubocop:todo Metrics/MethodLength
              case manifest_type
              when /plate/
                FactoryBot.create(
                  :pending_plate_sample_manifest,

      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::Worksheet::TestWorksheet#compute_last_row (20.2)
      Open

            def compute_last_row
              if %w[plate_default plate_full plate_rnachip].include? manifest_type
                computed_first_row + (num_plates * num_filled_wells_per_plate * num_rows_per_well) - 1
              else
                computed_first_row + no_of_rows

      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

      SampleManifestExcel::Worksheet::TestWorksheet#initialize_dynamic_attributes has the variable name 'i'
      Open

              {}.tap { |hsh| first_to_last.each { |i| hsh[i] = {} } }.with_indifferent_access

      An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

      Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

      SampleManifestExcel::Worksheet::TestWorksheet#add_data has the variable name 'n'
      Open

              first_to_last.each do |n|

      An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

      Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

      SampleManifestExcel::Worksheet::TestWorksheet#tags_by_group has the variable name 'v'
      Open

              dynamic_attributes.each { |k, v| v.merge!(groups_and_indexes[k]) }

      An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

      Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

      SampleManifestExcel::Worksheet::TestWorksheet#tags_by_group has the variable name 'k'
      Open

              dynamic_attributes.each { |k, v| v.merge!(groups_and_indexes[k]) }

      An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

      Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

      SampleManifestExcel::Worksheet::TestWorksheet#tags_by_sequences has the variable name 'v'
      Open

              dynamic_attributes.each { |k, v| v.merge!(oligos[k]) }

      An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

      Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

      SampleManifestExcel::Worksheet::TestWorksheet#tags_by_sequences has the variable name 'k'
      Open

              dynamic_attributes.each { |k, v| v.merge!(oligos[k]) }

      An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

      Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

      There are no issues that match your filters.

      Category
      Status