Skip to content

Commit 4052e55

Browse files
committed
Make Lint/RedundantSafeNavigation aware of several methods
This PR makes `Lint/RedundantSafeNavigation` aware of `blank?`, `presence`, and `present?` methods.
1 parent b70b1d8 commit 4052e55

File tree

2 files changed

+15
-0
lines changed

2 files changed

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

config/default.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ Lint/NumberConversion:
4848
- in_milliseconds
4949
AllowedPatterns: []
5050

51+
Lint/RedundantSafeNavigation:
52+
# Add `blank?`, `presence`, and `present?` methods to the default of the RuboCop core.
53+
# https://github.com/rubocop/rubocop/blob/v1.51.0/config/default.yml#L2148-L2159
54+
AllowedMethods:
55+
- instance_of?
56+
- kind_of?
57+
- is_a?
58+
- eql?
59+
- respond_to?
60+
- equal?
61+
- blank?
62+
- presence
63+
- present?
64+
5165
Rails:
5266
Enabled: true
5367
DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails

0 commit comments

Comments
 (0)