SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,628 of 12,628 total issues

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

    Avoid deeply nested control flow statements.
    Open

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

      Method 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

      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

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

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

          def data_class_summary
            @klass = params.require(:klass)&.safe_constantize
            @time_span = params.require(:time_span)
            @target = params.require(:target)
            @projects = params[:project_id].blank? ? Project.all : Project.where(id: params[:project_id])
        Severity: Minor
        Found in app/controllers/administration_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

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

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

            def add_scopes_to_routes
              scopes = ['scope :tasks']
              scope_index = 0
          
              @paths.each do |path|
          Severity: Minor
          Found in lib/generators/taxon_works/task/task_generator.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 nom_status_field has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.nom_status_field(taxon_name)
              case taxon_name.type
              when 'Combination'
                nil # This is *not* 'chresonym' sensu CoL (which is this: [correct: 'Aus bus Smith 1920', chresonym: 'Aus bus Jones 1922'])
              else
          Severity: Minor
          Found in lib/export/coldp/files/name.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 << "No OTU with name '#{name}' exists." if r.no_matches?
          Severity: Major
          Found in lib/batch_load/column_resolver.rb - About 45 mins to fix

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

                  def autocomplete
                    queries = [
                      autocomplete_exact_cached,
                      autocomplete_exact_identifier,
                      autocomplete_matching_cached,
            Severity: Minor
            Found in lib/queries/identifier/autocomplete.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 all_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def all_data
                  return @all_data if @all_data
            
                  Rails.logger.debug 'dwca_export: start combining all data'
            
            
            Severity: Minor
            Found in lib/export/dwca/data.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 with_parsed_date has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def with_parsed_date(t = :start)
                if d = simple_date
                  r = []
                  r.push(table["#{t}_date_day".to_sym].eq(d.day)) if d.day
                  r.push(table["#{t}_date_month".to_sym].eq(d.month)) if d.month
            Severity: Minor
            Found in lib/queries/concerns/date_ranges.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 list.blank? # treat it like a taxon name
                      list = Otu.joins(:taxon_name)
                                 .where(taxon_names: {cached: name}, project_id: proj_id)
                                 .limit(2)
                    end
            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

              Severity
              Category
              Status
              Source
              Language