lintr icon indicating copy to clipboard operation
lintr copied to clipboard

Lint anonymous functions not using lambda syntax (when relevant)

Open IndrajeetPatil opened this issue 1 year ago • 3 comments

cf. https://style.tidyverse.org/functions.html#anonymous-functions

Screenshot 2024-10-02 at 22 31 34

Currently, we don't lint these:

library(lintr)

lint(
  text = "map(xs, ~ mean((.x + 5L)))",
  linters = all_linters()
)
#> ℹ No lints found.

Created on 2024-10-02 with reprex v2.1.1

IndrajeetPatil avatar Oct 02 '24 20:10 IndrajeetPatil

@hadley is there such a thing as "versioning" on the style guide?

There is a lot of activity on the guide now, I would want to wait for the rules to settle into place for a bit before making the effort to update {lintr} correspondingly. If there is a "version release" that would make this decision making easier.

MichaelChirico avatar Oct 02 '24 20:10 MichaelChirico

There should be, but there isn't. I'd say that this tranche of activity has now died down and you can expect it to be ignored again for a while 😄

hadley avatar Oct 03 '24 19:10 hadley

OK, filed https://github.com/tidyverse/style/issues/233 as an earmark

MichaelChirico avatar Oct 03 '24 19:10 MichaelChirico

Maybe unnecessary_lambda_linter() becomes lambda_linter() for enforcing the style guide rules, with the old "unnecessary" part toggled by an option?

MichaelChirico avatar Feb 13 '25 22:02 MichaelChirico