SpeciesFileGroup/taxonworks

View on GitHub
app/helpers/cached_maps_helper.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method has too many lines. [32/25]
Open

  def cached_map_sync_metadata(cached_map)
    return {} unless cached_map.present?


    o = Otu.find(cached_map.otu_id)
Severity: Minor
Found in app/helpers/cached_maps_helper.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 cached_map_sync_metadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def cached_map_sync_metadata(cached_map)
    return {} unless cached_map.present?


    o = Otu.find(cached_map.otu_id)
Severity: Minor
Found in app/helpers/cached_maps_helper.rb - About 1 hr to fix

    Use if cached_map.blank? instead of unless cached_map.present?.
    Open

        return {} unless cached_map.present?
    Severity: Minor
    Found in app/helpers/cached_maps_helper.rb by rubocop

    This cop checks for code that can be written with simpler conditionals using Object#blank? defined by Active Support.

    Interaction with Style/UnlessElse: The configuration of NotPresent will not produce an offense in the context of unless else if Style/UnlessElse is inabled. This is to prevent interference between the auto-correction of the two cops.

    Example: NilOrEmpty: true (default)

    # Converts usages of `nil? || empty?` to `blank?`
    
    # bad
    foo.nil? || foo.empty?
    foo == nil || foo.empty?
    
    # good
    foo.blank?

    Example: NotPresent: true (default)

    # Converts usages of `!present?` to `blank?`
    
    # bad
    !foo.present?
    
    # good
    foo.blank?

    Example: UnlessPresent: true (default)

    # Converts usages of `unless present?` to `if blank?`
    
    # bad
    something unless foo.present?
    
    # good
    something if foo.blank?
    
    # bad
    unless foo.present?
      something
    end
    
    # good
    if foo.blank?
      something
    end
    
    # good
    def blank?
      !present?
    end

    TODO found
    Open

          unregistered_georeferences: g.where.missing(:cached_map_register).count, # TODO: needs helper method scoping to MapType when > type added
    Severity: Minor
    Found in app/helpers/cached_maps_helper.rb by fixme

    TODO found
    Open

          unregistered_asserted_distributions: ads.all.where.missing(:cached_map_register).count, # TODO: see above. Note that these could be because they have no shape!
    Severity: Minor
    Found in app/helpers/cached_maps_helper.rb by fixme

    There are no issues that match your filters.

    Category
    Status