SpeciesFileGroup/taxonworks

View on GitHub

Showing 740 of 12,620 total issues

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

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

    def otu(columns)
      r = BatchLoad::ColumnResolver::Result.new

      if columns['otu_id']
        begin
Severity: Minor
Found in lib/batch_load/column_resolver.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 autocomplete has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def autocomplete
        return [] if query_string.blank? || project_id.empty?

        queries = [
          [ autocomplete_exact_id, false ],
Severity: Minor
Found in lib/queries/person/autocomplete.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 build_asserted_distributions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def build_asserted_distributions
      i = 1
      csv.each do |row|
        i += 1

Severity: Minor
Found in lib/batch_load/import/asserted_distributions.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 build_sequences has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def build_sequences
      @total_data_lines = 0;

      sequences = {}
      sequence_values = {}
Severity: Major
Found in lib/batch_load/import/sequences/primers_interpreter.rb - About 2 hrs to fix

    Method generate has 64 lines of code (exceeds 25 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: Major
    Found in lib/export/coldp/files/taxon.rb - About 2 hrs to fix

      File draw.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * extended library to construct drawable Google map instances
       */
      var TW = TW || {};                      // TW "namespacing" object
      TW.vendor = TW.vendor || {};            // mimic directory structure in app/assets/javascripts
      Severity: Minor
      Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 2 hrs to fix

        Class DataAttributesController has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class DataAttributesController < ApplicationController
          include DataControllerConfiguration::ProjectDataControllerConfiguration
        
          before_action :set_data_attribute, only: [:update, :destroy, :api_show]
          after_action -> { set_pagination_headers(:data_attributes) }, only: [:index, :api_index ], if: :json_request?
        Severity: Minor
        Found in app/controllers/data_attributes_controller.rb - About 2 hrs to fix

          Function default has a Cognitive Complexity of 18 (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

          Function initializeDrawingManager has a Cognitive Complexity of 18 (exceeds 5 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: Minor
          Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - 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 sv_single_sub_taxon has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def sv_single_sub_taxon
                if self.rank_class
                  rank = rank_string
                  if rank != 'potentially_validating rank' && self.rank_class.nomenclatural_code == :iczn && %w(subspecies subgenus subtribe tribe subfamily).include?(self.rank_class.rank_name)
                    sisters = self.parent.descendants.with_rank_class(rank).select{|t| t.id == t.cached_valid_taxon_name_id}
          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

          Method sv_species_gender_agreement_not_required has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def sv_species_gender_agreement_not_required
                if is_species_rank? && ((!feminine_name.blank? || !masculine_name.blank? || !neuter_name.blank?)) && is_available?
                  s = part_of_speech_name
                  if !s.nil? && !%w{adjective participle}.include?(s)
                    soft_validations.add(:feminine_name, 'Alternative spelling is not required for the name which is not adjective or participle.') unless feminine_name.blank?
          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

          Method sources_autocomplete_tag has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

            def sources_autocomplete_tag(source, term)
              return nil if source.nil?
          
              if term
                s = regex_mark_tag(source.cached, term) + ' '
          Severity: Minor
          Found in app/helpers/sources_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

          Method geographic_area has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def geographic_area(columns, data_origin = nil)
                r = BatchLoad::ColumnResolver::Result.new
          
                if columns['geographic_area_id']
                  begin
          Severity: Minor
          Found in lib/batch_load/column_resolver.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 create has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def create
                sorted_processed_rows.each_value do |processed_row|
                  otu = processed_row.objects[:otu].first
                  d_a = processed_row.objects[:data_attribute].first
                  cvt = processed_row.objects[:predicate].first
          Severity: Minor
          Found in lib/batch_load/import/otus/data_attributes_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 data_for has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.data_for(collection_object)
              o = collection_object
              data = Catalog::CollectionObject::Entry.new(o)
          
              data.items << Catalog::CollectionObject::EntryItem.new(type: :collected_on, object: o.collecting_event, start_date: o.collecting_event.start_date, end_date: o.collecting_event.end_date) if o.collecting_event_id.present?
          Severity: Minor
          Found in lib/catalog/collection_object.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 get_bibtex_string has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.get_bibtex_string(citation, format = 'bibtex')
                begin
                  # Convert citation to DOI if it isn't already
                  if !citation_is_valid_doi?(citation)
                    # First item should be the one with highest score/relevance: https://github.com/CrossRef/rest-api-doc#sort-order
          Severity: Minor
          Found in lib/vendor/serrano.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 using_isbn_class has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def using_isbn_class
              unless identifier.nil?
                isbn = identifier.upcase
                # 'ISBN-13: 978-0-596-52068-7'
                isbn.gsub!('ISBN-10', '')
          Severity: Major
          Found in app/models/identifier/global/isbn.rb - About 2 hrs to fix

            Method all_sub_headers has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def all_sub_headers(filtered = false)
                unless filtered
                  ce_headers # generate the header structure (see CollectionObject.selected_column_names)
                  co_headers
                  bc_headers
            Severity: Major
            Found in app/helpers/tasks/gis/report_helper.rb - About 2 hrs to fix

              Method taxonworks_extension_data has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def taxonworks_extension_data
                    return @taxonworks_extension_data if @taxonworks_extension_data
              
                    # hash of internal method name => csv header name
                    methods = {}
              Severity: Major
              Found in lib/export/dwca/data.rb - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language