SpeciesFileGroup/taxonworks

View on GitHub

Showing 732 of 12,571 total issues

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

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

        def sv_synonym_relationship
          if self.source
            date1 = self.source.cached_nomenclature_date.to_time
            date2 = self.subject_taxon_name.cached_nomenclature_date
            if !!date1 && !!date2
      Severity: Minor
      Found in app/models/taxon_name_relationship/icnp/unaccepting/synonym.rb - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

        def sv_validate_priority
          if self.type_class.nomenclatural_priority == :direct
            date1 = self.subject_taxon_name.cached_nomenclature_date
            date2 = self.object_taxon_name.cached_nomenclature_date
            if !!date1 && !!date2 && date2 > date1 && subject_invalid_statuses.empty?
      Severity: Minor
      Found in app/models/taxon_name_relationship/iczn.rb - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

        def sv_synonym_relationship
          if self.source
            date1 = self.source.cached_nomenclature_date.to_time
            date2 = self.subject_taxon_name.cached_nomenclature_date
            if !!date1 && !!date2
      Severity: Minor
      Found in app/models/taxon_name_relationship/iczn/invalidating/synonym.rb - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

        def sv_single_primary_type
          primary_types = TypeMaterial.with_type_array(['holotype', 'neotype', 'lectotype']).where_protonym(protonym).not_self(self)
          syntypes = TypeMaterial.with_type_array(['syntype', 'syntypes']).where_protonym(protonym)
      
          if type_type =~ /syntype/
      Severity: Minor
      Found in app/models/type_material.rb - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

        def self.containerize(objects, klass = Container::Virtual)
          new_container = nil
          begin
            Container.transaction do
              new_container = klass.create()
      Severity: Minor
      Found in app/models/container.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

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

          def cached_trigger_methods(object)
            k = object.class.base_class.name.to_sym
            if cached_triggers[k]
              cached_triggers[k]
            elsif
        Severity: Minor
        Found in app/models/role.rb - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

          def object_tag(object)
            return nil if object.nil?
            method = object_tag_method(object)
        
            # meh, exceptions  
        Severity: Minor
        Found in app/helpers/workbench/display_helper.rb - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Avoid deeply nested control flow statements.
        Open

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

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

            def recursive_catalog_tag(taxon_name, data = { body: '', sources: [], supplementary_distribution: ::Catalog::Distribution::Entry.new([]), repositories: [], options: OPTIONS}, depth = 0 )
          
              data[:body] << [
                paper_header_prefix(taxon_name, data[:options]),
                full_taxon_name_tag(taxon_name),
          Severity: Minor
          Found in app/helpers/taxon_names/paper_catalog_helper.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 new_index_new > version_new.length || version_old[new_index_old] == version_new[new_index_new]
                        if curr_index_new != new_index_new
                          added_strings.push(version_new[curr_index_new...new_index_new])
                          added_strings_indices.push(curr_index_new)
                        end
          Severity: Major
          Found in app/helpers/plugins/papertrail_helper.rb - About 45 mins to fix

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

              def send_password_reset
                if params[:email]
                  user = User.find_by_email(params[:email].downcase)
                end
            
            
            Severity: Minor
            Found in app/controllers/users_controller.rb - About 45 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

              def create
                @georeference = Georeference::GeoLocate.new(georeference_params)
                respond_to do |format|
                  if @georeference.save
                    format.html {
            Severity: Minor
            Found in app/controllers/georeferences/geo_locates_controller.rb - About 45 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

              def create
                @georeference = Georeference::GoogleMap.new(georeference_params)
                respond_to do |format|
                  if @georeference.save
                    format.html do
            Severity: Minor
            Found in app/controllers/georeferences/google_maps_controller.rb - About 45 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

              def nexml_depictions(options = {})
                opt = {target: '', descriptors: []}.merge!(options)
                xml = Builder::XmlMarkup.new(target: opt[:target])
                m = opt[:observation_matrix]
                xml.depictions do
            Severity: Minor
            Found in app/helpers/observation_matrices/export/nexml_helper.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

                    r.error_messages << "Multiple OTUs matched the name '#{name}'." if r.multiple_matches?
            Severity: Major
            Found in lib/batch_load/column_resolver.rb - About 45 mins to fix

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

                def import_value_facet
                  return nil if data_attribute_import_exact_value.blank? && data_attribute_import_wildcard_value.blank?
              
                  a,b = nil, nil
              
              
              Severity: Minor
              Found in lib/queries/concerns/data_attributes.rb - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  def matches?(is_fixable, include_flagged = false)
                    a = is_fixable.nil? ? true : (is_fixable ? fixable? : true)
                    b = include_flagged == true ? true : !flagged
                    a && b
                  end
              Severity: Minor
              Found in lib/soft_validation/soft_validation_method.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

              Severity
              Category
              Status
              Source
              Language