SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,919 of 12,919 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

Object.assign(TW.views.filter.area_picker, {

  initialize_area_picker: function (form, area_type) {
    this.initialize_autocomplete(form);
    this.bind_remove_links(form.find('.remove_area'));
Severity: Major
Found in app/assets/javascripts/views/filter/_area_picker.js and 1 other location - About 6 days to fix
app/assets/javascripts/views/filter/author_picker.js on lines 6..112

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 1030.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

Object.assign(TW.views.filter.author_picker, {

  initialize_author_picker: function (form, author_type) {
    this.initialize_autocomplete(form);
    this.bind_remove_links(form.find('.remove_author'));
Severity: Major
Found in app/assets/javascripts/views/filter/author_picker.js and 1 other location - About 6 days to fix
app/assets/javascripts/views/filter/_area_picker.js on lines 6..112

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 1030.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File csl_styles.rb has 2014 lines of code (exceeds 250 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

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/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",
"http://www.zotero.org/styles/acta-orthopaedica-belgica" => "Acta Orthopædica Belgica",
Severity: Major
Found in config/initializers/constants/_controlled_vocabularies/csl_styles.rb - About 5 days to fix

    Method useful_descriptors has a Cognitive Complexity of 207 (exceeds 5 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

      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/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

    Method has too many lines. [273/25]
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

          def handle_species_lepindex
            # VIADOCS.txt
            #
            # TaxonNo
            # SCIENTIFIC_NAME_on_card

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method merge_with has a Cognitive Complexity of 153 (exceeds 5 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

      def merge_with(person_id)
        return false if person_id == id
    
        if r_person = Person.find(person_id) # get the person to merge to into self
          begin
    Severity: Minor
    Found in app/models/person.rb - About 3 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

    Method has too many lines. [195/25]
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

          def handle_taxon_name_relationships_3i
            path = @args[:data_directory] + 'taxon.txt'
            print "\nHandling taxon name relationships\n"
            raise "file #{path} not found" if not File.exists?(path)
            file = CSV.foreach(path, col_sep: "\t", headers: true)
    Severity: Minor
    Found in lib/tasks/import/3i/3i.rake by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [195/25]
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

          def handle_taxon_name_relationships_3iCurculionidae
            path = @args[:data_directory] + 'taxon.txt'
            print "\nHandling taxon name relationships\n"
            raise "file #{path} not found" if not File.exists?(path)
            file = CSV.foreach(path, col_sep: "\t", headers: true)

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    File taxon_name.rb has 1015 lines of code (exceeds 250 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

    require_dependency Rails.root.to_s + '/app/models/taxon_name_classification.rb'
    require_dependency Rails.root.to_s + '/app/models/taxon_name_relationship.rb'
    
    # A taxonomic name (nomenclature only). See also NOMEN.
    #
    Severity: Major
    Found in app/models/taxon_name.rb - About 2 days to fix

      Class TaxonName has 127 methods (exceeds 20 allowed). Consider refactoring.
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

      class TaxonName < ApplicationRecord
      
        # @return class
        #   this method calls Module#module_parent
        # TODO: This method can be placed elsewhere inside this class (or even removed if not used)
      Severity: Major
      Found in app/models/taxon_name.rb - About 2 days to fix

        File soft_validation_extensions.rb has 981 lines of code (exceeds 250 allowed). Consider refactoring.
        Open
        • Open
        • Confirmed
        • Invalid
        • Wontfix
        Cancel

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

          Method has too many lines. [168/25]
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

                  def invalid_relationship_remove_sf(project_id)
          
                    fixed = 0
                    combinations = 0
                    i = 0

          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

          Method build_dwca has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

              def build_dwca
                line_counter = 1 # accounting for headers
          
                tasks = triage(csv.headers, tasks_)
                csv.each do |row|
          Severity: Minor
          Found in lib/batch_load/import/dwca.rb - About 2 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

          Method has too many lines. [165/25]
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

                def handle_taxonomy_3iCurculionidae
          
                  handle_nouns_3iCurculionidae
          
                  # Key !

          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

          Method has too many lines. [164/25]
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

            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/interactive_key.rb by rubocop

          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

          Method has too many lines. [161/25]
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

                def handle_taxonomy_3i
          
                  handle_nouns_3i
          
                  # Key !
          Severity: Minor
          Found in lib/tasks/import/3i/3i.rake by rubocop

          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

          Method has too many lines. [148/25]
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

            def merge_with(person_id)
              return false if person_id == id
          
              if r_person = Person.find(person_id) # get the person to merge to into self
                begin
          Severity: Minor
          Found in app/models/person.rb by rubocop

          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

          Method has too many lines. [140/25]
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

                def handle_controlled_vocabulary_3i
                  print "\nHandling CV \n"
          
                  @accession_namespace = Namespace.create(institution: '3i Auchenorrhyncha', name: 'Accession Code', short_name: 'Accession Code')
          
          
          Severity: Minor
          Found in lib/tasks/import/3i/3i.rake by rubocop

          This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

          File geographic_item.rb has 768 lines of code (exceeds 250 allowed). Consider refactoring.
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

          require 'rgeo'
          
          # A GeographicItem is one and only one of [point, line_string, polygon, multi_point, multi_line_string,
          # multi_polygon, geometry_collection] which describes a position, path, or area on the globe, generally associated
          # with a geographic_area (through a geographic_area_geographic_item entry), and sometimes only with a georeference.
          Severity: Major
          Found in app/models/geographic_item.rb - About 1 day to fix

            File dates.rb has 761 lines of code (exceeds 250 allowed). Consider refactoring.
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            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 has too many lines. [129/25]
              Open
              • Open
              • Confirmed
              • Invalid
              • Wontfix
              Cancel

                    def find_or_create_collecting_event_insects(ce, data)
                      tmp_ce = { }
                      LOCALITY_COLUMNS.each do |c|
                        tmp_ce[c] = ce[c] unless ce[c].blank?
                      end

              This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

              Class GeographicItem has 90 methods (exceeds 20 allowed). Consider refactoring.
              Open
              • Open
              • Confirmed
              • Invalid
              • Wontfix
              Cancel

              class GeographicItem < ApplicationRecord
                include Housekeeping::Users
                include Housekeeping::Timestamps
                include Shared::IsData
                include Shared::SharedAcrossProjects
              Severity: Major
              Found in app/models/geographic_item.rb - About 1 day to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open
                • Open
                • Confirmed
                • Invalid
                • Wontfix
                Cancel

                const GetterFunctions = {
                  [GetterNames.ActiveModalStatus]: activeModalStatus,
                  [GetterNames.ActiveModalType]: activeModalType,
                  [GetterNames.ActiveModalRelationship]: activeModalRelationship,
                  [GetterNames.GetAllRanks]: getAllRanks,
                app/javascript/vue/tasks/digitize/store/actions/actions.js on lines 37..71

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 305.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open
                • Open
                • Confirmed
                • Invalid
                • Wontfix
                Cancel

                const ActionFunctions = {
                  [ActionNames.AddToContainer]: addToContainer,
                  [ActionNames.LoadDigitalization]: loadDigitalization,
                  [ActionNames.LoadContainer]: loadContainer,
                  [ActionNames.GetTaxon]: getTaxon,
                Severity: Major
                Found in app/javascript/vue/tasks/digitize/store/actions/actions.js and 1 other location - About 1 day to fix
                app/javascript/vue/tasks/nomenclature/new_taxon_name/store/getters/getters.js on lines 71..105

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 305.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method sv_potential_species_homonyms has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
                Open
                • Open
                • Confirmed
                • Invalid
                • Wontfix
                Cancel

                    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 protonym.rb has 705 lines of code (exceeds 250 allowed). Consider refactoring.
                Open
                • Open
                • Confirmed
                • Invalid
                • Wontfix
                Cancel

                require_dependency Rails.root.to_s + '/app/models/taxon_name_relationship.rb'
                #
                # Force the loading of TaxonNameRelationships in all worlds.  This allows us to edit without restarting in development.
                # Dir[Rails.root.to_s + '/app/models/taxon_name_relationship/**/*.rb'].sort.each {|file| require_dependency file }
                #
                Severity: Major
                Found in app/models/protonym.rb - About 1 day to fix

                  Method has too many lines. [116/25]
                  Open
                  • Open
                  • Confirmed
                  • Invalid
                  • Wontfix
                  Cancel

                          def read_shape(filename, index)
                            # TODO: For some reason, Gis::FACTORY does not seem to be the default factory, so we are being specific here, to get the lenient polygon tests.  This gets us past the problem polygons, but does not actually deal with the problem.
                            # See http://dazuma.github.io/rgeo-shapefile/rdoc/RGeo/Shapefile/Reader.html for reader options.
                  
                            # ne10 = RGeo::Shapefile::Reader.open('G:\Share\Downloads\PostgreSQL\PostGIS\10m_cultural\10m_cultural\ne_10m_admin_0_countries.shp', factory: Gis::FACTORY)

                  This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                  Class CollectingEvent has 79 methods (exceeds 20 allowed). Consider refactoring.
                  Open
                  • Open
                  • Confirmed
                  • Invalid
                  • Wontfix
                  Cancel

                  class CollectingEvent < ApplicationRecord
                    include Housekeeping
                    include Shared::Citations
                    include Shared::DataAttributes
                    include Shared::HasRoles
                  Severity: Major
                  Found in app/models/collecting_event.rb - About 1 day to fix

                    File collecting_event.rb has 657 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open
                    • Open
                    • Confirmed
                    • Invalid
                    • Wontfix
                    Cancel

                    class CollectingEvent < ApplicationRecord
                      include Housekeeping
                      include Shared::Citations
                      include Shared::DataAttributes
                      include Shared::HasRoles
                    Severity: Major
                    Found in app/models/collecting_event.rb - About 1 day to fix

                      Method has too many lines. [111/25]
                      Open
                      • Open
                      • Confirmed
                      • Invalid
                      • Wontfix
                      Cancel

                            def handle_controlled_vocabulary_3iCurculionidae
                              print "\nHandling CV \n"
                      
                              @accession_namespace = Namespace.create(institution: '3i Curculionidae', name: 'Accession Code', short_name: 'Accession Code')
                      
                      

                      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                      Method has too many lines. [107/25]
                      Open
                      • Open
                      • Confirmed
                      • Invalid
                      • Wontfix
                      Cancel

                            def index_specimen_records_from_specimens_insects_new(data, import)
                              build_partially_resolved_index(data)
                              index_host_plants_insects(data)
                      
                              start = @redis.keys.count

                      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                      Method has too many lines. [107/25]
                      Open
                      • Open
                      • Confirmed
                      • Invalid
                      • Wontfix
                      Cancel

                          def self.coordinates_regex_from_verbatim_label(text)
                            return nil if text.blank?
                            text = ' ' + text + ' '
                            text.gsub("''", '"')
                                .gsub("´´", '"')
                      Severity: Minor
                      Found in lib/utilities/geo.rb by rubocop

                      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                      File dwca.rb has 632 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open
                      • Open
                      • Confirmed
                      • Invalid
                      • Wontfix
                      Cancel

                      module BatchLoad
                        # TODO: Originally transliterated from Import::CollectingEvents: Remove this to-do after successful operation.
                        class Import::DWCA < BatchLoad::Import
                      
                          attr_accessor :collecting_events
                      Severity: Major
                      Found in lib/batch_load/import/dwca.rb - About 1 day to fix

                        Method has too many lines. [105/25]
                        Open
                        • Open
                        • Confirmed
                        • Invalid
                        • Wontfix
                        Cancel

                              def handle_list_of_species_odonata
                                # Author
                                ## Genus_Species
                                # Genus
                                # Species

                        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                        Method remaining_taxa has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                        Open
                        • Open
                        • Confirmed
                        • Invalid
                        • Wontfix
                        Cancel

                          def remaining_taxa
                            #    @error_tolerance  - integer
                            #    @eliminate_unknown  'true' or 'false'
                            #    @descriptors_hash
                        
                        
                        Severity: Minor
                        Found in lib/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

                        Method date_regex_from_verbatim_label has 261 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open
                        • Open
                        • Confirmed
                        • Invalid
                        • Wontfix
                        Cancel

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

                          Method generate has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
                          Open
                          • Open
                          • Confirmed
                          • Invalid
                          • Wontfix
                          Cancel

                            def self.generate(otu, reference_csv = nil)
                              CSV.generate(col_sep: "\t") do |csv|
                                csv << %w{
                                  ID
                                  basionymID
                          Severity: Minor
                          Found in lib/export/coldp/files/name.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

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open
                          • Open
                          • Confirmed
                          • Invalid
                          • Wontfix
                          Cancel

                          const VueComponents = {
                            [ComponentVerbatim.Collectors]: Collectors,
                            [ComponentVerbatim.DateComponent]: DateComponent,
                            [ComponentVerbatim.Geolocation]: Geolocation,
                            [ComponentVerbatim.Collectors]: Collectors,
                          app/javascript/vue/tasks/nomenclature/new_taxon_name/store/actions/actions.js on lines 55..81

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 233.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open
                          • Open
                          • Confirmed
                          • Invalid
                          • Wontfix
                          Cancel

                          const ActionFunctions = {
                            [ActionNames.LoadSoftValidation]: loadSoftValidation,
                            [ActionNames.LoadTaxonName]: loadTaxonName,
                            [ActionNames.LoadRanks]: loadRanks,
                            [ActionNames.LoadStatus]: loadStatus,
                          app/javascript/vue/tasks/collecting_events/new_collecting_event/const/components.js on lines 60..86

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 233.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Function init has 234 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open
                          • Open
                          • Confirmed
                          • Invalid
                          • Wontfix
                          Cancel

                            init: function () {
                              var soft_validations = undefined;
                              function fillSoftValidation() {
                                if (soft_validations == undefined) {
                                  if ($('[data-global-id]').length) {
                          Severity: Major
                          Found in app/assets/javascripts/views/tasks/nomenclature/browse.js - About 1 day to fix

                            Method has too many lines. [90/25]
                            Open
                            • Open
                            • Confirmed
                            • Invalid
                            • Wontfix
                            Cancel

                                  def handle_controlled_vocabulary_insects(data, import)
                                    print 'Handling CV '
                                    if import.metadata['controlled_vocabulary']
                                      print "from database.\n"
                                      Predicate.all.each do |cv|

                            This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                            File data.rb has 544 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open
                            • Open
                            • Confirmed
                            • Invalid
                            • Wontfix
                            Cancel

                            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

                              Class has too many lines. [1012/1000]
                              Open
                              • Open
                              • Confirmed
                              • Invalid
                              • Wontfix
                              Cancel

                              class TaxonName < ApplicationRecord
                              
                                # @return class
                                #   this method calls Module#module_parent
                                # TODO: This method can be placed elsewhere inside this class (or even removed if not used)
                              Severity: Minor
                              Found in app/models/taxon_name.rb by rubocop

                              This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                              File bibtex.rb has 541 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open
                              • Open
                              • Confirmed
                              • Invalid
                              • Wontfix
                              Cancel

                              require 'citeproc'
                              require 'csl/styles'
                              require 'namecase'
                              
                              # Bibtex - Subclass of Source that represents most references.
                              Severity: Major
                              Found in app/models/source/bibtex.rb - About 1 day to fix

                                Method has too many lines. [86/25]
                                Open
                                • Open
                                • Confirmed
                                • Invalid
                                • Wontfix
                                Cancel

                                      def handle_references_3i
                                
                                        # Key3
                                        # AY
                                        # Author
                                Severity: Minor
                                Found in lib/tasks/import/3i/3i.rake by rubocop

                                This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                                Method has too many lines. [86/25]
                                Open
                                • Open
                                • Confirmed
                                • Invalid
                                • Wontfix
                                Cancel

                                      def find_or_create_collecting_event_3iCurculionidae(ce)
                                        tmp_ce = { }
                                        @locality_columns_3iCurculionidae.each do |c|
                                          tmp_ce[c] = ce[c] unless ce[c].blank?
                                        end

                                This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                                Method has too many lines. [85/25]
                                Open
                                • Open
                                • Confirmed
                                • Invalid
                                • Wontfix
                                Cancel

                                      def handle_trivellone_insect_phytoplasma_3i
                                        # PK_InsecPhyt
                                        # FK_Phy
                                        # FK_reference
                                        # superfamily
                                Severity: Minor
                                Found in lib/tasks/import/3i/3i.rake by rubocop

                                This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                                Method has too many lines. [85/25]
                                Open
                                • Open
                                • Confirmed
                                • Invalid
                                • Wontfix
                                Cancel

                                      def handle_trivellone_insect_phytoplasma_3iCurculionidae
                                        # PK_InsecPhyt
                                        # FK_Phy
                                        # FK_reference
                                        # superfamily

                                This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                                Class Protonym has 59 methods (exceeds 20 allowed). Consider refactoring.
                                Open
                                • Open
                                • Confirmed
                                • Invalid
                                • Wontfix
                                Cancel

                                class Protonym < TaxonName
                                
                                  extend Protonym::SoftValidationExtensions::Klass
                                  include Protonym::SoftValidationExtensions::Instance
                                  include Protonym::Becomes
                                Severity: Major
                                Found in app/models/protonym.rb - About 1 day to fix

                                  Method has too many lines. [83/25]
                                  Open
                                  • Open
                                  • Confirmed
                                  • Invalid
                                  • Wontfix
                                  Cancel

                                        def handle_references_3iCurculionidae
                                  
                                          # Key3
                                          # AY
                                          # Author

                                  This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

                                  Severity
                                  Category