SpeciesFileGroup/taxonworks

View on GitHub

Showing 732 of 12,568 total issues

Method coordinates_regex_from_verbatim_label has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    def self.coordinates_regex_from_verbatim_label(text)
      return nil if text.blank?
      text = text.gsub("''", '"')
        .gsub('´´', '"')
        .gsub('ʹʹ', '"')
Severity: Minor
Found in lib/utilities/geo.rb - About 6 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 useful_descriptors has 168 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def useful_descriptors
    list_of_remaining_taxa = {}
    language = language_id.blank? ? nil : language_id.to_i
    row_hash.each do |r_key, r_value|
      if r_value[:status] != 'eliminated'
Severity: Major
Found in lib/tools/interactive_key.rb - About 6 hrs to fix

    File dwc_extensions.rb has 445 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module CollectionObject::DwcExtensions
    
      extend ActiveSupport::Concern
    
      include CollectionObject::DwcExtensions::TaxonworksExtensions
    Severity: Minor
    Found in app/models/collection_object/dwc_extensions.rb - About 6 hrs to fix

      Class CollectionObjectsController has 48 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class CollectionObjectsController < ApplicationController
        include DataControllerConfiguration::ProjectDataControllerConfiguration
      
        before_action :set_collection_object, only: [
          :show, :edit, :update, :destroy, :navigation, :containerize,
      Severity: Minor
      Found in app/controllers/collection_objects_controller.rb - About 6 hrs to fix

        Method date_regex_from_verbatim_label has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.date_regex_from_verbatim_label(text)
            return nil if text.blank?
            text = ' ' + text.downcase.squish + ' '
        
            date = {}
        Severity: Minor
        Found in lib/utilities/dates.rb - About 6 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 interactive_key.rb has 439 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class Tools::InteractiveKey
        
          ##### FILTER PARAMETERS #####
        
          # @!observation_matrix_id
        Severity: Minor
        Found in lib/tools/interactive_key.rb - About 6 hrs to fix

          File data.rb has 431 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'zip'
          
          module Export::Dwca
          
            # !!
          Severity: Minor
          Found in lib/export/dwca/data.rb - About 6 hrs to fix

            Method bibtex_from_citproc has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.bibtex_from_citproc(c, b)
                  return nil unless c.present? && b.present?
                  c = JSON.parse(c)
            
                  b[:address] = ::Utilities::Strings.encode_with_utf8(c['address']) unless c['address'].blank?
            Severity: Minor
            Found in lib/vendor/serrano.rb - About 6 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 get_diffs has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_diffs version_new, version_old
                added_strings = []
                added_strings_indices = []
                deleted_strings = []
                deleted_strings_indices = []
            Severity: Minor
            Found in app/helpers/plugins/papertrail_helper.rb - About 6 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_da_for_otus has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
            Open

                def build_da_for_otus
                  @total_data_lines = 0
                  i = 0
                  import_klass = type_select.start_with?('im')
                  att_klass = (type_select.capitalize + 'Attribute').safe_constantize
            Severity: Minor
            Found in lib/batch_load/import/otus/data_attributes_interpreter.rb - About 6 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 useGraph has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

            export function useGraph() {
              const state = reactive(initState())
            
              const nodes = computed(() =>
                Object.fromEntries(

            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 OtusController has 42 methods (exceeds 20 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 5 hrs to fix

              File collection_objects_controller.rb has 401 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class CollectionObjectsController < ApplicationController
                include DataControllerConfiguration::ProjectDataControllerConfiguration
              
                before_action :set_collection_object, only: [
                  :show, :edit, :update, :destroy, :navigation, :containerize,
              Severity: Minor
              Found in app/controllers/collection_objects_controller.rb - About 5 hrs to fix

                Method get_otu_contents has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def get_otu_contents(options = {})
                    opt = {otus: []}.merge!(options)
                    m = opt[:observation_matrix]
                
                    otus = Otu.select('otus.*, observation_matrix_rows.id AS row_id').
                Severity: Major
                Found in app/helpers/observation_matrices/export/otu_contents_helper.rb - About 5 hrs to fix

                  Function init has 133 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    init: function() {
                    var
                        animationTime = 250;
                  
                    function showAll() {
                  Severity: Major
                  Found in app/assets/javascripts/views/shared/lists.js - About 5 hrs to fix

                    File useGraph.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { reactive, computed, toRefs } from 'vue'
                    import {
                      BiologicalAssociation,
                      BiologicalAssociationGraph,
                      Citation

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

                      module Queries
                      
                        # Overview
                        #
                        # This class manages params and nesting of filter queries.
                      Severity: Minor
                      Found in lib/queries/query/filter.rb - About 5 hrs to fix

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

                          class Query::Autocomplete < Queries::Query
                        
                            include Arel::Nodes
                        
                            include Queries::Concerns::Identifiers
                        Severity: Minor
                        Found in lib/queries/query/autocomplete.rb - About 5 hrs to fix

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

                              class Result
                                # query string
                                attr_accessor :name
                          
                                # how to match
                          Severity: Minor
                          Found in lib/vendor/biodiversity.rb - About 5 hrs to fix

                            Method using_iccn_class has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def using_iccn_class
                                unless identifier.nil?
                                  lccn = identifier
                            
                                  # '200112345', '2010549727', '2003064850', '|a  2003064850', '88156495', '68-004897', '2001-459440'
                            Severity: Minor
                            Found in app/models/identifier/global/lccn.rb - About 5 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