SpeciesFileGroup/taxonworks

View on GitHub
app/helpers/internal_attributes_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use name.presence || '' instead of name.present? ? name : ''.
Open

    "<b>#{name.present? ? name : ''}:</b>#{internal_attribute.value}"

This cop checks code that can be written more easily using Object#presence defined by Active Support.

Example:

# bad
a.present? ? a : nil

# bad
!a.present? ? nil : a

# bad
a.blank? ? nil : a

# bad
!a.blank? ? a : nil

# good
a.presence

Example:

# bad
a.present? ? a : b

# bad
!a.present? ? b : a

# bad
a.blank? ? b : a

# bad
!a.blank? ? a : b

# good
a.presence || b

There are no issues that match your filters.

Category
Status