Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint/SafeNavigationChain should allow presence_in (ActiveSupport) method #1031

Closed
swordray opened this issue Jun 19, 2023 · 0 comments · Fixed by #1069
Closed

Lint/SafeNavigationChain should allow presence_in (ActiveSupport) method #1031

swordray opened this issue Jun 19, 2023 · 0 comments · Fixed by #1069
Labels
enhancement New feature or request

Comments

@swordray
Copy link

Is your feature request related to a problem? Please describe.

If ActiveSupport is required, the .presence_in method should be permitted in a safe-navigation chain:

foo&.to_sym.presence_in([:bar, :baz])

Currently this raises the error: Lint/SafeNavigationChain: Do not chain ordinary method call after safe navigation operator.

Additional context

Rubocop 1.52.1

@swordray swordray changed the title Lint/SafeNavigationChain should allow presence_in (ActiveSupport) method Lint/SafeNavigationChain should allow presence_in (ActiveSupport) method Jun 19, 2023
@koic koic transferred this issue from rubocop/rubocop Jun 19, 2023
@koic koic added the enhancement New feature or request label Aug 15, 2023
koic added a commit to koic/rubocop-rails that referenced this issue Aug 15, 2023
Fixes rubocop#1031.

This PR makes `Lint/SafeNavigationChain` allowe `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
koic added a commit to koic/rubocop-rails that referenced this issue Aug 15, 2023
Fixes rubocop#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
koic added a commit that referenced this issue Aug 18, 2023
…low_presence_in

[Fix #1031] Make `Lint/SafeNavigationChain` allow `presence_in`
koic added a commit to koic/rubocop-rails that referenced this issue Aug 22, 2023
Fixes rubocop#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants