SpeciesFileGroup/taxonworks

View on GitHub

Showing 732 of 12,571 total issues

File csl_styles.rb has 2212 lines of code (exceeds 250 allowed). Consider refactoring.
Open

CSL_STYLES = {
"http://www.zotero.org/styles/vancouver-brackets-only-year-no-issue" => "Vancouver (brackets, only year in date, no issue numbers)",
"http://www.zotero.org/styles/physiologia-plantarum" => "Physiologia Plantarum",
"http://www.zotero.org/styles/orthopedic-clinics-of-north-america" => "Orthopedic Clinics of North America",
"http://www.zotero.org/styles/asa-cssa-sssa" => "American Society of Agronomy, Crop Science Society of America, Soil Science Society of America",
Severity: Major
Found in config/initializers/constants/_controlled_vocabularies/csl_styles.rb - About 6 days to fix

    Method useful_descriptors has a Cognitive Complexity of 197 (exceeds 5 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: Minor
    Found in lib/tools/interactive_key.rb - About 4 days 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 soft_validation_extensions.rb has 1461 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Protonym::SoftValidationExtensions
    
      module Klass
        VALIDATIONS = {
          sv_validate_name: {
    Severity: Major
    Found in app/models/protonym/soft_validation_extensions.rb - About 3 days to fix

      File dwcTerms.js has 997 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      export default [
        {
          name: 'type',
          qualName: 'http://purl.org/dc/terms/type',
          description: 'The nature or genre of the resource. For Darwin Core, recommended best practice is to use the name of the class that defines the root of the record.',
      Severity: Major
      Found in app/javascript/vue/tasks/dwca_import/const/dwcTerms.js - About 2 days to fix

        File dates.rb has 797 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Utilities::Dates
        
          EARLIEST_DATE = '1700/01/10'.freeze # Reconcile with in-app
        
          LONG_MONTHS = %w{january february march april may june july august september october november december}.freeze
        Severity: Major
        Found in lib/utilities/dates.rb - About 1 day to fix

          Method get_otu_contents has a Cognitive Complexity of 85 (exceeds 5 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: Minor
          Found in app/helpers/observation_matrices/export/otu_contents_helper.rb - About 1 day 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 337 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method sv_potential_species_homonyms has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
            Open

                def sv_potential_species_homonyms
                  if persisted? && is_species_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 1 day 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 data.rb has 678 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            concern :data_routes do |options|
              collection do
                get 'download'
                get 'list'
                post 'batch_create'
            Severity: Major
            Found in config/routes/data.rb - About 1 day to fix

              Method date_regex_from_verbatim_label has 266 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.date_regex_from_verbatim_label(text)
                  return nil if text.blank?
                  text = ' ' + text.downcase.squish + ' '
              
                  date = {}
              Severity: Major
              Found in lib/utilities/dates.rb - About 1 day to fix

                Method remaining_taxa has a Cognitive Complexity of 67 (exceeds 5 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: Minor
                Found in lib/tools/interactive_key.rb - About 1 day 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 init has 241 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  init: function () {
                    let softValidations
                
                    function fillSoftValidation() {
                      if (!softValidations) {
                Severity: Major
                Found in app/assets/javascripts/views/tasks/nomenclature/browse.js - About 1 day to fix

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

                  module Queries
                    module BiologicalAssociation
                  
                      class Filter < Query::Filter
                        include Queries::Concerns::Notes
                  Severity: Major
                  Found in lib/queries/biological_association/filter.rb - About 1 day to fix

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

                        class Filter < Query::Filter
                          include Queries::Concerns::Notes
                          include Queries::Concerns::Tags
                          include Queries::Concerns::Citations
                          include Queries::Concerns::Depictions
                    Severity: Major
                    Found in lib/queries/biological_association/filter.rb - About 1 day to fix

                      File tasks.rb has 554 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      scope :tasks do
                        scope :leads do
                          scope :hub, controller: 'tasks/leads/hub' do
                            get '/', action: :index, as: 'leads_hub_task'
                          end
                      Severity: Major
                      Found in config/routes/tasks.rb - About 1 day to fix

                        File geo.rb has 533 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module Utilities
                          # Special general routines for Geo-specific itams
                          module Geo
                        
                            # !!
                        Severity: Major
                        Found in lib/utilities/geo.rb - About 1 day to fix

                          Class TaxonNameRelationship has 60 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class TaxonNameRelationship < ApplicationRecord
                            include Housekeeping
                            include Shared::Citations
                            include Shared::Notes
                            include Shared::IsData
                          Severity: Major
                          Found in app/models/taxon_name_relationship.rb - About 1 day to fix

                            File taxon_name_relationship.rb has 504 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require_dependency Rails.root.to_s + '/app/models/taxon_name_classification.rb'
                            
                            # A NOMEN https://github.com/SpeciesFileGroup/nomen relationship between two Protonyms.
                            #
                            # Unless otherwise noted relationships read left to right, and can be interpreted by inserting "of" after the class name.
                            Severity: Major
                            Found in app/models/taxon_name_relationship.rb - About 1 day to fix

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

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

                                Method extract_dates has 180 lines of code (exceeds 25 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: Major
                                Found in lib/utilities/dates.rb - About 7 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language