SpeciesFileGroup/taxonworks

View on GitHub
app/models/protonym/soft_validation_extensions.rb

Summary

Maintainability
F
2 wks
Test Coverage

File soft_validation_extensions.rb has 1461 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Protonym::SoftValidationExtensions

  module Klass
    VALIDATIONS = {
      sv_validate_name: {
Severity: Major
Found in app/models/protonym/soft_validation_extensions.rb - About 3 days to fix

    Method sv_potential_species_homonyms has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

        def sv_potential_species_homonyms
          if persisted? && is_species_rank? && is_available?
            if TaxonNameRelationship.where_subject_is_taxon_name(self).homonym_or_suppressed.empty?
              if self.id == self.lowest_rank_coordinated_taxon.id
                name1 = self.cached_primary_homonym ? self.cached_primary_homonym : nil
    Severity: Minor
    Found in app/models/protonym/soft_validation_extensions.rb - About 1 day 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_species_gender_agreement has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def sv_species_gender_agreement
          if is_species_rank?
            s = part_of_speech_name
            if !s.nil? && is_available?
              if %w{adjective participle}.include?(s)
    Severity: Minor
    Found in app/models/protonym/soft_validation_extensions.rb - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Method sv_validate_name has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def sv_validate_name
          correct_name_format = false
    
          if rank_class
            # TODO: name these Regexp somewhere
    Severity: Minor
    Found in app/models/protonym/soft_validation_extensions.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 sv_potential_genus_homonyms has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def sv_potential_genus_homonyms
          if persisted? && is_genus_rank? && is_available?
            if TaxonNameRelationship.where_subject_is_taxon_name(self).homonym_or_suppressed.empty?
              if self.id == self.lowest_rank_coordinated_taxon.id
                name1 = self.cached_primary_homonym ? self.cached_primary_homonym : nil
    Severity: Minor
    Found in app/models/protonym/soft_validation_extensions.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. [42/25]
    Open

        def sv_potential_species_homonyms
          if persisted? && is_species_rank? && is_available?
            if TaxonNameRelationship.where_subject_is_taxon_name(self).homonym_or_suppressed.empty?
              if self.id == self.lowest_rank_coordinated_taxon.id
                name1 = self.cached_primary_homonym ? self.cached_primary_homonym : nil

    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.

    Consider simplifying this complex logical expression.
    Open

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

      Method sv_potential_family_homonyms has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def sv_potential_family_homonyms
            if persisted? && is_family_rank? && is_available?
              if TaxonNameRelationship.where_subject_is_taxon_name(self).homonym_or_suppressed.empty?
                if self.id == self.lowest_rank_coordinated_taxon.id
                  name2 = self.cached_primary_homonym_alternative_spelling ? self.cached_primary_homonym_alternative_spelling : nil
      Severity: Minor
      Found in app/models/protonym/soft_validation_extensions.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 sv_species_gender_agreement_not_required has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def sv_species_gender_agreement_not_required
            if is_species_rank? && ((!feminine_name.blank? || !masculine_name.blank? || !neuter_name.blank?)) && is_available?
              s = part_of_speech_name
              if !s.nil? && !%w{adjective participle}.include?(s)
                soft_validations.add(:feminine_name, 'Alternative spelling is not required for the name which is not adjective or participle.') unless feminine_name.blank?
      Severity: Minor
      Found in app/models/protonym/soft_validation_extensions.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 sv_single_sub_taxon has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def sv_single_sub_taxon
            if self.rank_class
              rank = rank_string
              if rank != 'potentially_validating rank' && self.rank_class.nomenclatural_code == :iczn && %w(subspecies subgenus subtribe tribe subfamily).include?(self.rank_class.rank_name)
                sisters = self.parent.descendants.with_rank_class(rank).select{|t| t.id == t.cached_valid_taxon_name_id}
      Severity: Minor
      Found in app/models/protonym/soft_validation_extensions.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 sv_fix_add_nominotypical_sub has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def sv_fix_add_nominotypical_sub
            return false if list_of_coordinated_names.collect{|r| r.id}.include?(parent_id)
            rank  = rank_string
            p     = self.parent
            prank = p.rank_string
      Severity: Minor
      Found in app/models/protonym/soft_validation_extensions.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 sv_fix_add_nominotypical_sub
            return false if list_of_coordinated_names.collect{|r| r.id}.include?(parent_id)
            rank  = rank_string
            p     = self.parent
            prank = p.rank_string

      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. [28/25]
      Open

          def sv_missing_part_of_speech
            if is_species_rank? && self.part_of_speech_class.nil? && !has_misspelling_relationship? && is_available?
      
              z = TaxonNameClassification.
                  joins(:taxon_name).

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

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

          def sv_homotypic_synonyms
            unless !is_valid? # unavailable_or_invalid?
              if self.id == self.lowest_rank_coordinated_taxon.id
                possible_synonyms = []
                if rank_string =~ /Species/
      Severity: Minor
      Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def sv_species_gender_agreement
            if is_species_rank?
              s = part_of_speech_name
              if !s.nil? && is_available?
                if %w{adjective participle}.include?(s)

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

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

          def sv_parent_priority
            if self.rank_class
              rank_group = self.rank_class.parent
              parent = self.parent
      
      
      Severity: Minor
      Found in app/models/protonym/soft_validation_extensions.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 sv_potential_species_homonyms has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def sv_potential_species_homonyms
            if persisted? && is_species_rank? && is_available?
              if TaxonNameRelationship.where_subject_is_taxon_name(self).homonym_or_suppressed.empty?
                if self.id == self.lowest_rank_coordinated_taxon.id
                  name1 = self.cached_primary_homonym ? self.cached_primary_homonym : nil
      Severity: Minor
      Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr to fix

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

            def sv_missing_part_of_speech
              if is_species_rank? && self.part_of_speech_class.nil? && !has_misspelling_relationship? && is_available?
        
                z = TaxonNameClassification.
                    joins(:taxon_name).
        Severity: Minor
        Found in app/models/protonym/soft_validation_extensions.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 sv_primary_types_repository has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def sv_primary_types_repository
              if is_species_rank?
                s = self.type_materials
                unless s.empty?
                  s.primary.each do |t|
        Severity: Minor
        Found in app/models/protonym/soft_validation_extensions.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 sv_missing_etymology has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def sv_missing_etymology
              if self.etymology.nil? && self.rank_string =~ /(Genus|Species)/ && is_available?
                z = TaxonName.
                    where(name: name, project_id: project_id).where.not(etymology: nil).
                    group(:etymology).
        Severity: Minor
        Found in app/models/protonym/soft_validation_extensions.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 sv_family_is_invalid has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def sv_family_is_invalid
              if persisted? && is_family_rank? && is_available?
                tg = type_genus
                if tg && (!TaxonNameRelationship.where_subject_is_taxon_name(tg).homonym_or_suppressed.empty? ||
                    !TaxonNameClassification.where_taxon_name(tg).with_type_string('TaxonNameClassification::Iczn::Available::Invalid::Homonym').empty? )
        Severity: Minor
        Found in app/models/protonym/soft_validation_extensions.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 sv_fix_add_nominotypical_sub has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def sv_fix_add_nominotypical_sub
              return false if list_of_coordinated_names.collect{|r| r.id}.include?(parent_id)
              rank  = rank_string
              p     = self.parent
              prank = p.rank_string
        Severity: Minor
        Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr to fix

          Method sv_missing_part_of_speech has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def sv_missing_part_of_speech
                if is_species_rank? && self.part_of_speech_class.nil? && !has_misspelling_relationship? && is_available?
          
                  z = TaxonNameClassification.
                      joins(:taxon_name).
          Severity: Minor
          Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr to fix

            Method sv_extant_children has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def sv_extant_children
                  unless self.parent_id.blank?
                    if self.is_fossil?
                      taxa = Protonym.where(parent_id: self.id)
                      z = 0
            Severity: Minor
            Found in app/models/protonym/soft_validation_extensions.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 sv_species_gender_agreement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def sv_species_gender_agreement
                  if is_species_rank?
                    s = part_of_speech_name
                    if !s.nil? && is_available?
                      if %w{adjective participle}.include?(s)
            Severity: Minor
            Found in app/models/protonym/soft_validation_extensions.rb - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                            if masculine_name.blank?
                              soft_validations.add(:masculine_name, "The species name is marked as #{part_of_speech_name}, but the name spelling in masculine is not provided")
                            else
                              # e = species_questionable_ending(TaxonNameClassification::Latinized::Gender::Masculine, masculine_name)
                              # soft_validations.add(:masculine_name, "Name has a non masculine ending: -#{e}") unless e.nil?
              Severity: Major
              Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              name2 = self.cached_primary_homonym_alternative_spelling ? self.cached_primary_homonym_alternative_spelling : nil
                Severity: Major
                Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if neuter_name.blank?
                                  soft_validations.add(:neuter_name, "The species name is marked as #{part_of_speech_name}, but the name spelling in neuter is not provided")
                                else
                                  # e = species_questionable_ending(TaxonNameClassification::Latinized::Gender::Neuter, neuter_name)
                                  # soft_validations.add(:neuter_name, "Name has a non neuter ending: -#{e}") unless e.nil?
                  Severity: Major
                  Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    soft_validations.add(:base, "Missing relationship: #{self.cached_html_name_and_author_year} should be a homonym or duplicate of #{s.cached_html_name_and_author_year}") if s.nomenclatural_code == self.nomenclatural_code
                    Severity: Major
                    Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                      Method sv_original_combination_relationships has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def sv_original_combination_relationships
                            relationships = self.original_combination_relationships
                            unless relationships.empty?
                              relationships = relationships.sort_by{|r| r.type_class.order_index }
                              ids = relationships.collect{|r| r.subject_taxon_name_id}
                      Severity: Minor
                      Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Avoid deeply nested control flow statements.
                      Open

                                    if feminine_name.blank?
                                      soft_validations.add(:feminine_name, "The species name is marked as #{part_of_speech_name}, but the name spelling in feminine is not provided")
                                    else
                                      # e = species_questionable_ending(TaxonNameClassification::Latinized::Gender::Feminine, feminine_name)
                                      # soft_validations.add(:feminine_name, "Name has a non feminine ending: -#{e}") unless e.nil?
                      Severity: Major
                      Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                        Method sv_fix_coordinated_names_type_species has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def sv_fix_coordinated_names_type_species
                              fixed = false
                              tr = nil
                              return false unless self.type_species.nil?
                              list_of_coordinated_names.each do |t|
                        Severity: Minor
                        Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                        Cognitive Complexity

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

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

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

                        Further reading

                        Method sv_fix_coordinated_names_part_of_speech has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def sv_fix_coordinated_names_part_of_speech
                              return false unless self.part_of_speech_class.nil?
                              list_of_coordinated_names.each do |t|
                                unless t.part_of_speech_class.nil?
                                  c = self.taxon_name_classifications.create(type: t.part_of_speech_class.to_s)
                        Severity: Minor
                        Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                        Cognitive Complexity

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

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

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

                        Further reading

                        Method sv_fix_coordinated_names_gender has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def sv_fix_coordinated_names_gender
                              return false unless self.gender_class.nil?
                              list_of_coordinated_names.each do |t|
                                unless t.gender_class.nil?
                                  c = self.taxon_name_classifications.create(type: t.gender_class.to_s)
                        Severity: Minor
                        Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                        Cognitive Complexity

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

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

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

                        Further reading

                        Method sv_fix_coordinated_names_page has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def sv_fix_coordinated_names_page
                              fixed = false
                              return false if self.origin_citation.nil? || !self.origin_citation.pages.nil?
                              list_of_coordinated_names.each do |t|
                                if !t.origin_citation.nil? && !t.origin_citation.pages.nil? && self.origin_citation.source_id == t.origin_citation.source_id
                        Severity: Minor
                        Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                        Cognitive Complexity

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

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

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

                        Further reading

                        Avoid deeply nested control flow statements.
                        Open

                                      possible_primary_homonyms_alternative_spelling = name2 ? Protonym.with_primary_homonym_alternative_spelling(name2).without_homonym_or_suppressed.without_taxon_name_classification_array(TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID).not_self(self).with_base_of_rank_class('NomenclaturalRank::Iczn::SpeciesGroup').with_project(self.project_id) : []
                        Severity: Major
                        Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        if !list2.empty?
                                          list2.each do |s|
                                            soft_validations.add(:base, "Missing relationship: #{self.cached_html_name_and_author_year} could be a primary homonym of #{s.cached_html_name_and_author_year} (alternative spelling)")
                                          end
                                        else
                          Severity: Major
                          Found in app/models/protonym/soft_validation_extensions.rb - About 45 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                  if (rank =~ /Family/ && prank =~ /Family/) || (rank =~ /Genus/ && prank =~ /Genus/) || (rank =~ /Species/ && prank =~ /Species/)
                                    begin
                                      Protonym.transaction do
                                        if rank =~ /Family/ && prank =~ /Family/
                                          name = Protonym.family_group_base(self.parent.name)
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                      if s && ts && s.source_id == ts.source_id && (s.pages != ts.pages || (s.pages.nil? && !ts.pages.nil?))
                                        soft_validations.add(:base, "The original publication page does not match with the original publication page of the coordinate #{t.rank_class.rank_name}", success_message: 'Original publication pages were updated', failure_message: 'Original publication pages were not updated')
                                      end
                              Severity: Major
                              Found in app/models/protonym/soft_validation_extensions.rb - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                            if !feminine_name.blank? && !masculine_name.blank? && !neuter_name.blank? && name != masculine_name && name != feminine_name && name != neuter_name
                                              soft_validations.add(:base, 'Species name does not match with either of three alternative forms')
                                            else
                                              forms = predict_three_forms
                                              if feminine_name.blank?
                                Severity: Major
                                Found in app/models/protonym/soft_validation_extensions.rb - About 40 mins to fix

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

                                      def sv_fix_coordinated_names_original_variety
                                        fixed = false
                                        return false unless self.original_variety.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_variety.nil?
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_type_species_type
                                        sttnr = self.type_taxon_name_relationship
                                        return false if sttnr.nil?
                                        fixed = false
                                        list_of_coordinated_names.each do |t|
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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_person_vs_year_of_publication has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_person_vs_year_of_publication
                                        if self.cached_nomenclature_date
                                          year = self.cached_nomenclature_date&.year
                                          self.taxon_name_author_roles.each do |r|
                                            person = r.person
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_original_species
                                        fixed = false
                                        return false unless self.original_species.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_species.nil?
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_original_subspecies
                                        fixed = false
                                        return false unless self.original_subspecies.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_subspecies.nil?
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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_validate_coordinated_names_source has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_validate_coordinated_names_source
                                        return true unless is_valid?
                                        s = self.source
                                        list_of_coordinated_names.each do |t|
                                          if ((s && t.source && s.id != t.source.id) || (s.nil? && t.source))
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_original_genus
                                        fixed = false
                                        return false unless self.original_genus.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_genus.nil?
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_source
                                        fixed = false
                                        pg = nil
                                        return false unless self.source.nil?
                                          list_of_coordinated_names.each do |t|
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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_family_is_invalid_no_substitute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_family_is_invalid_no_substitute
                                        if persisted? && is_family_rank? && self.id == self.lowest_rank_coordinated_taxon.id
                                          if !TaxonNameClassification.where_taxon_name(self).with_type_base('TaxonNameClassification::Iczn::Available::Invalid').empty?
                                            if self.iczn_set_as_synonym_of.nil?
                                              soft_validations.add(:base, 'Missing relationship: The name is invalid, but a substitute name is not selected')
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_original_form
                                        fixed = false
                                        return false unless self.original_form.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_form.nil?
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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_validate_coordinated_names_page has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_validate_coordinated_names_page
                                        return true unless is_valid?
                                        s = self.origin_citation
                                        list_of_coordinated_names.each do |t|
                                          ts = t.origin_citation
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_etymology
                                        fixed = false
                                        return false unless self.etymology.blank?
                                        list_of_coordinated_names.each do |t|
                                          if !t.etymology.blank?
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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_primary_types has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_primary_types
                                        if is_species_rank? && is_available?
                                          if self.type_materials.primary.empty? && self.type_materials.syntypes.empty?
                                            soft_validations.add(:base, 'Primary type is not selected')
                                          elsif self.type_materials.primary.count > 1 || (!self.type_materials.primary.empty? && !self.type_materials.syntypes.empty?)
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_original_subgenus
                                        fixed = false
                                        return false unless self.original_subgenus.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_subgenus.nil?
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_type_genus
                                        fixed = false
                                        return false unless self.type_genus.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.type_genus.nil?
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

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

                                      def sv_fix_coordinated_names_type_specimen
                                        fixed = false
                                        return false unless self.get_primary_type.empty?
                                        list_of_coordinated_names.each do |t1|
                                          types2 = t1.get_primary_type
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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_validate_coordinated_names_gender has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_validate_coordinated_names_gender
                                        return true unless is_available?
                                        return true unless is_genus_rank?
                                        s = self.gender_class
                                        list_of_coordinated_names.each do |t|
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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 sv_validate_coordinated_names_type_genus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_validate_coordinated_names_type_genus
                                        return true unless is_valid?
                                        return true unless is_family_rank?
                                        list_of_coordinated_names.each do |t|
                                          if self.type_genus != t.type_genus
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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 sv_validate_coordinated_names_part_of_speech has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_validate_coordinated_names_part_of_speech
                                        return true unless is_available?
                                        return true unless is_species_rank?
                                        list_of_coordinated_names.each do |t|
                                          if self.part_of_speech_class != t.part_of_speech_class
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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 sv_validate_coordinated_names_type_species_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_validate_coordinated_names_type_species_type
                                        return true unless is_genus_rank?
                                        sttnr = self.type_taxon_name_relationship
                                        return true if sttnr.nil?
                                        list_of_coordinated_names.each do |t|
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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 sv_validate_coordinated_names_type_species has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_validate_coordinated_names_type_species
                                        return true unless is_valid?
                                        return true unless is_genus_rank?
                                        list_of_coordinated_names.each do |t|
                                          if self.type_species != t.type_species
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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 sv_validate_parent_rank has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def sv_validate_parent_rank
                                        if self.rank_class && self.id == self.cached_valid_taxon_name_id
                                          if rank_string == 'NomenclaturalRank' || self.parent&.rank_string == 'NomenclaturalRank' || !!self.iczn_uncertain_placement_relationship
                                            true
                                          elsif !self.rank_class&.valid_parents.include?(self.parent&.rank_string)
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.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 !list2.empty?
                                                list2.each do |s|
                                                  soft_validations.add(:base, "Missing relationship: #{self.cached_html_name_and_author_year} should be a homonym or duplicate of #{s.cached_html_name_and_author_year}")
                                                end
                                              end

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              if !list1.empty?
                                                list1.each do |s|
                                                  soft_validations.add(
                                                    :base, "Missing relationship: #{self.cached_html_name_and_author_year} should be a primary homonym or duplicate of #{s.cached_html_name_and_author_year}")
                                                  #  fix: :sv_fix_add_relationship('iczn_set_as_primary_homonym_of'.to_sym, s.id),

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              possible_primary_homonyms = name1 ? Protonym.with_primary_homonym(name1).without_taxon_name_classification_array(TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID).without_homonym_or_suppressed.not_self(self).with_base_of_rank_class('NomenclaturalRank::Iczn::GenusGroup').with_project(self.project_id) : []

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              possible_primary_homonyms = name1 ? Protonym.with_primary_homonym(name1).without_taxon_name_classification_array(TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID).without_homonym_or_suppressed.not_self(self).with_base_of_rank_class('NomenclaturalRank::Iczn::SpeciesGroup').with_project(self.project_id) : []

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                                soft_validations.add(:base, "Extinct taxon #{self.cached_html} has extant children") if !t.is_fossil? && t.id == t.cached_valid_taxon_name_id && z == 0

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              name2 = self.cached_primary_homonym_alternative_spelling ? self.cached_primary_homonym_alternative_spelling : nil

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              name1 = self.cached_primary_homonym ? self.cached_primary_homonym : nil

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              if TaxonNameClassification.where_taxon_name(self).with_type_base('TaxonNameClassification::Iczn::Available::Invalid').empty?
                                                soft_validations.add(:base, "Missing relationship: #{self.cached_html_name_and_author_year} is invalid due to the homonymy or suppression of its type genus")
                                              end

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              name1 = self.cached_primary_homonym ? self.cached_primary_homonym : nil

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              unless type.nil?
                                                possible_synonyms = Protonym.with_type_of_taxon_names(type.id).not_self(self).with_project(self.project_id)
                                              end

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              if !feminine_name.blank? && !masculine_name.blank? && !neuter_name.blank? && name != masculine_name && name != feminine_name && name != neuter_name
                                                soft_validations.add(:base, 'Species name does not match with either of three alternative forms')
                                              else
                                                forms = predict_three_forms
                                                if feminine_name.blank?

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              search_name = z.nil? ? nil : Protonym::FAMILY_GROUP_ENDINGS.collect{|i| z+i}

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              unless primary_types.empty?
                                                p                 = primary_types.collect {|t| t.collection_object_id}
                                                possible_synonyms = Protonym.with_type_material_array(p).without_taxon_name_classification_array(TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID).not_self(self).with_project(self.project_id)
                                              end

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              if !list1.empty?
                                                list1.each do |s|
                                                  soft_validations.add(:base, "Missing relationship: #{self.cached_html_name_and_author_year} should be a homonym or duplicate of #{s.cached_html_name_and_author_year}") if s.nomenclatural_code == self.nomenclatural_code
                                                end
                                              end

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              possible_primary_homonyms_alternative_spelling = name2 ? Protonym.with_primary_homonym_alternative_spelling(name2).without_homonym_or_suppressed.without_taxon_name_classification_array(TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID).not_self(self).with_base_of_rank_class('NomenclaturalRank::Iczn::FamilyGroup').with_project(self.project_id) : []

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

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

                                  The maximum level of nesting allowed is configurable.

                                  Avoid more than 3 levels of block nesting.
                                  Open

                                              unless date1.nil? || date2.nil?
                                                if date1 < date2
                                                  soft_validations.add(:base, "#{self.rank_class.rank_name.capitalize} #{self.cached_html_name_and_author_year} should not be older than parent #{parent.rank_class.rank_name} #{parent.cached_html_name_and_author_year}")
                                                end
                                              end

                                  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.

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

                                              if !feminine_name.blank? && !masculine_name.blank? && !neuter_name.blank? && name != masculine_name && name != feminine_name && name != neuter_name

                                  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 feminine_name.present? instead of !feminine_name.blank?.
                                  Open

                                        if is_species_rank? && ((!feminine_name.blank? || !masculine_name.blank? || !neuter_name.blank?)) && is_available?

                                  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 masculine_name.present? instead of !masculine_name.blank?.
                                  Open

                                        if is_species_rank? && ((!feminine_name.blank? || !masculine_name.blank? || !neuter_name.blank?)) && is_available?

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

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

                                  Example: NotNilAndNotEmpty: true (default)

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

                                  Example: NotBlank: true (default)

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

                                  Example: UnlessBlank: true (default)

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

                                  Use find_by instead of where.first.
                                  Open

                                        usage = TaxonNameRelationship::Iczn::Invalidating::Usage.where(subject_taxon_name_id: self.id).first

                                  This cop is used to identify usages of where.first and change them to use find_by instead.

                                  Example:

                                  # bad
                                  User.where(name: 'Bruce').first
                                  User.where(name: 'Bruce').take
                                  
                                  # good
                                  User.find_by(name: 'Bruce')

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

                                              if !feminine_name.blank? && !masculine_name.blank? && !neuter_name.blank? && name != masculine_name && name != feminine_name && name != neuter_name

                                  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 neuter_name.present? instead of !neuter_name.blank?.
                                  Open

                                              if !feminine_name.blank? && !masculine_name.blank? && !neuter_name.blank? && name != masculine_name && name != feminine_name && name != neuter_name

                                  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 neuter_name.present? instead of !neuter_name.blank?.
                                  Open

                                        if is_species_rank? && ((!feminine_name.blank? || !masculine_name.blank? || !neuter_name.blank?)) && is_available?

                                  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 t.etymology.present? instead of !t.etymology.blank?.
                                  Open

                                          if !t.etymology.blank?

                                  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 create! instead of create if the return value is not checked. Or check persisted? on model returned from create.
                                  Open

                                            c = self.taxon_name_classifications.create(type: t.part_of_speech_class.to_s)

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

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

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

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

                                  Example:

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

                                  Example: AllowImplicitReturn: true (default)

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

                                  Example: AllowImplicitReturn: false

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

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

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

                                  Avoid using update_column because it skips validations.
                                  Open

                                        self.update_column(:verbatim_author, nil)

                                  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 if masculine_name.present? instead of unless masculine_name.blank?.
                                  Open

                                            soft_validations.add(:masculine_name, 'Alternative spelling is not required for the name which is not adjective or participle.')  unless masculine_name.blank?

                                  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 create! instead of create if the return value is not checked. Or check persisted? on model returned from create.
                                  Open

                                            c = self.taxon_name_classifications.create(type: t.gender_class.to_s)

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

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

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

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

                                  Example:

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

                                  Example: AllowImplicitReturn: true (default)

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

                                  Example: AllowImplicitReturn: false

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

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

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

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

                                            c.save

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

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

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

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

                                  Example:

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

                                  Example: AllowImplicitReturn: true (default)

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

                                  Example: AllowImplicitReturn: false

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

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

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

                                  Use if self.parent_id.present? instead of unless self.parent_id.blank?.
                                  Open

                                        unless self.parent_id.blank?

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

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

                                  Example: NotNilAndNotEmpty: true (default)

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

                                  Example: NotBlank: true (default)

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

                                  Example: UnlessBlank: true (default)

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

                                  Avoid using update_column because it skips validations.
                                  Open

                                              self.origin_citation.update_column(:pages, pg)

                                  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

                                            self.update_column(:year_of_publication, t.year_of_publication)

                                  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 if self.etymology.present? instead of unless self.etymology.blank?.
                                  Open

                                        return false unless self.etymology.blank?

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

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

                                  Example: NotNilAndNotEmpty: true (default)

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

                                  Example: NotBlank: true (default)

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

                                  Example: UnlessBlank: true (default)

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

                                  Avoid using update_column because it skips validations.
                                  Open

                                        self.update_column(:year_of_publication, nil)

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

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

                                  Example:

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

                                  Example: Whitelist: ["touch"]

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

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

                                              t.save

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

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

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

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

                                  Example:

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

                                  Example: AllowImplicitReturn: true (default)

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

                                  Example: AllowImplicitReturn: false

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

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

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

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

                                          otus.create(taxon_name_id: id)

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

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

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

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

                                  Example:

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

                                  Example: AllowImplicitReturn: true (default)

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

                                  Example: AllowImplicitReturn: false

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

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

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

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

                                                self.save

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

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

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

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

                                  Example:

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

                                  Example: AllowImplicitReturn: true (default)

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

                                  Example: AllowImplicitReturn: false

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

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

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

                                  Avoid using update_column because it skips validations.
                                  Open

                                            self.update_column(:verbatim_author, t.verbatim_author)

                                  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

                                        self.update_column(:year_of_publication, nil)

                                  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 if neuter_name.present? instead of unless neuter_name.blank?.
                                  Open

                                            soft_validations.add(:neuter_name, 'Alternative spelling is not required for the name which is not adjective or participle.')  unless neuter_name.blank?

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

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

                                  Example: NotNilAndNotEmpty: true (default)

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

                                  Example: NotBlank: true (default)

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

                                  Example: UnlessBlank: true (default)

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

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

                                              self.source.save

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

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

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

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

                                  Example:

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

                                  Example: AllowImplicitReturn: true (default)

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

                                  Example: AllowImplicitReturn: false

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

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

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

                                  Avoid using update_column because it skips validations.
                                  Open

                                        self.update_column(:verbatim_author, nil)

                                  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 if feminine_name.present? instead of unless feminine_name.blank?.
                                  Open

                                            soft_validations.add(:feminine_name, 'Alternative spelling is not required for the name which is not adjective or participle.') unless feminine_name.blank?

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

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

                                  Example: NotNilAndNotEmpty: true (default)

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

                                  Example: NotBlank: true (default)

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

                                  Example: UnlessBlank: true (default)

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

                                  TODO found
                                  Open

                                          # TODO: move pertinent checks to base of nomenclature Classes to manage them there

                                  TODO found
                                  Open

                                          # TODO: name these Regexp somewhere

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

                                      def sv_fix_coordinated_names_original_genus
                                        fixed = false
                                        return false unless self.original_genus.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_genus.nil?
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 6 other locations - About 45 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 757..773
                                  app/models/protonym/soft_validation_extensions.rb on lines 787..803
                                  app/models/protonym/soft_validation_extensions.rb on lines 817..833
                                  app/models/protonym/soft_validation_extensions.rb on lines 847..863
                                  app/models/protonym/soft_validation_extensions.rb on lines 877..893
                                  app/models/protonym/soft_validation_extensions.rb on lines 939..955

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_fix_coordinated_names_original_variety
                                        fixed = false
                                        return false unless self.original_variety.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_variety.nil?
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 6 other locations - About 45 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 727..743
                                  app/models/protonym/soft_validation_extensions.rb on lines 757..773
                                  app/models/protonym/soft_validation_extensions.rb on lines 787..803
                                  app/models/protonym/soft_validation_extensions.rb on lines 817..833
                                  app/models/protonym/soft_validation_extensions.rb on lines 877..893
                                  app/models/protonym/soft_validation_extensions.rb on lines 939..955

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_fix_coordinated_names_etymology
                                        fixed = false
                                        return false unless self.etymology.blank?
                                        list_of_coordinated_names.each do |t|
                                          if !t.etymology.blank?
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 6 other locations - About 45 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 727..743
                                  app/models/protonym/soft_validation_extensions.rb on lines 757..773
                                  app/models/protonym/soft_validation_extensions.rb on lines 787..803
                                  app/models/protonym/soft_validation_extensions.rb on lines 817..833
                                  app/models/protonym/soft_validation_extensions.rb on lines 847..863
                                  app/models/protonym/soft_validation_extensions.rb on lines 877..893

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_fix_coordinated_names_original_species
                                        fixed = false
                                        return false unless self.original_species.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_species.nil?
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 6 other locations - About 45 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 727..743
                                  app/models/protonym/soft_validation_extensions.rb on lines 757..773
                                  app/models/protonym/soft_validation_extensions.rb on lines 817..833
                                  app/models/protonym/soft_validation_extensions.rb on lines 847..863
                                  app/models/protonym/soft_validation_extensions.rb on lines 877..893
                                  app/models/protonym/soft_validation_extensions.rb on lines 939..955

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_fix_coordinated_names_original_form
                                        fixed = false
                                        return false unless self.original_form.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_form.nil?
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 6 other locations - About 45 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 727..743
                                  app/models/protonym/soft_validation_extensions.rb on lines 757..773
                                  app/models/protonym/soft_validation_extensions.rb on lines 787..803
                                  app/models/protonym/soft_validation_extensions.rb on lines 817..833
                                  app/models/protonym/soft_validation_extensions.rb on lines 847..863
                                  app/models/protonym/soft_validation_extensions.rb on lines 939..955

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_fix_coordinated_names_original_subgenus
                                        fixed = false
                                        return false unless self.original_subgenus.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_subgenus.nil?
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 6 other locations - About 45 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 727..743
                                  app/models/protonym/soft_validation_extensions.rb on lines 787..803
                                  app/models/protonym/soft_validation_extensions.rb on lines 817..833
                                  app/models/protonym/soft_validation_extensions.rb on lines 847..863
                                  app/models/protonym/soft_validation_extensions.rb on lines 877..893
                                  app/models/protonym/soft_validation_extensions.rb on lines 939..955

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_fix_coordinated_names_original_subspecies
                                        fixed = false
                                        return false unless self.original_subspecies.nil?
                                        list_of_coordinated_names.each do |t|
                                          if !t.original_subspecies.nil?
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 6 other locations - About 45 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 727..743
                                  app/models/protonym/soft_validation_extensions.rb on lines 757..773
                                  app/models/protonym/soft_validation_extensions.rb on lines 787..803
                                  app/models/protonym/soft_validation_extensions.rb on lines 847..863
                                  app/models/protonym/soft_validation_extensions.rb on lines 877..893
                                  app/models/protonym/soft_validation_extensions.rb on lines 939..955

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 41.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_validate_coordinated_names_original_species
                                        return true if !is_species_rank? || has_misspelling_relationship?
                                        list_of_coordinated_names.each do |t|
                                          if self.original_species.try(:name) != t.original_species.try(:name)
                                            soft_validations.add(:base, "The original species does not match with the original species of coordinate #{t.rank_class.rank_name}", success_message: 'Original species was updated', failure_message:  'Failed to update original species')
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 4 other locations - About 35 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 748..752
                                  app/models/protonym/soft_validation_extensions.rb on lines 808..812
                                  app/models/protonym/soft_validation_extensions.rb on lines 838..842
                                  app/models/protonym/soft_validation_extensions.rb on lines 868..872

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

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

                                      def sv_validate_coordinated_names_original_subspecies
                                        return true if !is_species_rank? || has_misspelling_relationship?
                                        list_of_coordinated_names.each do |t|
                                          if self.original_subspecies.try(:name) != t.original_subspecies.try(:name)
                                            soft_validations.add(:base, "The original subspecies does not match with the original subspecies of coordinate #{t.rank_class.rank_name}", success_message: 'Original subspecies was updated', failure_message:  'Failed to update original subspecies')
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 4 other locations - About 35 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 748..752
                                  app/models/protonym/soft_validation_extensions.rb on lines 778..782
                                  app/models/protonym/soft_validation_extensions.rb on lines 838..842
                                  app/models/protonym/soft_validation_extensions.rb on lines 868..872

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

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

                                      def sv_validate_coordinated_names_original_subgenus
                                        return true if !is_genus_or_species_rank? || has_misspelling_relationship?
                                        list_of_coordinated_names.each do |t|
                                          if self.original_subgenus.try(:name) != t.original_subgenus.try(:name)
                                            soft_validations.add(:base, "The original subgenus does not match with the original subgenus of coordinate #{t.rank_class.rank_name}", success_message: 'Original subgenus was updated', failure_message:  'Failed to update original subgenus')
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 4 other locations - About 35 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 778..782
                                  app/models/protonym/soft_validation_extensions.rb on lines 808..812
                                  app/models/protonym/soft_validation_extensions.rb on lines 838..842
                                  app/models/protonym/soft_validation_extensions.rb on lines 868..872

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

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

                                      def sv_validate_coordinated_names_original_variety
                                        return true if !is_species_rank? || has_misspelling_relationship?
                                        list_of_coordinated_names.each do |t|
                                          if self.original_variety.try(:name) != t.original_variety.try(:name)
                                            soft_validations.add(:base, "The original variety does not match with the original variety of coordinate #{t.rank_class.rank_name}", success_message: 'Original variety was updated', failure_message:  'Failed to update original variety')
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 4 other locations - About 35 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 748..752
                                  app/models/protonym/soft_validation_extensions.rb on lines 778..782
                                  app/models/protonym/soft_validation_extensions.rb on lines 808..812
                                  app/models/protonym/soft_validation_extensions.rb on lines 868..872

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

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

                                      def sv_validate_coordinated_names_original_form
                                        return true if !is_species_rank? || has_misspelling_relationship?
                                        list_of_coordinated_names.each do |t|
                                          if self.original_form.try(:name) != t.original_form.try(:name)
                                            soft_validations.add(:base, "The original form does not match with the original form of coordinate #{t.rank_class.rank_name}", success_message: 'Original form was updated', failure_message:  'Failed to update original form')
                                  Severity: Major
                                  Found in app/models/protonym/soft_validation_extensions.rb and 4 other locations - About 35 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 748..752
                                  app/models/protonym/soft_validation_extensions.rb on lines 778..782
                                  app/models/protonym/soft_validation_extensions.rb on lines 808..812
                                  app/models/protonym/soft_validation_extensions.rb on lines 838..842

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

                                  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

                                      def sv_fix_coordinated_names_gender
                                        return false unless self.gender_class.nil?
                                        list_of_coordinated_names.each do |t|
                                          unless t.gender_class.nil?
                                            c = self.taxon_name_classifications.create(type: t.gender_class.to_s)
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb and 1 other location - About 30 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 707..715

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 33.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_fix_coordinated_names_part_of_speech
                                        return false unless self.part_of_speech_class.nil?
                                        list_of_coordinated_names.each do |t|
                                          unless t.part_of_speech_class.nil?
                                            c = self.taxon_name_classifications.create(type: t.part_of_speech_class.to_s)
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb and 1 other location - About 30 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 686..694

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 33.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_validate_coordinated_names_part_of_speech
                                        return true unless is_available?
                                        return true unless is_species_rank?
                                        list_of_coordinated_names.each do |t|
                                          if self.part_of_speech_class != t.part_of_speech_class
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 30 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 898..903
                                  app/models/protonym/soft_validation_extensions.rb on lines 1017..1022

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 33.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_validate_coordinated_names_type_species
                                        return true unless is_valid?
                                        return true unless is_genus_rank?
                                        list_of_coordinated_names.each do |t|
                                          if self.type_species != t.type_species
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 30 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 697..702
                                  app/models/protonym/soft_validation_extensions.rb on lines 1017..1022

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 33.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_validate_coordinated_names_type_genus
                                        return true unless is_valid?
                                        return true unless is_family_rank?
                                        list_of_coordinated_names.each do |t|
                                          if self.type_genus != t.type_genus
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 30 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 697..702
                                  app/models/protonym/soft_validation_extensions.rb on lines 898..903

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 33.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_validate_coordinated_names_author
                                        s = self.verbatim_author
                                        list_of_coordinated_names.each do |t|
                                          soft_validations.add(:verbatim_author, "The author does not match with the author of the coordinate #{t.rank_class.rank_name}", success_message: 'Author was updated', failure_message:  'Failed to update author') unless s == t.verbatim_author
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb and 1 other location - About 20 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 657..660

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 27.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                      def sv_validate_coordinated_names_year
                                        s = self.year_of_publication
                                        list_of_coordinated_names.each do |t|
                                          soft_validations.add(:year_of_publication, "The year of publication does not match with the year of the coordinate #{t.rank_class.rank_name}", success_message: 'Year was updated', failure_message:  'Failed to update year') unless s == t.year_of_publication
                                  Severity: Minor
                                  Found in app/models/protonym/soft_validation_extensions.rb and 1 other location - About 20 mins to fix
                                  app/models/protonym/soft_validation_extensions.rb on lines 639..642

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 27.

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

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

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

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

                                  Refactorings

                                  Further Reading

                                  Redundant use of Object#to_s in interpolation.
                                  Open

                                              l << (value == 1 ? " as '#{key.constantize.label}' #{value.to_s} time" : " as '#{key.constantize.label}' #{value.to_s} times")

                                  This cop checks for string conversion in string interpolation, which is redundant.

                                  Example:

                                  # bad
                                  
                                  "result is #{something.to_s}"

                                  Example:

                                  # good
                                  
                                  "result is #{something}"

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

                                          unless Combination.where("cached = ? AND cached_valid_taxon_name_id = ?", cached, cached_valid_taxon_name_id).any?

                                  Checks if uses of quotes match the configured preference.

                                  Example: EnforcedStyle: single_quotes (default)

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

                                  Example: EnforcedStyle: double_quotes

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

                                  Use 2 (not 0) spaces for indentation.
                                  Open

                                          begin

                                  This cop checks for indentation that doesn't use the specified number of spaces.

                                  See also the IndentationConsistency cop which is the companion to this one.

                                  Example:

                                  # bad
                                  class A
                                   def test
                                    puts 'hello'
                                   end
                                  end
                                  
                                  # good
                                  class A
                                    def test
                                      puts 'hello'
                                    end
                                  end

                                  Example: IgnoredPatterns: ['^\s*module']

                                  # bad
                                  module A
                                  class B
                                    def test
                                    puts 'hello'
                                    end
                                  end
                                  end
                                  
                                  # good
                                  module A
                                  class B
                                    def test
                                      puts 'hello'
                                    end
                                  end
                                  end

                                  Redundant use of Object#to_s in interpolation.
                                  Open

                                              l << (value == 1 ? " as '#{key.constantize.label}' #{value.to_s} time" : " as '#{key.constantize.label}' #{value.to_s} times")

                                  This cop checks for string conversion in string interpolation, which is redundant.

                                  Example:

                                  # bad
                                  
                                  "result is #{something.to_s}"

                                  Example:

                                  # good
                                  
                                  "result is #{something}"

                                  There are no issues that match your filters.

                                  Category
                                  Status