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 return_linter to enforce consistent return style #1100

Closed
AshesITR opened this issue Apr 25, 2022 · 5 comments · Fixed by #2271
Closed

New return_linter to enforce consistent return style #1100

AshesITR opened this issue Apr 25, 2022 · 5 comments · Fixed by #2271
Labels
feature a feature request or enhancement new-linter

Comments

@AshesITR
Copy link
Collaborator

Tidyverse expects implicit returns, so those should be the default.

Basically check that the last expr in all function definitions is a) never a return() or b) always a return().

Signature could maybe be return_linter(use_implicit_returns = TRUE)?

The google linters introduced a bunch of these (grep return\(lapply\( R/*.R)

@MichaelChirico
Copy link
Collaborator

these are coming from Google having the opposite policy which is always to have explicit returns.

in fact ExplicitReturnLinter is part of the extended suite (explicitly tabled because of this conflicting issue), so we can work the new option into the implementation there.

@AshesITR AshesITR added the feature a feature request or enhancement label May 2, 2022
@mjsteinbaugh
Copy link

This would be a great addition. Happy to help beta test.

@givison
Copy link

givison commented Feb 23, 2023

Seconding the ask here, would definitely find this linter useful!

@MichaelChirico
Copy link
Collaborator

FYI @mjsteinbaugh and @givison there's a pending version in #2271

@mjsteinbaugh
Copy link

Thanks @MichaelChirico I'll check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement new-linter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants