-
-
Notifications
You must be signed in to change notification settings - Fork 279
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem?
While the cop catches instances where link_to
is used, it doesnt catch its sister implementations link_to_if
and link_to_unless
.
# Bad
link_to_if config.url.present?, config.url, config.url, target: '_blank'
# Good
link_to_if config.url.present?, config.url, config.url, target: '_blank', rel: 'noopener noreferrer'
Describe the solution you'd like
The same cop should catch link_to_if
s and link_to_unless
s matching the conditions
Describe alternatives you've considered
Implementing a separate cop of a configuration value for the given cop.
Additional context
There is also link_to_unless_current
which might be more difficult to implement a check against.
https://www.rubydoc.info/gems/rubocop-rails/RuboCop/Cop/Rails/LinkToBlank
https://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request