SpeciesFileGroup/taxonworks

View on GitHub

Showing 739 of 12,579 total issues

Class CollectingEventsController has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

class CollectingEventsController < ApplicationController
  include DataControllerConfiguration::ProjectDataControllerConfiguration

  before_action :set_collecting_event, only: [:show, :edit, :update, :destroy, :card, :clone, :navigation]
  after_action -> { set_pagination_headers(:collecting_events) }, only: [:index, :api_index], if: :json_request?
Severity: Minor
Found in app/controllers/collecting_events_controller.rb - About 4 hrs to fix

    Class Filter has 33 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Filter < Query::Filter
          include Queries::Concerns::DataAttributes
          include Queries::Concerns::Notes
          include Queries::Concerns::Tags
    
    
    Severity: Minor
    Found in lib/queries/person/filter.rb - About 4 hrs to fix

      Method include_multistate_matrix has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def include_multistate_matrix(options = {})
          opt = {target: '', descriptors: []}.merge!(options)
          xml = Builder::XmlMarkup.new(target: opt[:target])
      
          m = opt[:observation_matrix]
      Severity: Minor
      Found in app/helpers/observation_matrices/export/nexml_helper.rb - About 4 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method all_sub_headers has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def all_sub_headers(filtered = false)
          unless filtered
            ce_headers # generate the header structure (see CollectionObject.selected_column_names)
            co_headers
            bc_headers
      Severity: Minor
      Found in app/helpers/tasks/gis/report_helper.rb - About 4 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method data_for has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.data_for(collection_object)
          o = collection_object
          data = Catalog::CollectionObject::Entry.new(o)
      
          data.items << Catalog::CollectionObject::EntryItem.new(type: :collected_on, object: o.collecting_event, start_date: o.collecting_event.start_date, end_date: o.collecting_event.end_date) if o.collecting_event_id.present?
      Severity: Major
      Found in lib/catalog/collection_object.rb - About 4 hrs to fix

        File otus_controller.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class OtusController < ApplicationController
          include DataControllerConfiguration::ProjectDataControllerConfiguration
        
          before_action :set_otu, only: [
            :show, :edit, :update, :destroy, :collection_objects, :navigation,
        Severity: Minor
        Found in app/controllers/otus_controller.rb - About 3 hrs to fix

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

              def sv_validate_name
                correct_name_format = false
          
                if rank_class
                  # TODO: name these Regexp somewhere
          Severity: Minor
          Found in app/models/protonym/soft_validation_extensions.rb - About 3 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

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

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

          Cognitive Complexity

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

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

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

          Further reading

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

            def descriptors_hash_initiate
              h = {}
          
              descriptors_with_keywords.each do |d|
                h[d.id] = {}
          Severity: Minor
          Found in lib/tools/interactive_key.rb - About 3 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              def self.significant_digits(number_string)
                # is there a decimal point?
                intg = ''
                decimal_point_zeros = ''
                mantissa = ''
          Severity: Minor
          Found in lib/utilities/geo.rb - About 3 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

          Class Result has 31 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Result
              SMALL_WIDTH = 100
              LARGE_WIDTH = 400
          
              TEXT_MAP = {
          Severity: Minor
          Found in lib/vendor/sqed_to_taxonworks.rb - About 3 hrs to fix

            Method date_sql_from_params has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.date_sql_from_params(params)
                st_date, end_date = params['st_datepicker'], params['en_datepicker']
                # processing start date data
                st_year, st_month, st_day = params['start_date_year'], params['start_date_month'], params['start_date_day']
                unless st_date.blank?
            Severity: Minor
            Found in lib/utilities/dates.rb - About 3 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method to_s_verbose has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

              def to_s_verbose
                d = data
                str = ''
            
                d.keys.sort{|a,b| (a || 'zzz') <=> (b || 'zzz')}.each do |c|
            Severity: Minor
            Found in lib/catalog/distribution/entry.rb - About 3 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method conform_significant has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.conform_significant(number, sig_digits)
                  input = significant_digits(number.to_s)
                  input_string = input[0]
                  intg = input[2]
                  decimal_point = input[3]
            Severity: Minor
            Found in lib/utilities/geo.rb - About 3 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            File filter.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Queries
              module CollectingEvent
                class Filter < Query::Filter
            
                  # Params exists for all CollectingEvent attributes except these.
            Severity: Minor
            Found in lib/queries/collecting_event/filter.rb - About 3 hrs to fix

              Class Filter has 30 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Filter < Query::Filter
              
                    # Params exists for all CollectingEvent attributes except these.
                    # geographic_area_id is excluded because we handle it specially in conjunction with `geographic_area_mode``
                    # Definition must preceed include.
              Severity: Minor
              Found in lib/queries/collecting_event/filter.rb - About 3 hrs to fix

                Method generate has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.generate(otu, project_members, reference_csv = nil)
                     name_total = 0
                    ::CSV.generate(col_sep: "\t") do |csv|
                      csv << %w{
                        ID
                Severity: Major
                Found in lib/export/coldp/files/name.rb - About 3 hrs to fix

                  Method generate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.generate(otus, project_members, reference_csv = nil)
                      ::CSV.generate(col_sep: "\t") do |csv|
                  
                        csv << %w{taxonID nameID status remarks referenceID modified modifiedBy}
                  
                  
                  Severity: Minor
                  Found in lib/export/coldp/files/synonym.rb - About 3 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Class SourcesController has 29 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class SourcesController < ApplicationController
                    include DataControllerConfiguration::SharedDataControllerConfiguration
                  
                    before_action :set_source, only: [:show, :edit, :update, :destroy, :clone, :api_show]
                    after_action -> { set_pagination_headers(:sources) }, only: [:index, :api_index ], if: :json_request?
                  Severity: Minor
                  Found in app/controllers/sources_controller.rb - About 3 hrs to fix

                    Method build_collecting_events has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def build_collecting_events
                          # DRMFieldNumbers DRMFN
                          namespace_drm_field_numbers = Namespace.find_by(name: 'DRMFieldNumbers')
                    
                          @total_data_lines = 0
                    Severity: Minor
                    Found in lib/batch_load/import/collecting_events/castor_interpreter.rb - About 3 hrs to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language