Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .ci/linters/dt_test_literal_linter.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Avoid test(SYMBOL) and test(SYMBOL+...) except in rare cases.
# in the latter case, prefer test(NUMBER+expr).
dt_test_literal_linter <- lintr::make_linter_from_xpath(
"
//SYMBOL_FUNCTION_CALL[text() = 'test']
/parent::expr
/following-sibling::expr[1][SYMBOL or expr[1]/SYMBOL]
",
"Prefer test's 'num' argument to start with a numeric literal except in rare cases, e.g. test(123, ...) or test(123+x/6, ...)"
)
2 changes: 1 addition & 1 deletion inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -9769,7 +9769,7 @@ nqjoin_test <- function(x, y, k=1L, test_no, mult="all") {
ans1 = nq(x, y, thiscols, thisops, 0L, mult=mult)
ans2 = check(x, y, thiscols, thisops, mult=mult)
test_no = test_no + .001
test(test_no, ans1, ans2)
test(test_no, ans1, ans2) # nolint: dt_test_literal_linter.
}
gc() # no longer needed but left in place just in case, no harm
}
Expand Down