r-lib / lintr

Static Code Analysis for R
https://lintr.r-lib.org
Other
1.2k stars 187 forks source link

Lint anonymous functions not using lambda syntax (when relevant) #2667

Open IndrajeetPatil opened 2 months ago

IndrajeetPatil commented 2 months ago

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

MichaelChirico commented 2 months ago

@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.

hadley commented 2 months ago

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 😄

MichaelChirico commented 2 months ago

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