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

New cop: Detect return with argument on the top-level #7425

Closed
pocke opened this issue Oct 13, 2019 · 2 comments · Fixed by #8377
Closed

New cop: Detect return with argument on the top-level #7425

pocke opened this issue Oct 13, 2019 · 2 comments · Fixed by #8377
Labels
enhancement good first issue Easy task, suitable for newcomers to the project

Comments

@pocke
Copy link
Collaborator

pocke commented Oct 13, 2019

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

return has been allowed on the top-level since Ruby 2.4.

foo

return # Since Ruby 2.4.

bar # It is never executed.

But the argument of return is ignored always.

return 1 # 1 is always ignored.

It will be detected since Ruby 2.7. ruby/ruby@aa97410
But RuboCop doesn't.

Describe the solution you'd like

Add a new cop to detect the problem. Maybe it will be named Lint/TopLevelReturnWithArgument.

Describe alternatives you've considered

nothing

Additional context

nothing

@stale
Copy link

stale bot commented Apr 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the stale Issues that haven't been active in a while label Apr 10, 2020
@bbatsov bbatsov added the good first issue Easy task, suitable for newcomers to the project label Apr 10, 2020
@stale stale bot removed the stale Issues that haven't been active in a while label Apr 10, 2020
@lizzzp1
Copy link

lizzzp1 commented Apr 27, 2020

Can I take a stab at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Easy task, suitable for newcomers to the project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants