From 0a1d922cc82f9774e79967752f8f01d0fa6d448b Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 15 Aug 2023 09:46:40 +0900 Subject: [PATCH] [Fix #1031] Make `Lint/SafeNavigationChain` allow `presence_in` Fixes #1031. This PR makes `Lint/SafeNavigationChain` allow `presence_in`. It adds `presence_in` method to the default of the RuboCop core: https://github.com/rubocop/rubocop/blob/v1.56.0/config/default.yml#L2265-L2271 --- ...e_lint_safe_navigation_chain_allow_presence_in.md | 1 + config/default.yml | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 changelog/change_make_lint_safe_navigation_chain_allow_presence_in.md diff --git a/changelog/change_make_lint_safe_navigation_chain_allow_presence_in.md b/changelog/change_make_lint_safe_navigation_chain_allow_presence_in.md new file mode 100644 index 0000000000..6296f73c7e --- /dev/null +++ b/changelog/change_make_lint_safe_navigation_chain_allow_presence_in.md @@ -0,0 +1 @@ +* [#1031](https://github.com/rubocop/rubocop-rails/pull/1031): Make `Lint/SafeNavigationChain` allow `presence_in`. ([@koic][]) diff --git a/config/default.yml b/config/default.yml index 704ba72ca2..6c4e7dcad1 100644 --- a/config/default.yml +++ b/config/default.yml @@ -61,6 +61,18 @@ Lint/RedundantSafeNavigation: - presence - present? +Lint/SafeNavigationChain: + # Add `presence_in` method to the default of the RuboCop core: + # https://github.com/rubocop/rubocop/blob/v1.56.0/config/default.yml#L2265-L2271 + AllowedMethods: + - present? + - blank? + - presence + - presence_in + - try + - try! + - in? + Rails: Enabled: true DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails