SpeciesFileGroup/taxonworks

View on GitHub
app/models/protonym.rb

Summary

Maintainability
F
6 days
Test Coverage

File protonym.rb has 652 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_dependency Rails.root.to_s + '/app/models/taxon_name_relationship.rb'
#
# Force the loading of TaxonNameRelationships in all worlds.  This allows us to edit without restarting in development.
# Dir[Rails.root.to_s + '/app/models/taxon_name_relationship/**/*.rb'].sort.each {|file| require_dependency file }
#
Severity: Major
Found in app/models/protonym.rb - About 1 day to fix

    Class Protonym has 55 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Protonym < TaxonName
    
      extend Protonym::SoftValidationExtensions::Klass
      include Protonym::SoftValidationExtensions::Instance
      include Protonym::Becomes
    Severity: Major
    Found in app/models/protonym.rb - About 7 hrs to fix

      Method has too many lines. [53/25]
      Open

        def name_with_alternative_spelling
          if rank_class.nil? || nomenclatural_code != :iczn
            # rank_string =~ /::Icn::/ # self.class != Protonym
            return nil
          elsif is_species_rank? # rank_string =~ /Species/
      Severity: Minor
      Found in app/models/protonym.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 name_with_alternative_spelling has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def name_with_alternative_spelling
          if rank_class.nil? || nomenclatural_code != :iczn
            # rank_string =~ /::Icn::/ # self.class != Protonym
            return nil
          elsif is_species_rank? # rank_string =~ /Species/
      Severity: Minor
      Found in app/models/protonym.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 list_of_coordinated_names has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

        def list_of_coordinated_names
          list = []
          if self.rank_string
            r = self.iczn_set_as_incorrect_original_spelling_of_relationship
            if r.blank?
      Severity: Minor
      Found in app/models/protonym.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 has too many lines. [40/25]
      Open

        def set_cached_names_for_dependants
          dependants = []
          related_through_original_combination_relationships = []
          combination_relationships = []
      
      
      Severity: Minor
      Found in app/models/protonym.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 original_combination_elements has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        def original_combination_elements
          elements = { }
          return elements if rank.blank?
      
          this_rank = rank.to_sym
      Severity: Minor
      Found in app/models/protonym.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. [30/25]
      Open

        def original_combination_elements
          elements = { }
          return elements if rank.blank?
      
          this_rank = rank.to_sym
      Severity: Minor
      Found in app/models/protonym.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 has too many lines. [29/25]
      Open

        def list_of_coordinated_names
          list = []
          if self.rank_string
            r = self.iczn_set_as_incorrect_original_spelling_of_relationship
            if r.blank?
      Severity: Minor
      Found in app/models/protonym.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 name_with_alternative_spelling has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def name_with_alternative_spelling
          if rank_class.nil? || nomenclatural_code != :iczn
            # rank_string =~ /::Icn::/ # self.class != Protonym
            return nil
          elsif is_species_rank? # rank_string =~ /Species/
      Severity: Major
      Found in app/models/protonym.rb - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

            if is_cached && cached_html != get_full_name_html ||
              cached_misspelling != get_cached_misspelling ||
              cached_original_combination != get_original_combination ||
              cached_original_combination_html != get_original_combination_html ||
              cached_primary_homonym != get_genus_species(:original, :self) ||
        Severity: Critical
        Found in app/models/protonym.rb - About 2 hrs to fix

          Method get_genus_species has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def get_genus_species(genus_option, self_option)
              return nil if rank_class.nil?
              genus = nil
              name1 = nil
          
          
          Severity: Minor
          Found in app/models/protonym.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 number_of_taxa_by_year has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def number_of_taxa_by_year
              a = {}
              descendants.find_each do |z|
                year = z.year_integer
                year = 0 if year.nil?
          Severity: Minor
          Found in app/models/protonym.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 set_cached_names_for_dependants has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def set_cached_names_for_dependants
              dependants = []
              related_through_original_combination_relationships = []
              combination_relationships = []
          
          
          Severity: Minor
          Found in app/models/protonym.rb - About 1 hr to fix

            Method reduce_list_of_synonyms has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def reduce_list_of_synonyms(list)
                return [] if list.empty?
                list1 = list.select{|s| s.id == s.lowest_rank_coordinated_taxon.id}
                list1.reject!{|s| self.cached_valid_taxon_name_id == s.cached_valid_taxon_name_id} unless list1.empty?
                unless list1.empty?
            Severity: Minor
            Found in app/models/protonym.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 original_combination_elements has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def original_combination_elements
                elements = { }
                return elements if rank.blank?
            
                this_rank = rank.to_sym
            Severity: Minor
            Found in app/models/protonym.rb - About 1 hr to fix

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

                def list_of_coordinated_names
                  list = []
                  if self.rank_string
                    r = self.iczn_set_as_incorrect_original_spelling_of_relationship
                    if r.blank?
              Severity: Minor
              Found in app/models/protonym.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 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/protonym.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 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/protonym.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 validate_child_rank_is_equal_or_lower has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def validate_child_rank_is_equal_or_lower
                    if parent && !rank_class.blank? && rank_string != 'NomenclaturalRank'
                      if rank_class_changed?
                        a = children.where(type: 'Protonym').pluck(:rank_class)
                        v = RANKS.index(rank_string)
                Severity: Minor
                Found in app/models/protonym.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

                Avoid deeply nested control flow statements.
                Open

                            search_name = z.nil? ? nil : Protonym::FAMILY_GROUP_ENDINGS.collect{|i| z+i}
                Severity: Major
                Found in app/models/protonym.rb - About 45 mins to fix

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

                    def has_latinized_exceptions?
                      # The second half of this handles classifications in memory, as required to save a non-latinized name (i.e. don't tune it to .any?)
                      # !((type == 'Protonym') && (taxon_name_classifications.collect{|t| t.type} & EXCEPTED_FORM_TAXON_NAME_CLASSIFICATIONS).empty?)
                  
                      # Is faster than above?
                  Severity: Minor
                  Found in app/models/protonym.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_cached_names has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def sv_cached_names
                      is_cached = true
                      is_cached = false if cached_author_year != get_author_and_year
                  
                      if is_cached && cached_html != get_full_name_html ||
                  Severity: Minor
                  Found in app/models/protonym.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 get_primary_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def get_primary_type
                      return [] unless self.rank_class.parent.to_s =~ /Species/
                      s = self.type_materials.syntypes
                      p = self.type_materials.primary
                      if s.empty? && p.count == 1
                  Severity: Minor
                  Found in app/models/protonym.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_original_combination has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def get_original_combination
                      return verbatim_name if !GENUS_AND_SPECIES_RANK_NAMES.include?(rank_string) && !verbatim_name.nil?
                      e = original_combination_elements
                      return nil if e.none?
                  
                  
                  Severity: Minor
                  Found in app/models/protonym.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 has_same_primary_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def has_same_primary_type(taxon2)
                      return true unless rank_class.parent.to_s =~ /Species/
                  
                      taxon1_types = get_primary_type.sort_by{|i| i.id}
                      taxon2_types = taxon2.get_primary_type.sort_by{|i| i.id}
                  Severity: Minor
                  Found in app/models/protonym.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

                            if search_rank =~ /Family/
                              z = Protonym.that_is_valid.family_group_base(self.name)
                              search_name = z.nil? ? nil : Protonym::FAMILY_GROUP_ENDINGS.collect{|i| z+i}
                            else
                              search_name = self.name
                  Severity: Minor
                  Found in app/models/protonym.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.

                  Specify an :inverse_of option.
                  Open

                          has_one relationship, class_name: d.name.to_s, foreign_key: :object_taxon_name_id
                  Severity: Minor
                  Found in app/models/protonym.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

                  Avoid using update_columns because it skips validations.
                  Open

                          i.update_columns(columns_to_update)
                  Severity: Minor
                  Found in app/models/protonym.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_original_combination_html, get_original_combination_html)
                  Severity: Minor
                  Found in app/models/protonym.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_one relationship, class_name: d.name.to_s, foreign_key: :subject_taxon_name_id
                  Severity: Minor
                  Found in app/models/protonym.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

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

                        genus = genus.name unless genus.blank?
                  Severity: Minor
                  Found in app/models/protonym.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/protonym.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_columns because it skips validations.
                  Open

                      update_columns(
                  Severity: Minor
                  Found in app/models/protonym.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_columns because it skips validations.
                  Open

                          j.update_columns(
                  Severity: Minor
                  Found in app/models/protonym.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_original_combination, get_original_combination)
                  Severity: Minor
                  Found in app/models/protonym.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_many :original_combination_relationships, -> {
                  Severity: Minor
                  Found in app/models/protonym.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 rank_class.present? instead of !rank_class.blank?.
                  Open

                      if parent && !rank_class.blank? && rank_string != 'NomenclaturalRank'
                  Severity: Minor
                  Found in app/models/protonym.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/protonym.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 v.present? instead of !v.blank?.
                  Open

                      if !v.blank? && is_hybrid?
                  Severity: Minor
                  Found in app/models/protonym.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

                          i.update_columns(
                  Severity: Minor
                  Found in app/models/protonym.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_misspelling, get_cached_misspelling)
                  Severity: Minor
                  Found in app/models/protonym.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 :type_taxon_name_relationship, -> {
                  Severity: Minor
                  Found in app/models/protonym.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 v.present? instead of !v.blank?.
                  Open

                      v = '† ' + v if !v.blank? && is_fossil?
                  Severity: Minor
                  Found in app/models/protonym.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?

                  Specify an :inverse_of option.
                  Open

                          has_one relationship, class_name: d.name.to_s, foreign_key: :subject_taxon_name_id
                  Severity: Minor
                  Found in app/models/protonym.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 s.presence instead of s.blank? ? nil : s.
                  Open

                      s.blank? ? nil : s
                  Severity: Minor
                  Found in app/models/protonym.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

                  Specify an :inverse_of option.
                  Open

                          has_many relationships, -> {
                  Severity: Minor
                  Found in app/models/protonym.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 a :dependent option.
                  Open

                    has_many :type_materials, class_name: 'TypeMaterial', inverse_of: :protonym 
                  Severity: Minor
                  Found in app/models/protonym.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

                  Specify a :dependent option.
                  Open

                          has_one relationship, class_name: d.name.to_s, foreign_key: :object_taxon_name_id
                  Severity: Minor
                  Found in app/models/protonym.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

                  Specify an :inverse_of option.
                  Open

                    has_many :type_of_relationships, -> {
                  Severity: Minor
                  Found in app/models/protonym.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 a string value for class_name.
                  Open

                          has_one relationship, class_name: d.name.to_s, foreign_key: :object_taxon_name_id
                  Severity: Minor
                  Found in app/models/protonym.rb by rubocop

                  This cop checks if the value of the option class_name, in the definition of a reflection is a string.

                  Example:

                  # bad
                  has_many :accounts, class_name: Account
                  has_many :accounts, class_name: Account.name
                  
                  # good
                  has_many :accounts, class_name: 'Account'

                  Specify an :inverse_of option.
                  Open

                          has_many relationships, -> {
                  Severity: Minor
                  Found in app/models/protonym.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 rank_class.present? instead of !rank_class.blank?.
                  Open

                      if parent && !rank_class.blank? && rank_string != 'NomenclaturalRank'
                  Severity: Minor
                  Found in app/models/protonym.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 r.present? instead of unless r.blank?.
                  Open

                      unless r.blank?
                  Severity: Minor
                  Found in app/models/protonym.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?

                  Specify an :inverse_of option.
                  Open

                    has_one :latinized_taxon_name_classification, -> {
                  Severity: Minor
                  Found in app/models/protonym.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

                    has_many :combination_relationships, -> {
                  Severity: Minor
                  Found in app/models/protonym.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 ay.presence instead of ay.blank? ? nil : ay.
                  Open

                      ay.blank? ? nil : ay
                  Severity: Minor
                  Found in app/models/protonym.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 a string value for class_name.
                  Open

                          has_one relationship, class_name: d.name.to_s, foreign_key: :subject_taxon_name_id
                  Severity: Minor
                  Found in app/models/protonym.rb by rubocop

                  This cop checks if the value of the option class_name, in the definition of a reflection is a string.

                  Example:

                  # bad
                  has_many :accounts, class_name: Account
                  has_many :accounts, class_name: Account.name
                  
                  # good
                  has_many :accounts, class_name: 'Account'

                  Avoid using update_column because it skips validations.
                  Open

                          i.update_column(:cached_classified_as, i.get_cached_classified_as)
                  Severity: Minor
                  Found in app/models/protonym.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 is kind of pointless, we generate
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

                  TODO found
                  Open

                    # TODO: not true, *has* parens?!
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

                  TODO found
                  Open

                    # TODO, make back half of this raw SQL
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

                  TODO found
                  Open

                    # !! TODO: Should not be possible- fix the incoming data
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

                  TODO found
                  Open

                    # TODO: move to Protonym
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

                  TODO found
                  Open

                    # TODO, move to IsData or IsProjectData
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

                  TODO found
                  Open

                      # TODO: figure out where to really put this, likely in one big sort
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

                  TODO found
                  Open

                    # TODO: this is not really needed
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

                  TODO found
                  Open

                      # TODO: get SQL based ordering for original_combination_relationships, hard coded
                  Severity: Minor
                  Found in app/models/protonym.rb by fixme

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

                    TaxonNameRelationship.descendants.each do |d|
                      if d.respond_to?(:assignment_method)
                        if d.name.to_s =~ /TaxonNameRelationship::(Iczn|Icn|Ictv|Icnp|SourceClassifiedAs)/
                          relationship = "#{d.assignment_method}_relationship".to_sym
                          has_one relationship, class_name: d.name.to_s, foreign_key: :subject_taxon_name_id
                  Severity: Major
                  Found in app/models/protonym.rb and 1 other location - About 4 hrs to fix
                  app/models/combination.rb on lines 85..115

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

                  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

                    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/protonym.rb and 1 other location - About 1 hr to fix
                  app/models/taxon_name.rb on lines 1283..1290

                  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

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

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

                  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

                  Use the new Ruby 1.9 hash syntax.
                  Open

                        a[i] = {:valid => 0, :synonyms => 0} unless a[i]
                  Severity: Minor
                  Found in app/models/protonym.rb by rubocop

                  This cop checks hash literal syntax.

                  It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

                  A separate offense is registered for each problematic pair.

                  The supported styles are:

                  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
                  • hash_rockets - forces use of hash rockets for all hashes
                  • nomixedkeys - simply checks for hashes with mixed syntaxes
                  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

                  Example: EnforcedStyle: ruby19 (default)

                  # bad
                  {:a => 2}
                  {b: 1, :c => 2}
                  
                  # good
                  {a: 2, b: 1}
                  {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
                  {d: 1, 'e' => 2} # technically not forbidden

                  Example: EnforcedStyle: hash_rockets

                  # bad
                  {a: 1, b: 2}
                  {c: 1, 'd' => 5}
                  
                  # good
                  {:a => 1, :b => 2}

                  Example: EnforcedStyle: nomixedkeys

                  # bad
                  {:a => 1, b: 2}
                  {c: 1, 'd' => 2}
                  
                  # good
                  {:a => 1, :b => 2}
                  {c: 1, d: 2}

                  Example: EnforcedStyle: ruby19nomixed_keys

                  # bad
                  {:a => 1, :b => 2}
                  {c: 2, 'd' => 3} # should just use hash rockets
                  
                  # good
                  {a: 1, b: 2}
                  {:c => 3, 'd' => 4}

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

                    validates_presence_of :name, message: 'is a required field'
                  Severity: Minor
                  Found in app/models/protonym.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

                  Use the new Ruby 1.9 hash syntax.
                  Open

                        a[year] = {:valid => 0, :synonyms => 0} unless a[year]
                  Severity: Minor
                  Found in app/models/protonym.rb by rubocop

                  This cop checks hash literal syntax.

                  It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

                  A separate offense is registered for each problematic pair.

                  The supported styles are:

                  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
                  • hash_rockets - forces use of hash rockets for all hashes
                  • nomixedkeys - simply checks for hashes with mixed syntaxes
                  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

                  Example: EnforcedStyle: ruby19 (default)

                  # bad
                  {:a => 2}
                  {b: 1, :c => 2}
                  
                  # good
                  {a: 2, b: 1}
                  {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
                  {d: 1, 'e' => 2} # technically not forbidden

                  Example: EnforcedStyle: hash_rockets

                  # bad
                  {a: 1, b: 2}
                  {c: 1, 'd' => 5}
                  
                  # good
                  {:a => 1, :b => 2}

                  Example: EnforcedStyle: nomixedkeys

                  # bad
                  {:a => 1, b: 2}
                  {c: 1, 'd' => 2}
                  
                  # good
                  {:a => 1, :b => 2}
                  {c: 1, d: 2}

                  Example: EnforcedStyle: ruby19nomixed_keys

                  # bad
                  {:a => 1, :b => 2}
                  {c: 2, 'd' => 3} # should just use hash rockets
                  
                  # good
                  {a: 1, b: 2}
                  {:c => 3, 'd' => 4}

                  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

                      for i in 1758..Time.now.year do
                  Severity: Minor
                  Found in app/models/protonym.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 :rank_class, message: 'is a required field'
                  Severity: Minor
                  Found in app/models/protonym.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

                  Use the new Ruby 1.9 hash syntax.
                  Open

                        a[year] = {:valid => 0, :synonyms => 0} unless a[year]
                  Severity: Minor
                  Found in app/models/protonym.rb by rubocop

                  This cop checks hash literal syntax.

                  It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

                  A separate offense is registered for each problematic pair.

                  The supported styles are:

                  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
                  • hash_rockets - forces use of hash rockets for all hashes
                  • nomixedkeys - simply checks for hashes with mixed syntaxes
                  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

                  Example: EnforcedStyle: ruby19 (default)

                  # bad
                  {:a => 2}
                  {b: 1, :c => 2}
                  
                  # good
                  {a: 2, b: 1}
                  {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
                  {d: 1, 'e' => 2} # technically not forbidden

                  Example: EnforcedStyle: hash_rockets

                  # bad
                  {a: 1, b: 2}
                  {c: 1, 'd' => 5}
                  
                  # good
                  {:a => 1, :b => 2}

                  Example: EnforcedStyle: nomixedkeys

                  # bad
                  {:a => 1, b: 2}
                  {c: 1, 'd' => 2}
                  
                  # good
                  {:a => 1, :b => 2}
                  {c: 1, d: 2}

                  Example: EnforcedStyle: ruby19nomixed_keys

                  # bad
                  {:a => 1, :b => 2}
                  {c: 2, 'd' => 3} # should just use hash rockets
                  
                  # good
                  {a: 1, b: 2}
                  {:c => 3, 'd' => 4}

                  Use the new Ruby 1.9 hash syntax.
                  Open

                        a[i] = {:valid => 0, :synonyms => 0} unless a[i]
                  Severity: Minor
                  Found in app/models/protonym.rb by rubocop

                  This cop checks hash literal syntax.

                  It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

                  A separate offense is registered for each problematic pair.

                  The supported styles are:

                  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
                  • hash_rockets - forces use of hash rockets for all hashes
                  • nomixedkeys - simply checks for hashes with mixed syntaxes
                  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

                  Example: EnforcedStyle: ruby19 (default)

                  # bad
                  {:a => 2}
                  {b: 1, :c => 2}
                  
                  # good
                  {a: 2, b: 1}
                  {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
                  {d: 1, 'e' => 2} # technically not forbidden

                  Example: EnforcedStyle: hash_rockets

                  # bad
                  {a: 1, b: 2}
                  {c: 1, 'd' => 5}
                  
                  # good
                  {:a => 1, :b => 2}

                  Example: EnforcedStyle: nomixedkeys

                  # bad
                  {:a => 1, b: 2}
                  {c: 1, 'd' => 2}
                  
                  # good
                  {:a => 1, :b => 2}
                  {c: 1, d: 2}

                  Example: EnforcedStyle: ruby19nomixed_keys

                  # bad
                  {:a => 1, :b => 2}
                  {c: 2, 'd' => 3} # should just use hash rockets
                  
                  # good
                  {a: 1, b: 2}
                  {:c => 3, 'd' => 4}

                  There are no issues that match your filters.

                  Category
                  Status