app/helpers/cached_maps_helper.rb
Method has too many lines. [32/25] Open
Open
def cached_map_sync_metadata(cached_map)
return {} unless cached_map.present?
o = Otu.find(cached_map.otu_id)
- Read upRead up
- Exclude checks
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
Open
def cached_map_sync_metadata(cached_map)
return {} unless cached_map.present?
o = Otu.find(cached_map.otu_id)
Use if cached_map.blank?
instead of unless cached_map.present?
. Open
Open
return {} unless cached_map.present?
- Read upRead up
- Exclude checks
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
Open
unregistered_georeferences: g.where.missing(:cached_map_register).count, # TODO: needs helper method scoping to MapType when > type added
- Exclude checks
TODO found Open
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!
- Exclude checks