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

False-positive in unnecessary_lambda_linter? #2247

Closed
strengejacke opened this issue Oct 29, 2023 · 2 comments · Fixed by #2248
Closed

False-positive in unnecessary_lambda_linter? #2247

strengejacke opened this issue Oct 29, 2023 · 2 comments · Fixed by #2248
Labels
false-positive code that shouldn't lint, but does regression code that used to work, but now doesn't

Comments

@strengejacke
Copy link

I got a warning from lintr:

Warning: file=R/check_predictions.R,line=434,col=30,[unnecessary_lambda_linter] Pass exp directly as a symbol to lapply() instead of wrapping it in an unnecessary anonymous function. For example, prefer lapply(DF, sum) to lapply(DF, function(x) sum(x)).

The related code line is:

sims[] <- lapply(sims, function(i) exp(i) - plus_minus)

This looks like a false-positive to me?

@MichaelChirico MichaelChirico added regression code that used to work, but now doesn't false-positive code that shouldn't lint, but does labels Oct 29, 2023
@MichaelChirico
Copy link
Collaborator

MichaelChirico commented Oct 29, 2023

Thanks for the report! Seems the fix for #2231 was not robust enough.

@strengejacke
Copy link
Author

Thanks for fixing this so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-positive code that shouldn't lint, but does regression code that used to work, but now doesn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants