Skip to content

Commit ee3554b

Browse files
committed
Fix a false positive for Lint/RedundantSafeNavigation
Follow up #1014. This commit fixes a false positive for `Lint/RedundantSafeNavigation` when using `blank?`: ```ruby nil.presence || 42 # => 42 nil&.presence || 42 # => 42 nil.present? || 42 # => 42 nil&.present? || 42 # => 42 nil.blank? || 42 # => true nil&.blank? || 4 2# => 42 ```
1 parent 0be0e41 commit ee3554b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* [#1014](https://github.com/rubocop/rubocop-rails/pull/1014): Make `Lint/RedundantSafeNavigation` aware of `blank?`, `presence`, and `present?` methods. ([@koic][])
1+
* [#1014](https://github.com/rubocop/rubocop-rails/pull/1014): Make `Lint/RedundantSafeNavigation` aware of `presence` and `present?` methods. ([@koic][])

config/default.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Lint/NumberConversion:
4949
AllowedPatterns: []
5050

5151
Lint/RedundantSafeNavigation:
52-
# Add `blank?`, `presence`, and `present?` methods to the default of the RuboCop core.
52+
# Add `presence` and `present?` methods to the default of the RuboCop core.
5353
# https://github.com/rubocop/rubocop/blob/v1.51.0/config/default.yml#L2148-L2159
5454
AllowedMethods:
5555
- instance_of?
@@ -58,7 +58,6 @@ Lint/RedundantSafeNavigation:
5858
- eql?
5959
- respond_to?
6060
- equal?
61-
- blank?
6261
- presence
6362
- present?
6463

0 commit comments

Comments
 (0)