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

Enable AllowComments for Style/EmptyElse ? #678

Closed
andyw8 opened this issue Jan 23, 2025 · 2 comments · Fixed by #679
Closed

Enable AllowComments for Style/EmptyElse ? #678

andyw8 opened this issue Jan 23, 2025 · 2 comments · Fixed by #679

Comments

@andyw8
Copy link
Contributor

andyw8 commented Jan 23, 2025

As discussed with @paracycle and @Morriar.

By default RuboCop will not allow an empty else, or an else with only a nil.

But in some cases, having an empty else clause can help communicate the intent, even if the else isn't returning anything.

https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/EmptyElse

@rafaelfranca
Copy link
Member

rafaelfranca commented Jan 23, 2025

if foo
  bar
else
  nil
end

Isn't idiomatic Ruby. In ruby empty elses aren't necessary

@rafaelfranca rafaelfranca closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2025
@rafaelfranca rafaelfranca reopened this Jan 23, 2025
@rafaelfranca
Copy link
Member

After second thought, let's do it.

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.

2 participants