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/RedundantSafeNavigation rule false positive for send method since 1.52.0 #11927

Closed
r-plus opened this issue Jun 5, 2023 · 3 comments
Closed

Comments

@r-plus
Copy link

r-plus commented Jun 5, 2023

Expected behavior

Lint/RedundantSafeNavigation rule will not offense for send method.

Actual behavior

offense nil&.send(:some_method) code.

Steps to reproduce the problem

test file

# frozen_string_literal: true

nil&.send(:some_method) || 0

rubocop will offense this code.

$ rubocop ./test.rb
Inspecting 1 file
W

Offenses:

test.rb:3:4: W: [Correctable] Lint/RedundantSafeNavigation: Redundant safe navigation detected.
nil&.send(:some_method) || 0
   ^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected, 1 offense autocorrectable

RuboCop version

$ rubocop -V
1.52.0 (using Parser 3.2.2.1, rubocop-ast 1.28.1, running on ruby 3.0.4) [arm64-darwin22]

v1.51.0 is not offense

$ rubocop -V
1.51.0 (using Parser 3.2.2.1, rubocop-ast 1.28.1, running on ruby 3.0.4) [arm64-darwin22]

$ rubocop ./test.rb
Inspecting 1 file
.

1 file inspected, no offenses detected
@koic
Copy link
Member

koic commented Jun 5, 2023

This issue is a dup and resolved by #11915.

@koic koic closed this as completed Jun 5, 2023
@r-plus
Copy link
Author

r-plus commented Jun 5, 2023

oh, Thanks for letting me know.

@koic koic pinned this issue Jun 5, 2023
@koic
Copy link
Member

koic commented Jun 5, 2023

@bbatsov #11918 has the same issue and is already resolved in #11915. Can you cut the bug fix release at your convenience? (Or I'll take)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants