SpeciesFileGroup/taxonworks

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

Summary

Maintainability
F
1 wk
Test Coverage

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

module Protonym::SoftValidationExtensions

  module Klass

    VALIDATIONS = {
Severity: Major
Found in app/models/protonym/soft_validation_extensions.rb - About 2 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 51 (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 7 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. [41/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.

    Method sv_potential_genus_homonyms has a Cognitive Complexity of 21 (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 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_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
    #            name1 = self.cached_primary_homonym ? self.cached_primary_homonym : 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 has too many lines. [29/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 has too many lines. [29/25]
    Open

        def sv_fix_add_nominotypical_sub
          rank  = rank_string
          p     = self.parent
          prank = p.rank_string
          if (rank =~ /Family/ && prank =~ /Family/) || (rank =~ /Genus/ && prank =~ /Genus/) || (rank =~ /Species/ && prank =~ /Species/)

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

        def sv_fix_add_nominotypical_sub
          rank  = rank_string
          p     = self.parent
          prank = p.rank_string
          if (rank =~ /Family/ && prank =~ /Family/) || (rank =~ /Genus/ && prank =~ /Genus/) || (rank =~ /Species/ && prank =~ /Species/)
    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_homotypic_synonyms has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def sv_homotypic_synonyms
          unless 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 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 41 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_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_species_gender_agreement has 29 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

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

            def sv_fix_add_nominotypical_sub
              rank  = rank_string
              p     = self.parent
              prank = p.rank_string
              if (rank =~ /Family/ && prank =~ /Family/) || (rank =~ /Genus/ && prank =~ /Genus/) || (rank =~ /Species/ && prank =~ /Species/)
        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_fix_coordinated_names_part_of_speach has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def sv_fix_coordinated_names_part_of_speach
                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

          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

            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

            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

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

                                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

                    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

                      Consider simplifying this complex logical expression.
                      Open

                              if ((self.source && t.source && self.source.id != t.source.id) || (self.source.nil? && t.source)) && is_available?
                                soft_validations.add(:base, "The original publication does not match with the original publication of the coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_source, success_message: 'Original publication was 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 (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 !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
                                        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")
                          Severity: Major
                          Found in app/models/protonym/soft_validation_extensions.rb - About 40 mins to fix

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

                                def sv_fix_coordinated_names_source
                                  fixed = false
                                  return false unless self.source.nil?
                                    list_of_coordinated_names.each do |t|
                                      if !t.source.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_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_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_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_fix_coordinated_names_type_species has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def sv_fix_coordinated_names_type_species
                                  fixed = false
                                  return false unless self.type_species.nil?
                                  list_of_coordinated_names.each do |t|
                                    if !t.type_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_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_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_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_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

                            Avoid more than 4 levels of block nesting.
                            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?

                            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 4 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 4 levels of block nesting.
                            Open

                                          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

                            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 4 levels of block nesting.
                            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?

                            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 4 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::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 4 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} could be a primary homonym of #{s.cached_html_name_and_author_year} (alternative spelling)")
                                            end
                                          else

                            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 4 levels of block nesting.
                            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?

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

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

                                def sv_fix_coordinated_names_type_species
                                  fixed = false
                                  return false unless self.type_species.nil?
                                  list_of_coordinated_names.each do |t|
                                    if !t.type_species.nil?
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 50 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 202..218
                            app/models/protonym/soft_validation_extensions.rb on lines 551..567

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

                            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_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: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 50 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 202..218
                            app/models/protonym/soft_validation_extensions.rb on lines 486..502

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

                            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_fix_coordinated_names_source
                                  fixed = false
                                  return false unless self.source.nil?
                                    list_of_coordinated_names.each do |t|
                                      if !t.source.nil?
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 50 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 486..502
                            app/models/protonym/soft_validation_extensions.rb on lines 551..567

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

                            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 6 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 5 other locations - About 45 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 336..352
                            app/models/protonym/soft_validation_extensions.rb on lines 366..382
                            app/models/protonym/soft_validation_extensions.rb on lines 396..412
                            app/models/protonym/soft_validation_extensions.rb on lines 426..442
                            app/models/protonym/soft_validation_extensions.rb on lines 456..472

                            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 6 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 5 other locations - About 45 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 306..322
                            app/models/protonym/soft_validation_extensions.rb on lines 336..352
                            app/models/protonym/soft_validation_extensions.rb on lines 366..382
                            app/models/protonym/soft_validation_extensions.rb on lines 426..442
                            app/models/protonym/soft_validation_extensions.rb on lines 456..472

                            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 6 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 5 other locations - About 45 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 306..322
                            app/models/protonym/soft_validation_extensions.rb on lines 336..352
                            app/models/protonym/soft_validation_extensions.rb on lines 396..412
                            app/models/protonym/soft_validation_extensions.rb on lines 426..442
                            app/models/protonym/soft_validation_extensions.rb on lines 456..472

                            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 6 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 5 other locations - About 45 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 306..322
                            app/models/protonym/soft_validation_extensions.rb on lines 336..352
                            app/models/protonym/soft_validation_extensions.rb on lines 366..382
                            app/models/protonym/soft_validation_extensions.rb on lines 396..412
                            app/models/protonym/soft_validation_extensions.rb on lines 456..472

                            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 6 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 5 other locations - About 45 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 306..322
                            app/models/protonym/soft_validation_extensions.rb on lines 336..352
                            app/models/protonym/soft_validation_extensions.rb on lines 366..382
                            app/models/protonym/soft_validation_extensions.rb on lines 396..412
                            app/models/protonym/soft_validation_extensions.rb on lines 426..442

                            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 6 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 5 other locations - About 45 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 306..322
                            app/models/protonym/soft_validation_extensions.rb on lines 366..382
                            app/models/protonym/soft_validation_extensions.rb on lines 396..412
                            app/models/protonym/soft_validation_extensions.rb on lines 426..442
                            app/models/protonym/soft_validation_extensions.rb on lines 456..472

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

                                def sv_validate_coordinated_names_original_variety
                                  return true if !is_species_rank? && !self.iczn_set_as_incorrect_original_spelling_of_relationship.blank?
                                  list_of_coordinated_names.each do |t|
                                    if self.original_variety != t.original_variety
                                      soft_validations.add(:base, "The original variety does not match with the original variety of coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_original_variety, success_message: 'Original variety was updated')
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 5 other locations - About 35 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 297..301
                            app/models/protonym/soft_validation_extensions.rb on lines 327..331
                            app/models/protonym/soft_validation_extensions.rb on lines 357..361
                            app/models/protonym/soft_validation_extensions.rb on lines 387..391
                            app/models/protonym/soft_validation_extensions.rb on lines 447..451

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

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

                                def sv_validate_coordinated_names_original_genus
                                  return true if !is_genus_or_species_rank? && !self.iczn_set_as_incorrect_original_spelling_of_relationship.blank?
                                  list_of_coordinated_names.each do |t|
                                    if self.original_genus != t.original_genus
                                      soft_validations.add(:base, "The original genus does not match with the original genus of coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_original_genus, success_message: 'Original genus was updated')
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 5 other locations - About 35 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 327..331
                            app/models/protonym/soft_validation_extensions.rb on lines 357..361
                            app/models/protonym/soft_validation_extensions.rb on lines 387..391
                            app/models/protonym/soft_validation_extensions.rb on lines 417..421
                            app/models/protonym/soft_validation_extensions.rb on lines 447..451

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

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

                                def sv_validate_coordinated_names_original_form
                                  return true if !is_species_rank? && !self.iczn_set_as_incorrect_original_spelling_of_relationship.blank?
                                  list_of_coordinated_names.each do |t|
                                    if self.original_form != t.original_form
                                      soft_validations.add(:base, "The original form does not match with the original form of coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_original_form, success_message: 'Original form was updated')
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 5 other locations - About 35 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 297..301
                            app/models/protonym/soft_validation_extensions.rb on lines 327..331
                            app/models/protonym/soft_validation_extensions.rb on lines 357..361
                            app/models/protonym/soft_validation_extensions.rb on lines 387..391
                            app/models/protonym/soft_validation_extensions.rb on lines 417..421

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

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

                                def sv_validate_coordinated_names_original_subgenus
                                  return true if !is_genus_or_species_rank? && !self.iczn_set_as_incorrect_original_spelling_of_relationship.blank?
                                  list_of_coordinated_names.each do |t|
                                    if self.original_subgenus != t.original_subgenus
                                      soft_validations.add(:base, "The original subgenus does not match with the original subgenus of coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_original_subgenus, success_message: 'Original subgenus was updated')
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 5 other locations - About 35 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 297..301
                            app/models/protonym/soft_validation_extensions.rb on lines 357..361
                            app/models/protonym/soft_validation_extensions.rb on lines 387..391
                            app/models/protonym/soft_validation_extensions.rb on lines 417..421
                            app/models/protonym/soft_validation_extensions.rb on lines 447..451

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

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

                                def sv_validate_coordinated_names_original_species
                                  return true if !is_species_rank? && !self.iczn_set_as_incorrect_original_spelling_of_relationship.blank?
                                  list_of_coordinated_names.each do |t|
                                    if self.original_species != t.original_species
                                      soft_validations.add(:base, "The original species does not match with the original species of coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_original_species, success_message: 'Original species was updated')
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 5 other locations - About 35 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 297..301
                            app/models/protonym/soft_validation_extensions.rb on lines 327..331
                            app/models/protonym/soft_validation_extensions.rb on lines 387..391
                            app/models/protonym/soft_validation_extensions.rb on lines 417..421
                            app/models/protonym/soft_validation_extensions.rb on lines 447..451

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

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

                                def sv_validate_coordinated_names_original_subspecies
                                  return true if !is_species_rank? && !self.iczn_set_as_incorrect_original_spelling_of_relationship.blank?
                                  list_of_coordinated_names.each do |t|
                                    if self.original_subspecies != t.original_subspecies
                                      soft_validations.add(:base, "The original subspecies does not match with the original subspecies of coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_original_subspecies, success_message: 'Original subspecies was updated')
                            Severity: Major
                            Found in app/models/protonym/soft_validation_extensions.rb and 5 other locations - About 35 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 297..301
                            app/models/protonym/soft_validation_extensions.rb on lines 327..331
                            app/models/protonym/soft_validation_extensions.rb on lines 357..361
                            app/models/protonym/soft_validation_extensions.rb on lines 417..421
                            app/models/protonym/soft_validation_extensions.rb on lines 447..451

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

                            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 286..294

                            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_speach
                                  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 266..274

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

                                def sv_validate_coordinated_names_part_of_speach
                                  return true unless is_species_rank?
                                  list_of_coordinated_names.each do |t|
                                    if self.part_of_speech_class != t.part_of_speech_class && is_available?
                                      soft_validations.add(:base, "The part of speech status does not match with that of the coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names, success_message: 'Part of speech was updated')
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 3 other locations - About 25 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 257..262
                            app/models/protonym/soft_validation_extensions.rb on lines 477..482
                            app/models/protonym/soft_validation_extensions.rb on lines 542..547

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

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

                                def sv_validate_coordinated_names_type_species
                                  return true unless is_genus_rank?
                                  list_of_coordinated_names.each do |t|
                                    if self.type_species != t.type_species && is_available?
                                      soft_validations.add(:base, "The type species does not match with the type species of the coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_type_species, success_message: 'Type species was updated')
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 3 other locations - About 25 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 257..262
                            app/models/protonym/soft_validation_extensions.rb on lines 277..282
                            app/models/protonym/soft_validation_extensions.rb on lines 542..547

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

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

                                def sv_validate_coordinated_names_gender
                                  return true unless is_genus_rank?
                                  list_of_coordinated_names.each do |t|
                                    if self.gender_class != t.gender_class && is_available?
                                      soft_validations.add(:base, "The gender status does not match with that of the coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_gender, success_message: 'Gender was updated')
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 3 other locations - About 25 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 277..282
                            app/models/protonym/soft_validation_extensions.rb on lines 477..482
                            app/models/protonym/soft_validation_extensions.rb on lines 542..547

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

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

                                def sv_validate_coordinated_names_type_genus
                                  return true unless is_family_rank?
                                  list_of_coordinated_names.each do |t|
                                    if self.type_genus != t.type_genus && is_available?
                                      soft_validations.add(:base, "The type genus does not match with the type genus of the coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_type_genus, success_message: 'Type genus was updated')
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 3 other locations - About 25 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 257..262
                            app/models/protonym/soft_validation_extensions.rb on lines 277..282
                            app/models/protonym/soft_validation_extensions.rb on lines 477..482

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

                            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_year
                                  return false unless self.year_of_publication.nil?
                                  list_of_coordinated_names.each do |t|
                                    if self.year_of_publication.nil? && !t.year_of_publication.nil?
                                      self.update_column(:year_of_publication, t.year_of_publication)
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 1 other location - About 25 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 229..237

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

                            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_author
                                  return false unless self.verbatim_author.nil?
                                  list_of_coordinated_names.each do |t|
                                    if self.verbatim_author.nil? && !t.verbatim_author.nil?
                                      self.update_column(:verbatim_author, t.verbatim_author)
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 1 other location - About 25 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 246..254

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

                            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

                                          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: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 20 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 122..126
                            app/models/protonym/soft_validation_extensions.rb on lines 136..140

                            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 3 locations. Consider refactoring.
                            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: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 20 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 122..126
                            app/models/protonym/soft_validation_extensions.rb on lines 129..133

                            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 3 locations. Consider refactoring.
                            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: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 2 other locations - About 20 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 129..133
                            app/models/protonym/soft_validation_extensions.rb on lines 136..140

                            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_author
                                  list_of_coordinated_names.each do |t|
                                    soft_validations.add(:verbatim_author, "The author does not match with the author of the coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_author, success_message: 'Author was updated') unless self.verbatim_author == t.verbatim_author
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 1 other location - About 15 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 240..242

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

                            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
                                  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 coordinated #{t.rank_class.rank_name}", fix: :sv_fix_coordinated_names_year, success_message: 'Year was updated') unless self.year_of_publication == t.year_of_publication
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb and 1 other location - About 15 mins to fix
                            app/models/protonym/soft_validation_extensions.rb on lines 223..225

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

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

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

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

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

                            Refactorings

                            Further Reading

                            Use 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

                            Use 2 (not 4) spaces for indentation.
                            Open

                                          name2 = self.cached_primary_homonym_alternative_spelling ? self.cached_primary_homonym_alternative_spelling : nil

                            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

                            There are no issues that match your filters.

                            Category
                            Status