SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,628 of 12,628 total issues

Consider simplifying this complex logical expression.
Open

      if domain.nil? or part_1.nil? or part_2.nil? or part_3.nil? or part_4.nil? or last.nil?
        errors.add(:identifier, "'#{identifier}' is an improperly formed ORCID ID.")
        return
      end
Severity: Major
Found in app/models/identifier/global/orcid.rb - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

          if (rank =~ /Family/ && prank =~ /Family/) || (rank =~ /Genus/ && prank =~ /Genus/) || (rank =~ /Species/ && prank =~ /Species/)
            begin
              Protonym.transaction do
                if rank =~ /Family/ && prank =~ /Family/
                  name = Protonym.family_group_base(self.parent.name)
    Severity: Major
    Found in app/models/protonym/soft_validation_extensions.rb - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

            return false unless @project_id && @user && @file && csv && errors.empty? && file_errors.empty?
      Severity: Major
      Found in lib/batch_load/import.rb - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

              if (row_id_filter_array.nil? && otu_id_filter_array.nil?) ||
                  (row_id_filter_array && row_id_filter_array.include?(r_value[:object].id)) ||
                  (otu_id_filter_array && otu_id_filter_array.include?(r_value[:otu_id]))
                h[r_key] = {object: r_value[:object_at_rank],
                            row_id: r_value[:object].id,
        Severity: Major
        Found in lib/tools/image_matrix.rb - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                if ((st_y or st_my) and (end_y or end_my)) and not (st_y and end_y)
                  # we have two dates of some kind, complete with years
                  # three specific cases:
                  #   case 1: start year, (start month, (start day)) forward
                  #   case 2: end year, (end month, (end day)) backward
          Severity: Major
          Found in lib/utilities/dates.rb - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                          p = true if (d_min >= s_min && d_min <= s_max) || (d_max >= s_min && d_max <= s_max) || (d_min <= s_min && d_max >= s_max)
            Severity: Major
            Found in lib/tools/interactive_key.rb - About 40 mins to fix

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

                def make_selected_method_boxes(filters = Utilities::Geo::REGEXP_COORD.keys)
                  list    = Utilities::Geo::REGEXP_COORD
                  box_row = ''
                  list.each_key { |kee|
                    checked = filters.include?(kee)
              app/helpers/tasks/collecting_events/parse/stepwise/dates_helper.rb on lines 19..26

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

              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 self.csv(scope)
                  tbl = []
                  tbl[0] = HEADERS
              
                  scope.find_each do |b|
              Severity: Minor
              Found in lib/export/csv/globi.rb and 1 other location - About 40 mins to fix
              lib/export/csv/dwc/extension/biological_associations.rb on lines 20..33

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

              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

                      coordinates[:lat_deg] = matchdata4[1]
                      coordinates[:lat_min] = matchdata4[2]
                      coordinates[:lat_ns]  = matchdata4[3]
                      coordinates[:long_deg] = matchdata4[4]
                      coordinates[:long_min] = matchdata4[5]
              Severity: Minor
              Found in lib/utilities/geo.rb and 1 other location - About 40 mins to fix
              lib/utilities/geo.rb on lines 659..664

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

              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 3 locations. Consider refactoring.
              Open

                    def collection_object_query_facet
                      return nil if collection_object_query.nil?
                      s = 'WITH query_co_ba AS (' + collection_object_query.all.to_sql + ') '
              
                      a = ::BiologicalAssociation
              Severity: Minor
              Found in lib/queries/biological_association/filter.rb and 2 other locations - About 40 mins to fix
              lib/queries/biological_association/filter.rb on lines 642..653
              lib/queries/biological_association/filter.rb on lines 656..667

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

              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

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

                        TaxonNameRelationship::Combination.where(subject_taxon_name: t).collect{|i| i.object_taxon_name}.uniq.each do |t1|
                          t1.update_column(:verbatim_name, t1.cached) if t1.verbatim_name.nil?
                          n = t1.get_full_name
                          t1.update_columns(
                              cached: n,
              Severity: Minor
              Found in app/models/taxon_name_classification.rb and 1 other location - About 40 mins to fix
              app/models/taxon_name_classification.rb on lines 232..238

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

              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 parse_lat_long_skip(current_collecting_event_id, filters)
                  # TODO: Now this has to be bound to next hit
                  # filters = Utilities::Geo::REGEXP_COORD.keys
                  next_id = Queries::CollectingEventLatLongExtractorQuery.new(
                    collecting_event_id: current_collecting_event_id,
              app/helpers/tasks/collecting_events/parse/stepwise/dates_helper.rb on lines 113..123

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

              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 make_dates_selected_method_boxes(filters = Utilities::Dates::REGEXP_DATES.keys)
                  list = Utilities::Dates::REGEXP_DATES
                  box_row = ''
                  list.each_key { |kee|
                    checked = filters.include?(kee)
              app/helpers/tasks/collecting_events/parse/stepwise/lat_long_helper.rb on lines 20..27

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

              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 parse_date_skip(current_collecting_event_id, filters)
                  # TODO: Now this has to be bound to next hit
                  # filters = Utilities::Geo::REGEXP_COORD.keys
                  next_id = Queries::CollectingEventDatesExtractorQuery.new(
                      collecting_event_id: current_collecting_event_id,
              app/helpers/tasks/collecting_events/parse/stepwise/lat_long_helper.rb on lines 119..132

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

              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 3 locations. Consider refactoring.
              Open

                    def asserted_distribution_query_facet
                      return nil if asserted_distribution_query.nil?
                      s = 'WITH query_ad_ba AS (' + asserted_distribution_query.all.to_sql + ') '
              
                      a = ::BiologicalAssociation
              Severity: Minor
              Found in lib/queries/biological_association/filter.rb and 2 other locations - About 40 mins to fix
              lib/queries/biological_association/filter.rb on lines 642..653
              lib/queries/biological_association/filter.rb on lines 670..682

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

              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 ce.update({start_date_year: start_date[0],
                            start_date_month: start_date[1],
                            start_date_day: start_date[2],
                            end_date_year: end_date[0],
                            end_date_month: end_date[1],
              app/controllers/tasks/collecting_events/parse/stepwise/dates_controller.rb on lines 43..53

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

              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 tagged_collecting_events
                  message = ''
                  if params[:keyword_id].blank?
                    # Bad search request; return not a list but back to the form
                    @collecting_events = CollectingEvent.where('false')
              Severity: Minor
              Found in app/controllers/tasks/gis/match_georeference_controller.rb and 1 other location - About 40 mins to fix
              app/controllers/tasks/gis/match_georeference_controller.rb on lines 105..121

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

              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

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

                        TaxonNameRelationship::Combination.where(subject_taxon_name: t).collect{|i| i.object_taxon_name}.uniq.each do |t1|
                          t1.update_column(:verbatim_name, t1.cached) if t1.verbatim_name.nil?
                          n = t1.get_full_name
                          t1.update_columns(
                              cached: n,
              Severity: Minor
              Found in app/models/taxon_name_classification.rb and 1 other location - About 40 mins to fix
              app/models/taxon_name_classification.rb on lines 211..217

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

              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 3 locations. Consider refactoring.
              Open

                    def otu_query_facet
                      return nil if otu_query.nil?
                      s = 'WITH query_otu_ba AS (' + otu_query.all.to_sql + ') '
              
                      a = ::BiologicalAssociation
              Severity: Minor
              Found in lib/queries/biological_association/filter.rb and 2 other locations - About 40 mins to fix
              lib/queries/biological_association/filter.rb on lines 656..667
              lib/queries/biological_association/filter.rb on lines 670..682

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

              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 ce.update({start_date_year: start_date[0],
                      start_date_month: start_date[1],
                      start_date_day: start_date[2],
                      end_date_year: end_date[0],
                      end_date_month: end_date[1],
              app/controllers/tasks/collecting_events/parse/stepwise/dates_controller.rb on lines 87..97

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

              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

              Severity
              Category
              Status
              Source
              Language