SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,624 of 12,624 total issues

Method create has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def create
      @create_attempted = true

      if ready_to_create?
        # TODO: DRY
Severity: Minor
Found in lib/batch_load/import.rb - About 3 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 significant_digits has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def self.significant_digits(number_string)
      # is there a decimal point?
      intg = ''
      decimal_point_zeros = ''
      mantissa = ''
Severity: Minor
Found in lib/utilities/geo.rb - About 3 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 descriptors_hash_initiate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def descriptors_hash_initiate
    h = {}

    descriptors_with_keywords.each do |d|
      h[d.id] = {}
Severity: Minor
Found in lib/tools/interactive_key.rb - About 3 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 has too many lines. [44/25]
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 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.

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

    class Filter < Query::Filter

      # Params exists for all CollectingEvent attributes except these.
      # geographic_area_id is excluded because we handle it specially in conjunction with `geographic_area_mode``
      # Definition must preceed include.
Severity: Minor
Found in lib/queries/collecting_event/filter.rb - About 3 hrs to fix

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

      class Result
        SMALL_WIDTH = 100
        LARGE_WIDTH = 400
    
        TEXT_MAP = {
    Severity: Minor
    Found in lib/vendor/sqed_to_taxonworks.rb - About 3 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          if ((string.indexOf(",") > 1) || (string.indexOf(" ") > 1)) {
            var delimiter;
            if (string.indexOf(",") > 1) {
              delimiter = ","
            }
      Severity: Major
      Found in app/assets/javascripts/views/people/_role_picker.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/views/people/_role_picker.js on lines 30..44

      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 111.

      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

          if ((string.indexOf(",") > 1) || (string.indexOf(" ") > 1)) {
            var delimiter;
            if (string.indexOf(",") > 1) {
              delimiter = ","
            }
      Severity: Major
      Found in app/assets/javascripts/views/people/_role_picker.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/views/people/_role_picker.js on lines 50..64

      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 111.

      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

        def matching_protocol_id_and
          return nil if protocol_id_and.empty?
          l = table.name
          k = l.classify.safe_constantize
          t = ::ProtocolRelationship.arel_table
      Severity: Major
      Found in lib/queries/concerns/protocols.rb and 1 other location - About 3 hrs to fix
      lib/queries/concerns/tags.rb on lines 113..144

      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 131.

      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

        def matching_keyword_id_and
          return nil if keyword_id_and.empty?
          l = table.name
          k = l.classify.safe_constantize
          t = ::Tag.arel_table
      Severity: Major
      Found in lib/queries/concerns/tags.rb and 1 other location - About 3 hrs to fix
      lib/queries/concerns/protocols.rb on lines 106..137

      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 131.

      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 has too many lines. [43/25]
      Open

          def citations_with_names
            return @citations_with_names if !@citations_with_names.nil?
      
            d = Hash.new do |hash, key|
              hash[key] = []
      Severity: Minor
      Found in lib/catalog/nomenclature/entry.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. [43/25]
      Open

        def self.date_sql_from_params(params)
          st_date, end_date = params['st_datepicker'], params['en_datepicker']
          # processing start date data
          st_year, st_month, st_day = params['start_date_year'], params['start_date_month'], params['start_date_day']
          unless st_date.blank?
      Severity: Minor
      Found in lib/utilities/dates.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 conform_significant has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.conform_significant(number, sig_digits)
            input = significant_digits(number.to_s)
            input_string = input[0]
            intg = input[2]
            decimal_point = input[3]
      Severity: Minor
      Found in lib/utilities/geo.rb - About 3 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 to_s_verbose has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def to_s_verbose
          d = data
          str = ''
      
          d.keys.sort{|a,b| (a || 'zzz') <=> (b || 'zzz')}.each do |c|
      Severity: Minor
      Found in lib/catalog/distribution/entry.rb - About 3 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 date_sql_from_params has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.date_sql_from_params(params)
          st_date, end_date = params['st_datepicker'], params['en_datepicker']
          # processing start date data
          st_year, st_month, st_day = params['start_date_year'], params['start_date_month'], params['start_date_day']
          unless st_date.blank?
      Severity: Minor
      Found in lib/utilities/dates.rb - About 3 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        make_tag_list_sortable: function (form) {
          var list_items = form.find(".tag_list");
          list_items.sortable({
            change: function (event, ui) {
              if ($('form[id^="new_"]').length == 0) {
      Severity: Major
      Found in app/assets/javascripts/views/tags/tag_picker.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/views/people/_role_picker.js on lines 253..263

      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 110.

      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

        make_role_list_sortable: function (form) {
          var list_items = form.find('.role_list');
          list_items.sortable({
            change: function (event, ui) {
              if ($('form[id^="new_"]').length == 0) {
      Severity: Major
      Found in app/assets/javascripts/views/people/_role_picker.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/views/tags/tag_picker.js on lines 74..84

      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 110.

      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 has too many lines. [42/25]
      Open

        def becomes_combination
          a, original_relationships, c = nil, nil, nil
      
          if b = convertable_to_combination?
            a, original_relationships = b
      Severity: Minor
      Found in app/models/protonym/becomes.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. [42/25]
      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

      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. [42/25]
      Open

        def save_selected
          next_id = next_collecting_event_id
          selected = params[:selected]
          if selected.blank?
            message = 'Nothing to save.'

      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
      Status
      Source
      Language