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

Style/DoubleNegation allowed_in_returns doesn't take into account define_method and define_singleton_method #10586

Closed
dorianmariecom opened this issue Apr 28, 2022 · 0 comments · Fixed by #10587

Comments

@dorianmariecom
Copy link


Expected behavior

The default rubocop configuration shouldn't return errors when using !! in the return of a define_method/define_singleton_method

Actual behavior

rubocop reports an error:

a.rb:2:3: C: [Correctable] Style/DoubleNegation: Avoid the use of double negation (!!).
  !!good
  ^
a.rb:6:3: C: [Correctable] Style/DoubleNegation: Avoid the use of double negation (!!).
  !!bad
  ^

Steps to reproduce the problem

define_method :good? do
  !!good
end

define_singleton_method :bad? do
  !!bad
end

RuboCop version

1.27.0 (using Parser 3.1.2.0, rubocop-ast 1.17.0, running on ruby 3.1.2 x86_64-darwin21)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant