SpeciesFileGroup/taxonworks

View on GitHub
lib/batch_load/import/dwca.rb

Summary

Maintainability
F
1 wk
Test Coverage

Method build_dwca has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
Open

    def build_dwca
      line_counter = 1 # accounting for headers

      tasks = triage(csv.headers, tasks_)
      csv.each do |row|
Severity: Minor
Found in lib/batch_load/import/dwca.rb - About 2 days 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

File dwca.rb has 632 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module BatchLoad
  # TODO: Originally transliterated from Import::CollectingEvents: Remove this to-do after successful operation.
  class Import::DWCA < BatchLoad::Import

    attr_accessor :collecting_events
Severity: Major
Found in lib/batch_load/import/dwca.rb - About 1 day to fix

    Method build_dwca has 184 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def build_dwca
          line_counter = 1 # accounting for headers
    
          tasks = triage(csv.headers, tasks_)
          csv.each do |row|
    Severity: Major
    Found in lib/batch_load/import/dwca.rb - About 7 hrs to fix

      Method make_ce has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

          def make_ce(row)
            ret_val     = {}
            kees        = [:yyyy_mm_dd, :mm_dd_yy]
            d_s         = row['eventdate']
            v_l         = [row['municipality'], row['locality']].select {|name| name.present?}.join(':')
      Severity: Minor
      Found in lib/batch_load/import/dwca.rb - About 6 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

      Method make_tn has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def make_tn(row)
            ret_val      = {species: nil, genus: nil, tribe: nil}
            this_kingdom = row['kingdom']
            if @kingdom.try(:name) != this_kingdom
              @kingdom = Protonym.find_or_create_by(name:       this_kingdom,
      Severity: Major
      Found in lib/batch_load/import/dwca.rb - About 2 hrs to fix

        Class DWCA has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Import::DWCA < BatchLoad::Import
        
            attr_accessor :collecting_events
        
            attr_accessor :dwca_namespace
        Severity: Minor
        Found in lib/batch_load/import/dwca.rb - About 2 hrs to fix

          Method make_tn has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def make_tn(row)
                ret_val      = {species: nil, genus: nil, tribe: nil}
                this_kingdom = row['kingdom']
                if @kingdom.try(:name) != this_kingdom
                  @kingdom = Protonym.find_or_create_by(name:       this_kingdom,
          Severity: Minor
          Found in lib/batch_load/import/dwca.rb - About 2 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

          Method make_ce has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def make_ce(row)
                ret_val     = {}
                kees        = [:yyyy_mm_dd, :mm_dd_yy]
                d_s         = row['eventdate']
                v_l         = [row['municipality'], row['locality']].select {|name| name.present?}.join(':')
          Severity: Major
          Found in lib/batch_load/import/dwca.rb - About 2 hrs to fix

            Method make_co has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def make_co(row)
                  ret_val = {}
                  warn    = []
                  err     = []
                  ic      = row['individualcount']
            Severity: Minor
            Found in lib/batch_load/import/dwca.rb - About 1 hr to fix

              Method make_notes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def make_notes(row)
                    ret_val = {}
                    begin
                      notes      = {}
                      geo_remark = row['georeferenceremarks']
              Severity: Minor
              Found in lib/batch_load/import/dwca.rb - About 1 hr 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 make_gr has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def make_gr(row)
                    geo_by = row['georeferencedby']
                    # lat, long           = (lat.length > 0) ? lat : nil, (long.length > 0) ? long : nil
                    lat, long = row['decimallatitude'], row['decimallongitude']
                    if lat.nil? and long.nil?
              Severity: Minor
              Found in lib/batch_load/import/dwca.rb - About 1 hr to fix

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

                    def make_notes(row)
                      ret_val = {}
                      begin
                        notes      = {}
                        geo_remark = row['georeferenceremarks']
                Severity: Minor
                Found in lib/batch_load/import/dwca.rb - About 1 hr to fix

                  Method make_ident has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def make_ident(row)
                        ident  = {}
                        cat_no = row['catalognumber'].split(' ')
                        unless cat_no.blank?
                          if @namespace.short_name != cat_no[0]
                  Severity: Minor
                  Found in lib/batch_load/import/dwca.rb - About 55 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 make_co has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def make_co(row)
                        ret_val = {}
                        warn    = []
                        err     = []
                        ic      = row['individualcount']
                  Severity: Minor
                  Found in lib/batch_load/import/dwca.rb - About 45 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 make_gr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def make_gr(row)
                        geo_by = row['georeferencedby']
                        # lat, long           = (lat.length > 0) ? lat : nil, (long.length > 0) ? long : nil
                        lat, long = row['decimallatitude'], row['decimallongitude']
                        if lat.nil? and long.nil?
                  Severity: Minor
                  Found in lib/batch_load/import/dwca.rb - About 45 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

                  Consider simplifying this complex logical expression.
                  Open

                            if test_list.include?(:start_date_day) or
                              test_list.include?(:start_date_month) or
                              test_list.include?(:start_date_year) or
                              test_list.include?(:end_date_day) or
                              test_list.include?(:end_date_month) or
                  Severity: Major
                  Found in lib/batch_load/import/dwca.rb - About 40 mins to fix

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

                        def make_ba(row)
                          # for each associatedTaxa, find or create an otu, and creata a biological association for it,
                          # connecting it to a collection_object
                          retval = {}
                          bas    = row['associatedtaxa']
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.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 save_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def save_hash(objects)
                          l_errs = []
                          objects.each_key {|kee|
                            object = objects[kee]
                            unless object.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.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

                    Use if warn.present? instead of unless warn.blank?.
                    Open

                              @warns.push(results.delete(:warn)) unless warn.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if g_r_notes.present? instead of unless g_r_notes.blank?.
                    Open

                                unless g_r_notes.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if c_e_notes.present? instead of unless c_e_notes.blank?.
                    Open

                              unless c_e_notes.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if g_r_notes.present? instead of unless g_r_notes.blank?.
                    Open

                            unless g_r_notes.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if bas.present? instead of unless bas.blank?.
                    Open

                          unless bas.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if b_a_s.present? instead of unless b_a_s.blank?.
                    Open

                            unless b_a_s.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if object.present? instead of unless object.blank?.
                    Open

                            unless object.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if err.present? instead of unless err.blank?.
                    Open

                              @errs.push(results.delete(:err)) unless err.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if c_o_notes.present? instead of unless c_o_notes.blank?.
                    Open

                            unless c_o_notes.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if g_rer.present? instead of unless g_rer.blank?.
                    Open

                            unless g_rer.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if object.present? instead of unless object.blank?.
                    Open

                            unless object.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if sdy.present? instead of unless sdy.blank?.
                    Open

                                date_params[:start_date_year]  = sdy unless sdy.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if edd.present? instead of unless edd.blank?.
                    Open

                                date_params[:end_date_day]     = edd unless edd.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if d_s.present? instead of unless d_s.blank?.
                    Open

                          unless d_s.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if cat_no.present? instead of unless cat_no.blank?.
                    Open

                          unless cat_no.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if cat_no[1].present? instead of unless cat_no[1].blank?.
                    Open

                            unless cat_no[1].blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use find_or_create_by! instead of find_or_create_by if the return value is not checked.
                    Open

                          @root = Protonym.find_or_create_by(name:       'Root',
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop identifies possible cases where Active Record save! or related should be used instead of save because the model might have failed to save and an exception is better than unhandled failure.

                    This will allow: - update or save calls, assigned to a variable, or used as a condition in an if/unless/case statement. - create calls, assigned to a variable that then has a call to persisted?. - calls if the result is explicitly returned from methods and blocks, or provided as arguments. - calls whose signature doesn't look like an ActiveRecord persistence method.

                    By default it will also allow implicit returns from methods and blocks. that behavior can be turned off with AllowImplicitReturn: false.

                    You can permit receivers that are giving false positives with AllowedReceivers: []

                    Example:

                    # bad
                    user.save
                    user.update(name: 'Joe')
                    user.find_or_create_by(name: 'Joe')
                    user.destroy
                    
                    # good
                    unless user.save
                      # ...
                    end
                    user.save!
                    user.update!(name: 'Joe')
                    user.find_or_create_by!(name: 'Joe')
                    user.destroy!
                    
                    user = User.find_or_create_by(name: 'Joe')
                    unless user.persisted?
                      # ...
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowImplicitReturn: true (default)

                    # good
                    users.each { |u| u.save }
                    
                    def save_user
                      user.save
                    end

                    Example: AllowImplicitReturn: false

                    # bad
                    users.each { |u| u.save }
                    def save_user
                      user.save
                    end
                    
                    # good
                    users.each { |u| u.save! }
                    
                    def save_user
                      user.save!
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowedReceivers: ['merchant.customers', 'Service::Mailer']

                    # bad
                    merchant.create
                    customers.builder.save
                    Mailer.create
                    
                    module Service::Mailer
                      self.create
                    end
                    
                    # good
                    merchant.customers.create
                    MerchantService.merchant.customers.destroy
                    Service::Mailer.update(message: 'Message')
                    ::Service::Mailer.update
                    Services::Service::Mailer.update(message: 'Message')
                    Service::Mailer::update

                    Use if notes.present? instead of unless notes.blank?.
                    Open

                            ret_val[:c_e] = notes unless notes.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use find_or_create_by! instead of find_or_create_by if the return value is not checked.
                    Open

                            @family = Protonym.find_or_create_by(name:       this_family,
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop identifies possible cases where Active Record save! or related should be used instead of save because the model might have failed to save and an exception is better than unhandled failure.

                    This will allow: - update or save calls, assigned to a variable, or used as a condition in an if/unless/case statement. - create calls, assigned to a variable that then has a call to persisted?. - calls if the result is explicitly returned from methods and blocks, or provided as arguments. - calls whose signature doesn't look like an ActiveRecord persistence method.

                    By default it will also allow implicit returns from methods and blocks. that behavior can be turned off with AllowImplicitReturn: false.

                    You can permit receivers that are giving false positives with AllowedReceivers: []

                    Example:

                    # bad
                    user.save
                    user.update(name: 'Joe')
                    user.find_or_create_by(name: 'Joe')
                    user.destroy
                    
                    # good
                    unless user.save
                      # ...
                    end
                    user.save!
                    user.update!(name: 'Joe')
                    user.find_or_create_by!(name: 'Joe')
                    user.destroy!
                    
                    user = User.find_or_create_by(name: 'Joe')
                    unless user.persisted?
                      # ...
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowImplicitReturn: true (default)

                    # good
                    users.each { |u| u.save }
                    
                    def save_user
                      user.save
                    end

                    Example: AllowImplicitReturn: false

                    # bad
                    users.each { |u| u.save }
                    def save_user
                      user.save
                    end
                    
                    # good
                    users.each { |u| u.save! }
                    
                    def save_user
                      user.save!
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowedReceivers: ['merchant.customers', 'Service::Mailer']

                    # bad
                    merchant.create
                    customers.builder.save
                    Mailer.create
                    
                    module Service::Mailer
                      self.create
                    end
                    
                    # good
                    merchant.customers.create
                    MerchantService.merchant.customers.destroy
                    Service::Mailer.update(message: 'Message')
                    ::Service::Mailer.update
                    Services::Service::Mailer.update(message: 'Message')
                    Service::Mailer::update

                    Use if occ_id.present? instead of unless occ_id.blank?.
                    Open

                          unless occ_id.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use find_or_create_by! instead of find_or_create_by if the return value is not checked.
                    Open

                          @animalia = Protonym.find_or_create_by(name:       'Animalia',
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop identifies possible cases where Active Record save! or related should be used instead of save because the model might have failed to save and an exception is better than unhandled failure.

                    This will allow: - update or save calls, assigned to a variable, or used as a condition in an if/unless/case statement. - create calls, assigned to a variable that then has a call to persisted?. - calls if the result is explicitly returned from methods and blocks, or provided as arguments. - calls whose signature doesn't look like an ActiveRecord persistence method.

                    By default it will also allow implicit returns from methods and blocks. that behavior can be turned off with AllowImplicitReturn: false.

                    You can permit receivers that are giving false positives with AllowedReceivers: []

                    Example:

                    # bad
                    user.save
                    user.update(name: 'Joe')
                    user.find_or_create_by(name: 'Joe')
                    user.destroy
                    
                    # good
                    unless user.save
                      # ...
                    end
                    user.save!
                    user.update!(name: 'Joe')
                    user.find_or_create_by!(name: 'Joe')
                    user.destroy!
                    
                    user = User.find_or_create_by(name: 'Joe')
                    unless user.persisted?
                      # ...
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowImplicitReturn: true (default)

                    # good
                    users.each { |u| u.save }
                    
                    def save_user
                      user.save
                    end

                    Example: AllowImplicitReturn: false

                    # bad
                    users.each { |u| u.save }
                    def save_user
                      user.save
                    end
                    
                    # good
                    users.each { |u| u.save! }
                    
                    def save_user
                      user.save!
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowedReceivers: ['merchant.customers', 'Service::Mailer']

                    # bad
                    merchant.create
                    customers.builder.save
                    Mailer.create
                    
                    module Service::Mailer
                      self.create
                    end
                    
                    # good
                    merchant.customers.create
                    MerchantService.merchant.customers.destroy
                    Service::Mailer.update(message: 'Message')
                    ::Service::Mailer.update
                    Services::Service::Mailer.update(message: 'Message')
                    Service::Mailer::update

                    Use find_or_create_by! instead of find_or_create_by if the return value is not checked.
                    Open

                            @kingdom = Protonym.find_or_create_by(name:       this_kingdom,
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop identifies possible cases where Active Record save! or related should be used instead of save because the model might have failed to save and an exception is better than unhandled failure.

                    This will allow: - update or save calls, assigned to a variable, or used as a condition in an if/unless/case statement. - create calls, assigned to a variable that then has a call to persisted?. - calls if the result is explicitly returned from methods and blocks, or provided as arguments. - calls whose signature doesn't look like an ActiveRecord persistence method.

                    By default it will also allow implicit returns from methods and blocks. that behavior can be turned off with AllowImplicitReturn: false.

                    You can permit receivers that are giving false positives with AllowedReceivers: []

                    Example:

                    # bad
                    user.save
                    user.update(name: 'Joe')
                    user.find_or_create_by(name: 'Joe')
                    user.destroy
                    
                    # good
                    unless user.save
                      # ...
                    end
                    user.save!
                    user.update!(name: 'Joe')
                    user.find_or_create_by!(name: 'Joe')
                    user.destroy!
                    
                    user = User.find_or_create_by(name: 'Joe')
                    unless user.persisted?
                      # ...
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowImplicitReturn: true (default)

                    # good
                    users.each { |u| u.save }
                    
                    def save_user
                      user.save
                    end

                    Example: AllowImplicitReturn: false

                    # bad
                    users.each { |u| u.save }
                    def save_user
                      user.save
                    end
                    
                    # good
                    users.each { |u| u.save! }
                    
                    def save_user
                      user.save!
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowedReceivers: ['merchant.customers', 'Service::Mailer']

                    # bad
                    merchant.create
                    customers.builder.save
                    Mailer.create
                    
                    module Service::Mailer
                      self.create
                    end
                    
                    # good
                    merchant.customers.create
                    MerchantService.merchant.customers.destroy
                    Service::Mailer.update(message: 'Message')
                    ::Service::Mailer.update
                    Services::Service::Mailer.update(message: 'Message')
                    Service::Mailer::update

                    Use if geo_remark.present? instead of unless geo_remark.blank?.
                    Open

                            unless geo_remark.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if trial.present? instead of unless trial.blank?.
                    Open

                              unless trial.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use save! instead of save if the return value is not checked.
                    Open

                                        objects.save
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop identifies possible cases where Active Record save! or related should be used instead of save because the model might have failed to save and an exception is better than unhandled failure.

                    This will allow: - update or save calls, assigned to a variable, or used as a condition in an if/unless/case statement. - create calls, assigned to a variable that then has a call to persisted?. - calls if the result is explicitly returned from methods and blocks, or provided as arguments. - calls whose signature doesn't look like an ActiveRecord persistence method.

                    By default it will also allow implicit returns from methods and blocks. that behavior can be turned off with AllowImplicitReturn: false.

                    You can permit receivers that are giving false positives with AllowedReceivers: []

                    Example:

                    # bad
                    user.save
                    user.update(name: 'Joe')
                    user.find_or_create_by(name: 'Joe')
                    user.destroy
                    
                    # good
                    unless user.save
                      # ...
                    end
                    user.save!
                    user.update!(name: 'Joe')
                    user.find_or_create_by!(name: 'Joe')
                    user.destroy!
                    
                    user = User.find_or_create_by(name: 'Joe')
                    unless user.persisted?
                      # ...
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowImplicitReturn: true (default)

                    # good
                    users.each { |u| u.save }
                    
                    def save_user
                      user.save
                    end

                    Example: AllowImplicitReturn: false

                    # bad
                    users.each { |u| u.save }
                    def save_user
                      user.save
                    end
                    
                    # good
                    users.each { |u| u.save! }
                    
                    def save_user
                      user.save!
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowedReceivers: ['merchant.customers', 'Service::Mailer']

                    # bad
                    merchant.create
                    customers.builder.save
                    Mailer.create
                    
                    module Service::Mailer
                      self.create
                    end
                    
                    # good
                    merchant.customers.create
                    MerchantService.merchant.customers.destroy
                    Service::Mailer.update(message: 'Message')
                    ::Service::Mailer.update
                    Services::Service::Mailer.update(message: 'Message')
                    Service::Mailer::update

                    Use find_or_create_by! instead of find_or_create_by if the return value is not checked.
                    Open

                                  @genus     = Protonym.find_or_create_by(name:       genus_name,
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop identifies possible cases where Active Record save! or related should be used instead of save because the model might have failed to save and an exception is better than unhandled failure.

                    This will allow: - update or save calls, assigned to a variable, or used as a condition in an if/unless/case statement. - create calls, assigned to a variable that then has a call to persisted?. - calls if the result is explicitly returned from methods and blocks, or provided as arguments. - calls whose signature doesn't look like an ActiveRecord persistence method.

                    By default it will also allow implicit returns from methods and blocks. that behavior can be turned off with AllowImplicitReturn: false.

                    You can permit receivers that are giving false positives with AllowedReceivers: []

                    Example:

                    # bad
                    user.save
                    user.update(name: 'Joe')
                    user.find_or_create_by(name: 'Joe')
                    user.destroy
                    
                    # good
                    unless user.save
                      # ...
                    end
                    user.save!
                    user.update!(name: 'Joe')
                    user.find_or_create_by!(name: 'Joe')
                    user.destroy!
                    
                    user = User.find_or_create_by(name: 'Joe')
                    unless user.persisted?
                      # ...
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowImplicitReturn: true (default)

                    # good
                    users.each { |u| u.save }
                    
                    def save_user
                      user.save
                    end

                    Example: AllowImplicitReturn: false

                    # bad
                    users.each { |u| u.save }
                    def save_user
                      user.save
                    end
                    
                    # good
                    users.each { |u| u.save! }
                    
                    def save_user
                      user.save!
                    end
                    
                    def save_user
                      return user.save
                    end

                    Example: AllowedReceivers: ['merchant.customers', 'Service::Mailer']

                    # bad
                    merchant.create
                    customers.builder.save
                    Mailer.create
                    
                    module Service::Mailer
                      self.create
                    end
                    
                    # good
                    merchant.customers.create
                    MerchantService.merchant.customers.destroy
                    Service::Mailer.update(message: 'Message')
                    ::Service::Mailer.update
                    Services::Service::Mailer.update(message: 'Message')
                    Service::Mailer::update

                    Use if bio_assoc.present? instead of unless bio_assoc.blank?.
                    Open

                              unless bio_assoc.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if name.present? instead of unless name.blank?.
                    Open

                          unless name.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if edm.present? instead of unless edm.blank?.
                    Open

                                date_params[:end_date_month]   = edm unless edm.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if notes.present? instead of unless notes.blank?.
                    Open

                            ret_val[:g_r] = notes unless notes.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if occ_remark.present? instead of unless occ_remark.blank?.
                    Open

                            unless occ_remark.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if sdd.present? instead of unless sdd.blank?.
                    Open

                                date_params[:start_date_day]   = sdd unless sdd.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if sdm.present? instead of unless sdm.blank?.
                    Open

                                date_params[:start_date_month] = sdm unless sdm.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if loc_remark.present? instead of unless loc_remark.blank?.
                    Open

                            unless loc_remark.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if notes.present? instead of unless notes.blank?.
                    Open

                            ret_val[:c_o] = notes unless notes.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    Use if edy.present? instead of unless edy.blank?.
                    Open

                                date_params[:end_date_year]    = edy unless edy.blank?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by rubocop

                    This cop checks for code that can be written with simpler conditionals using Object#present? defined by Active Support.

                    Interaction with Style/UnlessElse: The configuration of NotBlank will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

                    Example: NotNilAndNotEmpty: true (default)

                    # Converts usages of `!nil? && !empty?` to `present?`
                    
                    # bad
                    !foo.nil? && !foo.empty?
                    
                    # bad
                    foo != nil && !foo.empty?
                    
                    # good
                    foo.present?

                    Example: NotBlank: true (default)

                    # Converts usages of `!blank?` to `present?`
                    
                    # bad
                    !foo.blank?
                    
                    # bad
                    not foo.blank?
                    
                    # good
                    foo.present?

                    Example: UnlessBlank: true (default)

                    # Converts usages of `unless blank?` to `if present?`
                    
                    # bad
                    something unless foo.blank?
                    
                    # good
                    something if foo.present?

                    TODO found
                    Open

                      # TODO: Originally transliterated from Import::CollectingEvents: Remove this to-do after successful operation.
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb by fixme

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

                              unless c_e_notes.blank?
                                apply_note = false
                                c_e_notes.each_key {|kee|
                                  c_e_n = c_e_notes[kee]
                                  if c_e.notes.present?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb and 1 other location - About 55 mins to fix
                    lib/batch_load/import/dwca.rb on lines 249..265

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

                    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

                            unless g_r_notes.blank?
                              apply_note = false
                              g_r_notes.each_key {|kee|
                                g_r_n = g_r_notes[kee]
                                if g_r.notes.present?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb and 1 other location - About 55 mins to fix
                    lib/batch_load/import/dwca.rb on lines 152..168

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

                    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

                          if @kingdom.try(:name) != this_kingdom
                            @kingdom = Protonym.find_or_create_by(name:       this_kingdom,
                                                                  rank_class: Ranks.lookup(:iczn, :kingdom),
                                                                  project_id: @project_id)
                    
                    
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb and 1 other location - About 30 mins to fix
                    lib/batch_load/import/dwca.rb on lines 697..704

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

                    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

                          if @family.try(:name) != this_family
                            @family = Protonym.find_or_create_by(name:       this_family,
                                                                 rank_class: Ranks.lookup(:iczn, :family),
                                                                 project_id: @project_id)
                            if @family.new_record?
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb and 1 other location - About 30 mins to fix
                    lib/batch_load/import/dwca.rb on lines 684..692

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

                    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

                              when :tribe
                                tribe           = snp[:details][0][:uninomial]
                                t_n.parent      = @family
                                t_n.rank_class  = Ranks.lookup(:iczn, :tribe)
                                t_n.name        = tribe[:value]
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb and 1 other location - About 25 mins to fix
                    lib/batch_load/import/dwca.rb on lines 742..747

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

                    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

                              when :genus
                                genus           = snp[:details][0][:uninomial]
                                t_n.parent      = @family
                                t_n.rank_class  = Ranks.lookup(:iczn, :genus)
                                t_n.name        = genus[:value]
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb and 1 other location - About 25 mins to fix
                    lib/batch_load/import/dwca.rb on lines 748..753

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

                    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

                          begin
                            notes      = {}
                            geo_remark = row['georeferenceremarks']
                            unless geo_remark.blank?
                              notes[:remark] = Note.new(text:       geo_remark,
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb and 1 other location - About 20 mins to fix
                    lib/batch_load/import/dwca.rb on lines 533..540

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

                    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

                          begin # collection object notes
                            notes      = {}
                            occ_remark = row['occurrenceremarks']
                            unless occ_remark.blank?
                              notes[:remark] = Note.new(text:       occ_remark,
                    Severity: Minor
                    Found in lib/batch_load/import/dwca.rb and 1 other location - About 20 mins to fix
                    lib/batch_load/import/dwca.rb on lines 512..519

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status