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 unnecessarry_lambda_linter() #2310

Closed
Bisaloo opened this issue Nov 18, 2023 · 3 comments
Closed

False positive in unnecessarry_lambda_linter() #2310

Bisaloo opened this issue Nov 18, 2023 · 3 comments
Labels
false-positive code that shouldn't lint, but does

Comments

@Bisaloo
Copy link
Contributor

Bisaloo commented Nov 18, 2023

library(lintr)

lint(text = "lapply(l, function(e) 'a' %in% names(e))", linters = unnecessary_lambda_linter())
#> <text>:1:11: warning: [unnecessary_lambda_linter] Pass names 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)).
#> lapply(l, function(e) 'a' %in% names(e))
#>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Created on 2023-11-18 with reprex v2.0.2

@IndrajeetPatil IndrajeetPatil added the false-positive code that shouldn't lint, but does label Nov 18, 2023
@MichaelChirico
Copy link
Collaborator

can you confirm this is in the current dev version? there's been some recent related fixes

@IndrajeetPatil
Copy link
Collaborator

I had actually checked with current dev before adding the label. This indeed seems like another false positive.

@Bisaloo
Copy link
Contributor Author

Bisaloo commented Nov 20, 2023

Fixed by #2320

@Bisaloo Bisaloo closed this as completed Nov 20, 2023
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
Projects
None yet
Development

No branches or pull requests

3 participants