SpeciesFileGroup/taxonworks

View on GitHub
app/models/taxon_name.rb

Summary

Maintainability
F
1 wk
Test Coverage

Class TaxonName has 138 methods (exceeds 20 allowed). Consider refactoring.
Open

class TaxonName < ApplicationRecord
  # @return class
  #   this method calls Module#module_parent
  # TODO: This method can be placed elsewhere inside this class (or even removed if not used)
  #       when https://github.com/ClosureTree/closure_tree/issues/346 is fixed.
Severity: Major
Found in app/models/taxon_name.rb - About 2 days to fix

    File taxon_name.rb has 995 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_dependency Rails.root.to_s + '/app/models/taxon_name_classification.rb'
    require_dependency Rails.root.to_s + '/app/models/taxon_name_relationship.rb'
    
    # A taxonomic name (nomenclature only). See also NOMEN.
    #
    Severity: Major
    Found in app/models/taxon_name.rb - About 2 days to fix

      Method iczn_author_and_year has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

        def iczn_author_and_year
          ay = nil
          p = nil
      
          misapplication = TaxonNameRelationship.where_subject_is_taxon_name(self).with_type_string('TaxonNameRelationship::Iczn::Invalidating::Misapplication')
      Severity: Minor
      Found in app/models/taxon_name.rb - About 5 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 has too many lines. [46/25]
      Open

        def iczn_author_and_year
          ay = nil
          p = nil
      
          misapplication = TaxonNameRelationship.where_subject_is_taxon_name(self).with_type_string('TaxonNameRelationship::Iczn::Invalidating::Misapplication')
      Severity: Minor
      Found in app/models/taxon_name.rb by rubocop

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method sv_missing_original_publication has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def sv_missing_original_publication
          if !self.cached_misspelling && !self.name_is_misapplied?
            if self.source.nil?
              soft_validations.add(:base, 'Original publication is not selected')
            elsif self.origin_citation.pages.blank?
      Severity: Minor
      Found in app/models/taxon_name.rb - About 4 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 sv_validate_name has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

        def sv_validate_name
          correct_name_format = false
      
          if rank_class
            # TODO: name these Regexp somewhere
      Severity: Minor
      Found in app/models/taxon_name.rb - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Consider simplifying this complex logical expression.
      Open

            if (name =~ /^[a-zA-Z]*$/) || # !! should reference NOT_LATIN
                (nomenclatural_code == :iczn && name =~ /^[a-zA-Z]-[a-zA-Z]*$/) ||
                (nomenclatural_code == :icnp && name =~ /^[a-zA-Z]-[a-zA-Z]*$/) ||
                (nomenclatural_code == :icn && name =~  /^[a-zA-Z]*-[a-zA-Z]*$/) ||
                (nomenclatural_code == :icn && name =~  /^[a-zA-Z]*\s×\s[a-zA-Z]*$/) ||
      Severity: Critical
      Found in app/models/taxon_name.rb - About 3 hrs to fix

        Method nomenclature_date has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          def nomenclature_date
            return nil if self.id.nil?
             family_before_1961 = TaxonNameRelationship.where_subject_is_taxon_name(self).with_type_string('TaxonNameRelationship::Iczn::PotentiallyValidating::FamilyBefore1961').first
        
            # family_before_1961 = taxon_name_relationships.with_type_string('TaxonNameRelationship::Iczn::PotentiallyValidating::FamilyBefore1961').first
        Severity: Minor
        Found in app/models/taxon_name.rb - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method list_of_invalid_taxon_names has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def list_of_invalid_taxon_names
            first_pass = true
            list = {}
            while first_pass || !list.keys.select{|t| list[t] == false}.empty? do
              first_pass = false
        Severity: Minor
        Found in app/models/taxon_name.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 has too many lines. [29/25]
        Open

          def full_name_hash
            gender = nil
            data   = {}
            safe_self_and_ancestors.each do |i| # !! You can not use self.self_and_ancestors because (this) record is not saved off.
              rank   = i.rank
        Severity: Minor
        Found in app/models/taxon_name.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Method icn_author_and_year has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def icn_author_and_year
            ay = nil
        
            basionym = TaxonNameRelationship.where_object_is_taxon_name(self).
              with_type_string('TaxonNameRelationship::Icn::Unaccepting::Usage::Basionym')
        Severity: Minor
        Found in app/models/taxon_name.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 full_name_hash has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          def full_name_hash
            gender = nil
            data   = {}
            safe_self_and_ancestors.each do |i| # !! You can not use self.self_and_ancestors because (this) record is not saved off.
              rank   = i.rank
        Severity: Minor
        Found in app/models/taxon_name.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 has too many lines. [27/25]
        Open

          def sv_validate_name
            correct_name_format = false
        
            if rank_class
              # TODO: name these Regexp somewhere
        Severity: Minor
        Found in app/models/taxon_name.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Method iczn_author_and_year has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def iczn_author_and_year
            ay = nil
            p = nil
        
            misapplication = TaxonNameRelationship.where_subject_is_taxon_name(self).with_type_string('TaxonNameRelationship::Iczn::Invalidating::Misapplication')
        Severity: Minor
        Found in app/models/taxon_name.rb - About 1 hr to fix

          Method sv_fix_parent_is_valid_name has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def sv_fix_parent_is_valid_name
              if self.parent.unavailable_or_invalid?
                new_parent = self.parent.get_valid_taxon_name
                if self.parent != new_parent
                  self.parent = new_parent
          Severity: Minor
          Found in app/models/taxon_name.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 full_name_hash has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def full_name_hash
              gender = nil
              data   = {}
              safe_self_and_ancestors.each do |i| # !! You can not use self.self_and_ancestors because (this) record is not saved off.
                rank   = i.rank
          Severity: Minor
          Found in app/models/taxon_name.rb - About 1 hr to fix

            Method sv_validate_name has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def sv_validate_name
                correct_name_format = false
            
                if rank_class
                  # TODO: name these Regexp somewhere
            Severity: Minor
            Found in app/models/taxon_name.rb - About 1 hr to fix

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

                def check_new_parent_class
                  if is_protonym? && parent_id != parent_id_was && !parent_id_was.nil? && nomenclatural_code == :iczn
                    if old_parent = TaxonName.find_by(id: parent_id_was)
                      if (rank_name == 'subgenus' || rank_name == 'subspecies') && old_parent.name == name
                        errors.add(:parent_id, "The nominotypical #{rank_name} #{name} can not be moved out of the nominal #{old_parent.rank_name}")
              Severity: Minor
              Found in app/models/taxon_name.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 get_full_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def get_full_name
                  return name if type != 'Combination' && !GENUS_AND_SPECIES_RANK_NAMES.include?(rank_string)
                  return name if type != 'Combination' && !GENUS_AND_SPECIES_RANK_NAMES.include?(rank_string)
                  return name if rank_class.to_s =~ /Ictv/
                  return verbatim_name if !verbatim_name.nil? && type == 'Combination'
              Severity: Minor
              Found in app/models/taxon_name.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

              Consider simplifying this complex logical expression.
              Open

                  if data['species'].nil? && (!data['subspecies'].nil? || !data['variety'].nil? || !data['subvariety'].nil? || !data['form'].nil? || !data['subform'].nil?)
                    data['species'] = [nil, '[SPECIES NOT SPECIFIED]']
                  end
              Severity: Major
              Found in app/models/taxon_name.rb - About 40 mins to fix

                Method sv_fix_missing_author has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def sv_fix_missing_author
                    if self.source
                      unless self.source.author.blank?
                        self.verbatim_author = self.source.authority_name
                        begin
                Severity: Minor
                Found in app/models/taxon_name.rb - About 35 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 sv_incomplete_combination has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def sv_incomplete_combination
                    soft_validations.add(:base, 'The genus in the combination is not specified') if !cached.nil? && cached.include?('GENUS NOT SPECIFIED')
                    soft_validations.add(:base, 'The species in the combination is not specified') if !cached.nil? && cached.include?('SPECIES NOT SPECIFIED')
                    soft_validations.add(:base, 'The variety in the combination is not specified') if !cached.nil? && cached.include?('VARIETY NOT SPECIFIED')
                    soft_validations.add(:base, 'The form in the combination is not specified') if !cached.nil? && cached.include?('FORM NOT SPECIFIED')
                Severity: Minor
                Found in app/models/taxon_name.rb - About 35 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 sv_fix_missing_year has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def sv_fix_missing_year
                    if self.source
                      if self.source.year
                        self.year_of_publication = self.source.year
                        begin
                Severity: Minor
                Found in app/models/taxon_name.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 get_full_name_html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def get_full_name_html(name = nil)
                    name = get_full_name if name.nil? 
                    n = name
                    # n = verbatim_name.blank? ? name : verbatim_name
                    return  "\"<i>Candidatus</i> #{n}\"" if is_candidatus?
                Severity: Minor
                Found in app/models/taxon_name.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

                Avoid more than 3 levels of block nesting.
                Open

                          ay = '(' + ay + ')' unless ay.empty? if og.name != cg.name
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for excessive nesting of conditional and looping constructs.

                You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

                The maximum level of nesting allowed is configurable.

                Avoid more than 3 levels of block nesting.
                Open

                          maxP = matchdata[2] ? matchdata[2].to_i : matchdata[3].to_i
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for excessive nesting of conditional and looping constructs.

                You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

                The maximum level of nesting allowed is configurable.

                Avoid more than 3 levels of block nesting.
                Open

                          minP = matchdata[1] ? matchdata[1].to_i : matchdata[3].to_i
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for excessive nesting of conditional and looping constructs.

                You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

                The maximum level of nesting allowed is configurable.

                Avoid more than 3 levels of block nesting.
                Open

                          unless (maxP && minP && minP <= self.origin_citation.pages.to_i && maxP >= self.origin_citation.pages.to_i)
                            soft_validations.add(:base, "Original citation is out of the source page range")
                          end
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for excessive nesting of conditional and looping constructs.

                You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

                The maximum level of nesting allowed is configurable.

                Avoid more than 3 levels of block nesting.
                Open

                          minP = 1 if minP == maxP && maxP.to_s == self.source.pages && %w{book booklet manual mastersthesis phdthesis techreport}.include?(self.source.bibtex_type)
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for excessive nesting of conditional and looping constructs.

                You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

                The maximum level of nesting allowed is configurable.

                Prefer self[:attr] = val over write_attribute(:attr, val).
                Open

                    write_attribute(:rank_class, value.to_s)
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of the read_attribute or write_attribute methods and recommends square brackets instead.

                If an attribute is missing from the instance (for example, when initialized by a partial select) then read_attribute will return nil, but square brackets will raise an ActiveModel::MissingAttributeError.

                Explicitly raising an error in this situation is preferable, and that is why rubocop recommends using square brackets.

                Example:

                # bad
                x = read_attribute(:attr)
                write_attribute(:attr, val)
                
                # good
                x = self[:attr]
                self[:attr] = val

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

                            self.save
                Severity: Minor
                Found in app/models/taxon_name.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

                Specify an :inverse_of option.
                Open

                  has_many :historical_taxon_names, class_name: 'TaxonName', foreign_key: :cached_valid_taxon_name_id
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop looks for has(one|many) and belongsto associations where Active Record can't automatically determine the inverse association because of a scope or the options used. Using the blog with order scope example below, traversing the a Blog's association in both directions with blog.posts.first.blog would cause the blog to be loaded from the database twice.

                :inverse_of must be manually specified for Active Record to use the associated object in memory, or set to false to opt-out. Note that setting nil does not stop Active Record from trying to determine the inverse automatically, and is not considered a valid value for this.

                Example:

                # good
                class Blog < ApplicationRecord
                  has_many :posts
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end

                Example:

                # bad
                class Blog < ApplicationRecord
                  has_many :posts, -> { order(published_at: :desc) }
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                class Blog < ApplicationRecord
                  has_many(:posts,
                           -> { order(published_at: :desc) },
                           inverse_of: :blog)
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                class Blog < ApplicationRecord
                  with_options inverse_of: :blog do
                    has_many :posts, -> { order(published_at: :desc) }
                  end
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                # When you don't want to use the inverse association.
                class Blog < ApplicationRecord
                  has_many(:posts,
                           -> { order(published_at: :desc) },
                           inverse_of: false)
                end

                Example:

                # bad
                class Picture < ApplicationRecord
                  belongs_to :imageable, polymorphic: true
                end
                
                class Employee < ApplicationRecord
                  has_many :pictures, as: :imageable
                end
                
                class Product < ApplicationRecord
                  has_many :pictures, as: :imageable
                end
                
                # good
                class Picture < ApplicationRecord
                  belongs_to :imageable, polymorphic: true
                end
                
                class Employee < ApplicationRecord
                  has_many :pictures, as: :imageable, inverse_of: :imageable
                end
                
                class Product < ApplicationRecord
                  has_many :pictures, as: :imageable, inverse_of: :imageable
                end

                Example:

                # bad
                # However, RuboCop can not detect this pattern...
                class Physician < ApplicationRecord
                  has_many :appointments
                  has_many :patients, through: :appointments
                end
                
                class Appointment < ApplicationRecord
                  belongs_to :physician
                  belongs_to :patient
                end
                
                class Patient < ApplicationRecord
                  has_many :appointments
                  has_many :physicians, through: :appointments
                end
                
                # good
                class Physician < ApplicationRecord
                  has_many :appointments
                  has_many :patients, through: :appointments
                end
                
                class Appointment < ApplicationRecord
                  belongs_to :physician, inverse_of: :appointments
                  belongs_to :patient, inverse_of: :appointments
                end
                
                class Patient < ApplicationRecord
                  has_many :appointments
                  has_many :physicians, through: :appointments
                end

                @see https://guides.rubyonrails.org/association_basics.html#bi-directional-associations @see https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses

                Specify an :inverse_of option.
                Open

                  belongs_to :valid_taxon_name, class_name: 'TaxonName', foreign_key: :cached_valid_taxon_name_id
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop looks for has(one|many) and belongsto associations where Active Record can't automatically determine the inverse association because of a scope or the options used. Using the blog with order scope example below, traversing the a Blog's association in both directions with blog.posts.first.blog would cause the blog to be loaded from the database twice.

                :inverse_of must be manually specified for Active Record to use the associated object in memory, or set to false to opt-out. Note that setting nil does not stop Active Record from trying to determine the inverse automatically, and is not considered a valid value for this.

                Example:

                # good
                class Blog < ApplicationRecord
                  has_many :posts
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end

                Example:

                # bad
                class Blog < ApplicationRecord
                  has_many :posts, -> { order(published_at: :desc) }
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                class Blog < ApplicationRecord
                  has_many(:posts,
                           -> { order(published_at: :desc) },
                           inverse_of: :blog)
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                class Blog < ApplicationRecord
                  with_options inverse_of: :blog do
                    has_many :posts, -> { order(published_at: :desc) }
                  end
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                # When you don't want to use the inverse association.
                class Blog < ApplicationRecord
                  has_many(:posts,
                           -> { order(published_at: :desc) },
                           inverse_of: false)
                end

                Example:

                # bad
                class Picture < ApplicationRecord
                  belongs_to :imageable, polymorphic: true
                end
                
                class Employee < ApplicationRecord
                  has_many :pictures, as: :imageable
                end
                
                class Product < ApplicationRecord
                  has_many :pictures, as: :imageable
                end
                
                # good
                class Picture < ApplicationRecord
                  belongs_to :imageable, polymorphic: true
                end
                
                class Employee < ApplicationRecord
                  has_many :pictures, as: :imageable, inverse_of: :imageable
                end
                
                class Product < ApplicationRecord
                  has_many :pictures, as: :imageable, inverse_of: :imageable
                end

                Example:

                # bad
                # However, RuboCop can not detect this pattern...
                class Physician < ApplicationRecord
                  has_many :appointments
                  has_many :patients, through: :appointments
                end
                
                class Appointment < ApplicationRecord
                  belongs_to :physician
                  belongs_to :patient
                end
                
                class Patient < ApplicationRecord
                  has_many :appointments
                  has_many :physicians, through: :appointments
                end
                
                # good
                class Physician < ApplicationRecord
                  has_many :appointments
                  has_many :patients, through: :appointments
                end
                
                class Appointment < ApplicationRecord
                  belongs_to :physician, inverse_of: :appointments
                  belongs_to :patient, inverse_of: :appointments
                end
                
                class Patient < ApplicationRecord
                  has_many :appointments
                  has_many :physicians, through: :appointments
                end

                @see https://guides.rubyonrails.org/association_basics.html#bi-directional-associations @see https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses

                Use elements.presence instead of elements.blank? ? nil : elements.
                Open

                    elements.blank? ? nil : elements
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks code that can be written more easily using Object#presence defined by Active Support.

                Example:

                # bad
                a.present? ? a : nil
                
                # bad
                !a.present? ? nil : a
                
                # bad
                a.blank? ? nil : a
                
                # bad
                !a.blank? ? a : nil
                
                # good
                a.presence

                Example:

                # bad
                a.present? ? a : b
                
                # bad
                !a.present? ? b : a
                
                # bad
                a.blank? ? b : a
                
                # bad
                !a.blank? ? a : b
                
                # good
                a.presence || b

                Avoid using update_column because it skips validations.
                Open

                    update_column(:cached_valid_taxon_name_id, get_valid_taxon_name.id)
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations

                Methods may be ignored from this rule by configuring a Whitelist.

                Example:

                # bad
                Article.first.decrement!(:view_count)
                DiscussionBoard.decrement_counter(:post_count, 5)
                Article.first.increment!(:view_count)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                product.touch
                Billing.update_all("category = 'authorized', author = 'David'")
                user.update_attribute(:website, 'example.com')
                user.update_columns(last_request_at: Time.current)
                Post.update_counters 5, comment_count: -1, action_count: 1
                
                # good
                user.update(website: 'example.com')
                FileUtils.touch('file')

                Example: Whitelist: ["touch"]

                # bad
                DiscussionBoard.decrement_counter(:post_count, 5)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                
                # good
                user.touch

                Specify a :dependent option.
                Open

                  has_many :historical_taxon_names, class_name: 'TaxonName', foreign_key: :cached_valid_taxon_name_id
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop looks for has_many or has_one associations that don't specify a :dependent option. It doesn't register an offense if :through option was specified.

                Example:

                # bad
                class User < ActiveRecord::Base
                  has_many :comments
                  has_one :avatar
                end
                
                # good
                class User < ActiveRecord::Base
                  has_many :comments, dependent: :restrict_with_exception
                  has_one :avatar, dependent: :destroy
                  has_many :patients, through: :appointments
                end

                Prefer 1.week.
                Open

                      .or( t2[:created_at].between( 1.weeks.ago..Time.now ) ).to_sql
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for correct grammar when using ActiveSupport's core extensions to the numeric classes.

                Example:

                # bad
                3.day.ago
                1.months.ago
                
                # good
                3.days.ago
                1.month.ago

                Use ay.presence instead of ay.blank? ? nil : ay.
                Open

                    ay.blank? ? nil : ay
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks code that can be written more easily using Object#presence defined by Active Support.

                Example:

                # bad
                a.present? ? a : nil
                
                # bad
                !a.present? ? nil : a
                
                # bad
                a.blank? ? nil : a
                
                # bad
                !a.blank? ? a : nil
                
                # good
                a.presence

                Example:

                # bad
                a.present? ? a : b
                
                # bad
                !a.present? ? b : a
                
                # bad
                a.blank? ? b : a
                
                # bad
                !a.blank? ? a : b
                
                # good
                a.presence || b

                Prefer self[:attr] over read_attribute(:attr).
                Open

                    r = read_attribute(:rank_class)
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of the read_attribute or write_attribute methods and recommends square brackets instead.

                If an attribute is missing from the instance (for example, when initialized by a partial select) then read_attribute will return nil, but square brackets will raise an ActiveModel::MissingAttributeError.

                Explicitly raising an error in this situation is preferable, and that is why rubocop recommends using square brackets.

                Example:

                # bad
                x = read_attribute(:attr)
                write_attribute(:attr, val)
                
                # good
                x = self[:attr]
                self[:attr] = val

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

                        self.save
                Severity: Minor
                Found in app/models/taxon_name.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 project_id.present? instead of !project_id.blank?.
                Open

                    if parent && !project_id.blank?
                Severity: Minor
                Found in app/models/taxon_name.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

                            self.save
                Severity: Minor
                Found in app/models/taxon_name.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

                Prefer 1.week.
                Open

                    sql2 = t1[:created_at].between( 1.weeks.ago..Time.now )
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for correct grammar when using ActiveSupport's core extensions to the numeric classes.

                Example:

                # bad
                3.day.ago
                1.months.ago
                
                # good
                3.days.ago
                1.month.ago

                Use n.presence || name instead of n.blank? ? name : n.
                Open

                    n = n.blank? ? name : n
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks code that can be written more easily using Object#presence defined by Active Support.

                Example:

                # bad
                a.present? ? a : nil
                
                # bad
                !a.present? ? nil : a
                
                # bad
                a.blank? ? nil : a
                
                # bad
                !a.blank? ? a : nil
                
                # good
                a.presence

                Example:

                # bad
                a.present? ? a : b
                
                # bad
                !a.present? ? b : a
                
                # bad
                a.blank? ? b : a
                
                # bad
                !a.blank? ? a : b
                
                # good
                a.presence || b

                Use n.present? instead of !n.blank?.
                Open

                    if !n.blank? && is_hybrid?
                Severity: Minor
                Found in app/models/taxon_name.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 mobj.present? instead of !mobj.blank?.
                Open

                    if !mobj.blank?
                Severity: Minor
                Found in app/models/taxon_name.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 self.source.author.present? instead of unless self.source.author.blank?.
                Open

                      unless self.source.author.blank?
                Severity: Minor
                Found in app/models/taxon_name.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?

                Avoid using update_column because it skips validations.
                Open

                    update_column(:cached_html, get_full_name_html(n))
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations

                Methods may be ignored from this rule by configuring a Whitelist.

                Example:

                # bad
                Article.first.decrement!(:view_count)
                DiscussionBoard.decrement_counter(:post_count, 5)
                Article.first.increment!(:view_count)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                product.touch
                Billing.update_all("category = 'authorized', author = 'David'")
                user.update_attribute(:website, 'example.com')
                user.update_columns(last_request_at: Time.current)
                Post.update_counters 5, comment_count: -1, action_count: 1
                
                # good
                user.update(website: 'example.com')
                FileUtils.touch('file')

                Example: Whitelist: ["touch"]

                # bad
                DiscussionBoard.decrement_counter(:post_count, 5)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                
                # good
                user.touch

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

                            self.save
                Severity: Minor
                Found in app/models/taxon_name.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 self.source.pages.present? instead of !self.source.pages.blank?.
                Open

                      elsif !self.source.pages.blank? && self.origin_citation.pages =~ /\A[0-9]+\z/
                Severity: Minor
                Found in app/models/taxon_name.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?

                Avoid using update_column because it skips validations.
                Open

                    update_column(:cached_author_year, get_author_and_year)
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations

                Methods may be ignored from this rule by configuring a Whitelist.

                Example:

                # bad
                Article.first.decrement!(:view_count)
                DiscussionBoard.decrement_counter(:post_count, 5)
                Article.first.increment!(:view_count)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                product.touch
                Billing.update_all("category = 'authorized', author = 'David'")
                user.update_attribute(:website, 'example.com')
                user.update_columns(last_request_at: Time.current)
                Post.update_counters 5, comment_count: -1, action_count: 1
                
                # good
                user.update(website: 'example.com')
                FileUtils.touch('file')

                Example: Whitelist: ["touch"]

                # bad
                DiscussionBoard.decrement_counter(:post_count, 5)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                
                # good
                user.touch

                Specify an :inverse_of option.
                Open

                  has_one :source_classified_as_relationship, -> {
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop looks for has(one|many) and belongsto associations where Active Record can't automatically determine the inverse association because of a scope or the options used. Using the blog with order scope example below, traversing the a Blog's association in both directions with blog.posts.first.blog would cause the blog to be loaded from the database twice.

                :inverse_of must be manually specified for Active Record to use the associated object in memory, or set to false to opt-out. Note that setting nil does not stop Active Record from trying to determine the inverse automatically, and is not considered a valid value for this.

                Example:

                # good
                class Blog < ApplicationRecord
                  has_many :posts
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end

                Example:

                # bad
                class Blog < ApplicationRecord
                  has_many :posts, -> { order(published_at: :desc) }
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                class Blog < ApplicationRecord
                  has_many(:posts,
                           -> { order(published_at: :desc) },
                           inverse_of: :blog)
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                class Blog < ApplicationRecord
                  with_options inverse_of: :blog do
                    has_many :posts, -> { order(published_at: :desc) }
                  end
                end
                
                class Post < ApplicationRecord
                  belongs_to :blog
                end
                
                # good
                # When you don't want to use the inverse association.
                class Blog < ApplicationRecord
                  has_many(:posts,
                           -> { order(published_at: :desc) },
                           inverse_of: false)
                end

                Example:

                # bad
                class Picture < ApplicationRecord
                  belongs_to :imageable, polymorphic: true
                end
                
                class Employee < ApplicationRecord
                  has_many :pictures, as: :imageable
                end
                
                class Product < ApplicationRecord
                  has_many :pictures, as: :imageable
                end
                
                # good
                class Picture < ApplicationRecord
                  belongs_to :imageable, polymorphic: true
                end
                
                class Employee < ApplicationRecord
                  has_many :pictures, as: :imageable, inverse_of: :imageable
                end
                
                class Product < ApplicationRecord
                  has_many :pictures, as: :imageable, inverse_of: :imageable
                end

                Example:

                # bad
                # However, RuboCop can not detect this pattern...
                class Physician < ApplicationRecord
                  has_many :appointments
                  has_many :patients, through: :appointments
                end
                
                class Appointment < ApplicationRecord
                  belongs_to :physician
                  belongs_to :patient
                end
                
                class Patient < ApplicationRecord
                  has_many :appointments
                  has_many :physicians, through: :appointments
                end
                
                # good
                class Physician < ApplicationRecord
                  has_many :appointments
                  has_many :patients, through: :appointments
                end
                
                class Appointment < ApplicationRecord
                  belongs_to :physician, inverse_of: :appointments
                  belongs_to :patient, inverse_of: :appointments
                end
                
                class Patient < ApplicationRecord
                  has_many :appointments
                  has_many :physicians, through: :appointments
                end

                @see https://guides.rubyonrails.org/association_basics.html#bi-directional-associations @see https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses

                Prefer self[:attr] over read_attribute(:attr).
                Open

                    read_attribute(:rank_class)
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of the read_attribute or write_attribute methods and recommends square brackets instead.

                If an attribute is missing from the instance (for example, when initialized by a partial select) then read_attribute will return nil, but square brackets will raise an ActiveModel::MissingAttributeError.

                Explicitly raising an error in this situation is preferable, and that is why rubocop recommends using square brackets.

                Example:

                # bad
                x = read_attribute(:attr)
                write_attribute(:attr, val)
                
                # good
                x = self[:attr]
                self[:attr] = val

                Avoid using update_column because it skips validations.
                Open

                    update_column(:cached, n)
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations

                Methods may be ignored from this rule by configuring a Whitelist.

                Example:

                # bad
                Article.first.decrement!(:view_count)
                DiscussionBoard.decrement_counter(:post_count, 5)
                Article.first.increment!(:view_count)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                product.touch
                Billing.update_all("category = 'authorized', author = 'David'")
                user.update_attribute(:website, 'example.com')
                user.update_columns(last_request_at: Time.current)
                Post.update_counters 5, comment_count: -1, action_count: 1
                
                # good
                user.update(website: 'example.com')
                FileUtils.touch('file')

                Example: Whitelist: ["touch"]

                # bad
                DiscussionBoard.decrement_counter(:post_count, 5)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                
                # good
                user.touch

                Avoid using update_column because it skips validations.
                Open

                    update_column(:cached_classified_as, get_cached_classified_as)
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations

                Methods may be ignored from this rule by configuring a Whitelist.

                Example:

                # bad
                Article.first.decrement!(:view_count)
                DiscussionBoard.decrement_counter(:post_count, 5)
                Article.first.increment!(:view_count)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                product.touch
                Billing.update_all("category = 'authorized', author = 'David'")
                user.update_attribute(:website, 'example.com')
                user.update_columns(last_request_at: Time.current)
                Post.update_counters 5, comment_count: -1, action_count: 1
                
                # good
                user.update(website: 'example.com')
                FileUtils.touch('file')

                Example: Whitelist: ["touch"]

                # bad
                DiscussionBoard.decrement_counter(:post_count, 5)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                
                # good
                user.touch

                Prefer 1.week.
                Open

                      .where(taxon_name_classifications: { created_at: 1.weeks.ago..Time.now } )
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for correct grammar when using ActiveSupport's core extensions to the numeric classes.

                Example:

                # bad
                3.day.ago
                1.months.ago
                
                # good
                3.days.ago
                1.month.ago

                Use ay.presence instead of ay.blank? ? nil : ay.
                Open

                    ay.blank? ? nil : ay
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks code that can be written more easily using Object#presence defined by Active Support.

                Example:

                # bad
                a.present? ? a : nil
                
                # bad
                !a.present? ? nil : a
                
                # bad
                a.blank? ? nil : a
                
                # bad
                !a.blank? ? a : nil
                
                # good
                a.presence

                Example:

                # bad
                a.present? ? a : b
                
                # bad
                !a.present? ? b : a
                
                # bad
                a.blank? ? b : a
                
                # bad
                !a.blank? ? a : b
                
                # good
                a.presence || b

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

                    return " (as #{r.name})" unless r.blank?
                Severity: Minor
                Found in app/models/taxon_name.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?

                Avoid using update_columns because it skips validations.
                Open

                    update_columns(
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations

                Methods may be ignored from this rule by configuring a Whitelist.

                Example:

                # bad
                Article.first.decrement!(:view_count)
                DiscussionBoard.decrement_counter(:post_count, 5)
                Article.first.increment!(:view_count)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                product.touch
                Billing.update_all("category = 'authorized', author = 'David'")
                user.update_attribute(:website, 'example.com')
                user.update_columns(last_request_at: Time.current)
                Post.update_counters 5, comment_count: -1, action_count: 1
                
                # good
                user.update(website: 'example.com')
                FileUtils.touch('file')

                Example: Whitelist: ["touch"]

                # bad
                DiscussionBoard.decrement_counter(:post_count, 5)
                DiscussionBoard.increment_counter(:post_count, 5)
                person.toggle :active
                
                # good
                user.touch

                TODO found
                Open

                  # TODO: this was not implemented and tested properly
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  # TODO: This method can be placed elsewhere inside this class (or even removed if not used)
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  #    TODO: does this form of the name contain parens for subgenus?
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  # TODO: move to Protonym when we eliminate TaxonName.new()
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  # TODO: think of a different name, and test
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  # TODO: does this make sense now, with #valid_taxon_name_id in place?
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  #    TODO: provide a default to gender (but do NOT eliminate param)
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  # return [String, nil, false] # TODO: fix
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  # TODO: move some of these down to Protonym when they don't apply to Combination
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  #    TODO: on third thought- eliminate this mess
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  # TODO: deprecate all of these for where()
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                      # TODO: name these Regexp somewhere
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

                TODO found
                Open

                  # TODO: Can't we just use #valid_id now?
                Severity: Minor
                Found in app/models/taxon_name.rb by fixme

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

                  def check_new_parent_class
                    if is_protonym? && parent_id != parent_id_was && !parent_id_was.nil? && nomenclatural_code == :iczn
                      if old_parent = TaxonName.find_by(id: parent_id_was)
                        if (rank_name == 'subgenus' || rank_name == 'subspecies') && old_parent.name == name
                          errors.add(:parent_id, "The nominotypical #{rank_name} #{name} can not be moved out of the nominal #{old_parent.rank_name}")
                Severity: Major
                Found in app/models/taxon_name.rb and 1 other location - About 1 hr to fix
                app/models/protonym.rb on lines 747..754

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

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

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

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

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

                Refactorings

                Further Reading

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

                    if data['species'].nil? && (!data['subspecies'].nil? || !data['variety'].nil? || !data['subvariety'].nil? || !data['form'].nil? || !data['subform'].nil?)
                      data['species'] = [nil, '[SPECIES NOT SPECIFIED]']
                    end
                Severity: Minor
                Found in app/models/taxon_name.rb and 1 other location - About 45 mins to fix
                app/models/combination.rb on lines 298..300

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

                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

                  scope :ancestors_and_descendants_of, -> (taxon_name) do
                    scoping do
                      a = TaxonName.self_and_ancestors_of(taxon_name)
                      b = TaxonName.descendants_of(taxon_name)
                      TaxonName.from("((#{a.to_sql}) UNION (#{b.to_sql})) as taxon_names")
                Severity: Minor
                Found in app/models/taxon_name.rb and 1 other location - About 20 mins to fix
                app/models/geographic_area.rb on lines 104..110

                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

                    if !n.blank? && is_hybrid?
                      w = n.split(' ')
                      w[-1] = ('×' + w[-1]).gsub('×(', '(×')
                      n = w.join(' ')
                    end
                Severity: Minor
                Found in app/models/taxon_name.rb and 1 other location - About 15 mins to fix
                app/models/protonym.rb on lines 656..660

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

                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

                Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
                Open

                      .or( t2[:created_at].between( 1.weeks.ago..Time.now ) ).to_sql
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of Time methods without zone.

                Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time) and the article http://danilenko.org/2012/7/6/rails_timezones/

                Two styles are supported for this cop. When EnforcedStyle is 'strict' then only use of Time.zone is allowed.

                When EnforcedStyle is 'flexible' then it's also allowed to use Time.intimezone.

                Example: EnforcedStyle: strict

                # `strict` means that `Time` should be used with `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # bad
                Time.current
                Time.at(timestamp).in_time_zone
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')

                Example: EnforcedStyle: flexible (default)

                # `flexible` allows usage of `in_time_zone` instead of `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')
                
                # good
                Time.current
                Time.at(timestamp).in_time_zone

                Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
                Open

                  validates :year_of_publication, date_year: {min_year: 1000, max_year: Time.now.year + 5}
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of Time methods without zone.

                Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time) and the article http://danilenko.org/2012/7/6/rails_timezones/

                Two styles are supported for this cop. When EnforcedStyle is 'strict' then only use of Time.zone is allowed.

                When EnforcedStyle is 'flexible' then it's also allowed to use Time.intimezone.

                Example: EnforcedStyle: strict

                # `strict` means that `Time` should be used with `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # bad
                Time.current
                Time.at(timestamp).in_time_zone
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')

                Example: EnforcedStyle: flexible (default)

                # `flexible` allows usage of `in_time_zone` instead of `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')
                
                # good
                Time.current
                Time.at(timestamp).in_time_zone

                Prefer single-quoted strings when you don't need string interpolation or special symbols.
                Open

                      errors.add(:project_id, "The parent taxon is not from the same project") if project_id != parent.project_id
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                Checks if uses of quotes match the configured preference.

                Example: EnforcedStyle: single_quotes (default)

                # bad
                "No special symbols"
                "No string interpolation"
                "Just text"
                
                # good
                'No special symbols'
                'No string interpolation'
                'Just text'
                "Wait! What's #{this}!"

                Example: EnforcedStyle: double_quotes

                # bad
                'Just some text'
                'No special chars or interpolation'
                
                # good
                "Just some text"
                "No special chars or interpolation"
                "Every string in #{project} uses double_quotes"

                Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
                Open

                    list.sort_by{|t, a| (t.nomenclature_date || Time.now)}.collect{|t, a| t}
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of Time methods without zone.

                Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time) and the article http://danilenko.org/2012/7/6/rails_timezones/

                Two styles are supported for this cop. When EnforcedStyle is 'strict' then only use of Time.zone is allowed.

                When EnforcedStyle is 'flexible' then it's also allowed to use Time.intimezone.

                Example: EnforcedStyle: strict

                # `strict` means that `Time` should be used with `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # bad
                Time.current
                Time.at(timestamp).in_time_zone
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')

                Example: EnforcedStyle: flexible (default)

                # `flexible` allows usage of `in_time_zone` instead of `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')
                
                # good
                Time.current
                Time.at(timestamp).in_time_zone

                Prefer the new style validations validates :column, presence: value over validates_presence_of.
                Open

                  validates_presence_of :type, message: 'is not specified'
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of old-style attribute validation macros.

                Example:

                # bad
                validates_acceptance_of :foo
                validates_confirmation_of :foo
                validates_exclusion_of :foo
                validates_format_of :foo
                validates_inclusion_of :foo
                validates_length_of :foo
                validates_numericality_of :foo
                validates_presence_of :foo
                validates_absence_of :foo
                validates_size_of :foo
                validates_uniqueness_of :foo
                
                # good
                validates :foo, acceptance: true
                validates :foo, confirmation: true
                validates :foo, exclusion: true
                validates :foo, format: true
                validates :foo, inclusion: true
                validates :foo, length: true
                validates :foo, numericality: true
                validates :foo, presence: true
                validates :foo, absence: true
                validates :foo, size: true
                validates :foo, uniqueness: true

                Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
                Open

                      .where(taxon_name_classifications: { created_at: 1.weeks.ago..Time.now } )
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of Time methods without zone.

                Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time) and the article http://danilenko.org/2012/7/6/rails_timezones/

                Two styles are supported for this cop. When EnforcedStyle is 'strict' then only use of Time.zone is allowed.

                When EnforcedStyle is 'flexible' then it's also allowed to use Time.intimezone.

                Example: EnforcedStyle: strict

                # `strict` means that `Time` should be used with `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # bad
                Time.current
                Time.at(timestamp).in_time_zone
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')

                Example: EnforcedStyle: flexible (default)

                # `flexible` allows usage of `in_time_zone` instead of `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')
                
                # good
                Time.current
                Time.at(timestamp).in_time_zone

                Do not use Time.now without zone. Use one of Time.zone.now, Time.current, Time.now.in_time_zone, Time.now.utc, Time.now.getlocal, Time.now.xmlschema, Time.now.iso8601, Time.now.jisx0301, Time.now.rfc3339, Time.now.httpdate, Time.now.to_i, Time.now.to_f instead.
                Open

                    sql2 = t1[:created_at].between( 1.weeks.ago..Time.now )
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                This cop checks for the use of Time methods without zone.

                Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time) and the article http://danilenko.org/2012/7/6/rails_timezones/

                Two styles are supported for this cop. When EnforcedStyle is 'strict' then only use of Time.zone is allowed.

                When EnforcedStyle is 'flexible' then it's also allowed to use Time.intimezone.

                Example: EnforcedStyle: strict

                # `strict` means that `Time` should be used with `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # bad
                Time.current
                Time.at(timestamp).in_time_zone
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')

                Example: EnforcedStyle: flexible (default)

                # `flexible` allows usage of `in_time_zone` instead of `zone`.
                
                # bad
                Time.now
                Time.parse('2015-03-02 19:05:37')
                
                # good
                Time.zone.now
                Time.zone.parse('2015-03-02 19:05:37')
                
                # good
                Time.current
                Time.at(timestamp).in_time_zone

                Prefer single-quoted strings when you don't need string interpolation or special symbols.
                Open

                            soft_validations.add(:base, "Original citation is out of the source page range")
                Severity: Minor
                Found in app/models/taxon_name.rb by rubocop

                Checks if uses of quotes match the configured preference.

                Example: EnforcedStyle: single_quotes (default)

                # bad
                "No special symbols"
                "No string interpolation"
                "Just text"
                
                # good
                'No special symbols'
                'No string interpolation'
                'Just text'
                "Wait! What's #{this}!"

                Example: EnforcedStyle: double_quotes

                # bad
                'Just some text'
                'No special chars or interpolation'
                
                # good
                "Just some text"
                "No special chars or interpolation"
                "Every string in #{project} uses double_quotes"

                There are no issues that match your filters.

                Category
                Status