SpeciesFileGroup/taxonworks

View on GitHub

Showing 740 of 12,582 total issues

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

  def descriptors_hash_initiate
    h = {}

    # Depictions is depictions with other attributes added
    depictions = nil
Severity: Minor
Found in lib/tools/image_matrix.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

File nexml_helper.rb has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module ObservationMatrices::Export::NexmlHelper

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

    Method nexml_descriptors has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def nexml_descriptors(options = {})
        opt = {target: ''}.merge!(options)
        xml = Builder::XmlMarkup.new(target: opt[:target])
        m = opt[:observation_matrix]
        # Multistate characters
    Severity: Major
    Found in app/helpers/observation_matrices/export/nexml_helper.rb - About 2 hrs to fix

      Method build_da_for_otus has 72 lines of code (exceeds 25 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: Major
      Found in lib/batch_load/import/otus/data_attributes_interpreter.rb - About 2 hrs to fix

        Class SledImage has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class SledImage < ApplicationRecord
          include Housekeeping
          include Shared::Tags
          include Shared::Notes
          include Shared::IsData
        Severity: Minor
        Found in app/models/sled_image.rb - About 2 hrs to fix

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

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

            Function mx_spinner has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              $.fn.mx_spinner = function(action) {
                  if (!this.length) {   return this; }
                  return this.each(function() {
                    var target = $(this);
                    var overlay =  target.data('mx_spinner');
            Severity: Major
            Found in app/assets/javascripts/vendor/lib/jquery/jquery.mx-spinner.js - About 2 hrs to fix

              Method build_sequence_relationships has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_sequence_relationships
                    @total_data_lines = 0
                    i = 0
                    gene_descriptors = {}
                    gene_attributes = {}
              Severity: Minor
              Found in lib/batch_load/import/sequence_relationships/primers_interpreter.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

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

                def self.generate(otus, project_members, root_otu_id = nil, reference_csv = nil, prefer_unlabelled_otus: true)
              
                  # Until we have RC5 articulations we are simplifying handling the fact
                  # that one taxon name can be used for many OTUs. Track to see that
                  # an OTU with a given taxon name does not already exist
              Severity: Minor
              Found in lib/export/coldp/files/taxon.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

              File identifiers.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Queries::Concerns::Identifiers
                include Queries::Helpers
              
                extend ActiveSupport::Concern
              
              
              Severity: Minor
              Found in lib/queries/concerns/identifiers.rb - About 2 hrs to fix

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

                function makeInitialState () {
                  return {
                    taxon_name: {
                      id: undefined,
                      global_id: undefined,
                Severity: Major
                Found in app/javascript/vue/tasks/nomenclature/new_taxon_name/store/store.js - About 2 hrs to fix

                  Method nexml_otus has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Method remaining_taxa has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def remaining_taxa
                        h = {}
                        language = language_id.blank? ? nil : language_id.to_i
                    
                        row_hash.each do |r_key, r_value|
                    Severity: Major
                    Found in lib/tools/interactive_key.rb - About 2 hrs to fix

                      Function useStore has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const useStore = () => {
                        const actions = {
                          requestTopics: async () => {
                            state.isLoading = true
                      
                      
                      Severity: Major
                      Found in app/javascript/vue/tasks/content/publisher/composables/useStore.js - About 2 hrs to fix

                        Class ImagesController has 24 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class ImagesController < ApplicationController
                          include DataControllerConfiguration::ProjectDataControllerConfiguration
                          after_action -> { set_pagination_headers(:images) }, only: [:index, :api_index, :api_image_inventory], if: :json_request?
                        
                          before_action :set_image, only: [:show, :edit, :update, :destroy, :rotate, :regenerate_derivative]
                        Severity: Minor
                        Found in app/controllers/images_controller.rb - About 2 hrs to fix

                          File taxon_names_controller.rb has 276 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], if: :json_request?
                          Severity: Minor
                          Found in app/controllers/taxon_names_controller.rb - About 2 hrs to fix

                            Method add_original_combination has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def self.add_original_combination(t, csv, origin_citation, name_remarks_vocab_id, project_members)
                                e = t.original_combination_elements
                            
                                infraspecific_element = t.original_combination_infraspecific_element(e, remove_sic: true)
                            
                            
                            Severity: Major
                            Found in lib/export/coldp/files/name.rb - About 2 hrs to fix

                              Function default has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export default function (state, observation) {
                                if (!observation.type) { throw `Observations must have a type!` }
                              
                                if (Object.keys(ObservationTypes).findIndex(typeKey => ObservationTypes[typeKey] === observation.type) === -1) { throw `Observations must have a valid type! Given ${observation.type}` }
                              
                              

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

                                def is_in_use?(exclude = [], only = [])
                                  if only.empty?
                                    self.class.reflect_on_all_associations(:has_many).each do |r|
                                      next if exclude.include?(r.name)
                                      return true if self.send(r.name).count(:all) > 0
                              Severity: Minor
                              Found in app/models/concerns/shared/is_data.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

                              Method make_lat_long_matching_table has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def make_lat_long_matching_table(*pieces, collection)
                                  columns = ['CEID', 'Match', 'Verbatim Lat', 'Verbatim Long',
                                             'Decimal lat', 'Decimal long', 'Is georeferenced?', 'Select']
                              
                                  thead = content_tag(:thead) do
                              Severity: Minor
                              Found in app/helpers/tasks/collecting_events/parse/stepwise/lat_long_helper.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