r-lib / lintr

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

New linter for multiple assignments #2611

Open MichaelChirico opened 2 weeks ago

MichaelChirico commented 2 weeks ago

It could be nice to catch error-prone behavior in package development like:

my_function <- function(...) { ... }

# lots of code

my_function <- function(...) { ... }

i.e., we define my_function() in multiple places. Then by accident we make a bug fix to the former implementation and scratch our heads why it has no effect on the installed package.

That's the simplest ideal, but there are lots of gotchas here that are potential roadblocks:

That said, I think it's possible to come up with something useful & improve it over time.