Repository navigation
New strings_as_factors_linter - #1020
Conversation
# Conflicts: # man/linters.Rd
# Conflicts: # man/linters.Rd
| "This code relies on stringsAsFactors=TRUE, which will", | ||
| "change in the future. Please supply this argument explicitly,", |
There was a problem hiding this comment.
The future as in roughly a year ago 😄
Better say changes in R >= 4.0.0?
Doesn't this lint any data.frame() call with a literal character argument and without explicit stringsAsFactors?
In that case the message should be "provide stringsAsFactors or don't use character constants", no?
There was a problem hiding this comment.
good point! took another pass at it.
| expect_lint("data.frame(x = c('a', 'b'), stringsAsFactors = FALSE)", NULL, strings_as_factors_linter()) | ||
|
|
||
| # strings in argument names to c() don't get linted | ||
| expect_lint("data.frame(x = c('a b' = 1L, 'b c' = 2L), stringsAsFactors = FALSE)", NULL, strings_as_factors_linter()) |
There was a problem hiding this comment.
Why provide stringsAsFactors in this test case?
There was a problem hiding this comment.
Hmm maybe just sloppy-pasted. But turns out there's a real false positive there!
Probably not picked up on our side because quoted keyword args aren't allowed if not needed, and passing literally-named vectors to data.frame() seems uncommon. So let's file as a follow-up bug for now.
AshesITR
left a comment
There was a problem hiding this comment.
Rest looks good. Thank you!
Part of #962
Can surely be tidied up a bit as part of #963, but filing as is for now to finish of #962.