SpeciesFileGroup/taxonworks

View on GitHub

Showing 740 of 12,614 total issues

File taxon_names_controller.rb has 310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class TaxonNamesController < ApplicationController
  include DataControllerConfiguration::ProjectDataControllerConfiguration

  before_action :set_taxon_name, only: [:show, :edit, :update, :destroy, :browse, :original_combination, :catalog, :api_show, :api_summary, :api_catalog]
  after_action -> { set_pagination_headers(:taxon_names) }, only: [:index, :api_index, :origin_citation], if: :json_request?
Severity: Minor
Found in app/controllers/taxon_names_controller.rb - About 3 hrs to fix

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

        def self.included_annotator_facets
          f = [
            ::Queries::Concerns::Users
          ]
    
    
    Severity: Minor
    Found in lib/queries/query/filter.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 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

    Consider simplifying this complex logical expression.
    Open

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

      Method hunt_lat_long has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.hunt_lat_long(label, how = ' ')
            if how.nil?
              pieces = [label]
            else
              pieces = label.split(how)
      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

      Method extract_dates has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.extract_dates(trial, match_data)
          end_date_year, end_date_month, end_date_day = 0, 0, 0
          case trial[:method].downcase.to_sym
            when :month_dd_yyyy_2
              start_date_year = 3
      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 gpx_to_csv has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.gpx_to_csv(gpx_file, csv_options = {col_sep: "\t", headers: true, encoding: 'UTF-8', write_headers: true})
          gpx_headers = %w(name geojson start_date end_date minimum_elevation maximum_elevation)
      
          csv_string = CSV.generate(**csv_options) do |csv|
            csv << gpx_headers
      Severity: Minor
      Found in lib/vendor/gpx_to_csv.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 image_matrix.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class Tools::ImageMatrix
      
        ##### FILTER PARAMETERS #####
      
        # @!observation_matrix_id
      Severity: Minor
      Found in lib/tools/image_matrix.rb - About 3 hrs to fix

        Method create_quick_verbatim has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.create_quick_verbatim(options  = {})
            # We could refactor this to use nested attributes, but it's not that much cleaner
            opts = {
              'collection_objects' => {},
              'note' => nil,
        Severity: Minor
        Found in lib/material.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

        Function initializeDrawingManager has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            initializeDrawingManager: function (map, mapDrawingModes) {
              var drawingMode = undefined;      // "active: circle, polygon, circle" results in hand, polygon, circle(selected)
              var drawingModes = [];            // "polygon, circle" results in hand(active), polygon, circle in draw mode menu
              var i;                  // loop counter
              var j = 0;              // offset for start of i-loop when ACTIVE:mode has explicit position
        Severity: Major
        Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 3 hrs to fix

          Function initializeGoogleMap has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              initializeGoogleMap: function (map_canvas, fcdata, map_center) {
          
                // does this need to be set?  would it alter fcdata if not set?
                var mapData = fcdata;
                //
          Severity: Major
          Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 3 hrs to fix

            File task-filter.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            var CarrouselTask = function (sec, rows, columns) {
              // sec = Name of data section, this is for identify div.
              // rows = This is for the number of rows that will be displayed, if this number is less than the number of items, it will activate the navigation controls
            
              this.children = []
            Severity: Minor
            Found in app/assets/javascripts/views/hub/task-filter.js - About 3 hrs to fix

              Function makeInitialState has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function makeInitialState() {
                return reactive({
                  settings: {
                    increment: false,
                    isLocked: false,
              Severity: Major
              Found in app/javascript/vue/tasks/digitize/store/store.js - About 3 hrs to fix

                Method eml has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def eml
                      return @eml if @eml
                      @eml = Tempfile.new('eml.xml')
                
                      # This may need to be logged somewhere
                Severity: Major
                Found in lib/export/dwca/data.rb - About 3 hrs to fix

                  Class LeadsController has 26 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class LeadsController < ApplicationController
                    include DataControllerConfiguration::ProjectDataControllerConfiguration
                    before_action :set_lead, only: %i[
                      edit create_for_edit update destroy show show_all show_all_print all_texts
                      destroy_couplet insert_couplet delete_couplet duplicate update_meta otus]
                  Severity: Minor
                  Found in app/controllers/leads_controller.rb - About 3 hrs to fix

                    Class Autocomplete has 26 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        class Autocomplete < Query::Autocomplete
                    
                          # Either match against all Sources (default) or just those with ProjectSource
                          # @return [Boolean]
                          # @param limit_to_project [String] `true` or `false`
                    Severity: Minor
                    Found in lib/queries/source/autocomplete.rb - About 3 hrs to fix

                      Method build_collecting_events has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        File pinboard.js has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        var TW = TW || {}
                        TW.workbench = TW.workbench || {}
                        TW.workbench.pinboard = TW.workbench.pinboard || {}
                        
                        Object.assign(TW.workbench.pinboard, {
                        Severity: Minor
                        Found in app/assets/javascripts/workbench/pinboard.js - About 2 hrs to fix

                          Method set_cached_names_for_taxon_names has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def set_cached_names_for_taxon_names
                              begin
                                TaxonName.transaction_with_retry do
                                  t = taxon_name
                          
                          
                          Severity: Major
                          Found in app/models/taxon_name_classification.rb - About 2 hrs to fix

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

                                def sv_potential_family_homonyms
                                  if persisted? && is_family_rank? && is_available?
                                    if TaxonNameRelationship.where_subject_is_taxon_name(self).homonym_or_suppressed.empty?
                                      if self.id == self.lowest_rank_coordinated_taxon.id
                                        name2 = self.cached_primary_homonym_alternative_spelling ? self.cached_primary_homonym_alternative_spelling : nil
                            Severity: Minor
                            Found in app/models/protonym/soft_validation_extensions.rb - About 2 hrs to fix

                            Cognitive Complexity

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

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

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

                            Further reading

                            Severity
                            Category
                            Status
                            Source
                            Language