We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Corrected this test, and added the incorrect test as a new regression test.
That said, the new fix is more expedient than perfect -- it'll throw an incorrect lint here:
foo <- function() { if (TRUE) { if (TRUE) { return(1) } 2 } else { 3 }
(the return() is a valid early return within that branch).
return()
But as this issue is not relevant to the implicit else returns feature, I'm pushing to follow-up.
else
Originally posted by @MichaelChirico in #2321 (comment)
The text was updated successfully, but these errors were encountered:
Test case for regression:
test_that("explicit returns in control flow are linted", { lint_msg <- rex::rex("Use implicit return behavior") expect_lint( trim_some(" foo <- function(bar) { if (TRUE) { return(bar) } else { return(NULL) } } "), list(lint_msg, lint_msg), return_linter() ) })
Sorry, something went wrong.
Also ensure that e.g. R/any_duplicated_linter.R does not lint.
Successfully merging a pull request may close this issue.
That said, the new fix is more expedient than perfect -- it'll throw an incorrect lint here:
(the
return()
is a valid early return within that branch).But as this issue is not relevant to the implicit
else
returns feature, I'm pushing to follow-up.Originally posted by @MichaelChirico in #2321 (comment)
The text was updated successfully, but these errors were encountered: