-
Notifications
You must be signed in to change notification settings - Fork 193
Closed
Labels
false-positivecode that shouldn't lint, but doescode that shouldn't lint, but does
Description
I have found an issue with the new allow_trailing argument for assignment_linter
where if there is a comment somewhere in a set of braces, then it will flag all of the assignments in the braces
text <- 'testthat::test_that("app ui", {
ui <- appUI()
golem::expect_shinytaglist(ui)
# Check that formals have not been removed
fmls <- formals(appUI)
for (i in "request") {
testthat::expect_true(i %in% names(fmls))
}
})
testthat::test_that("app server", {
server <- appServer
testthat::expect_type(server, "closure")
# Check that formals have not been removed
fmls <- formals(appServer)
for (i in c("input", "output", "session")) {
testthat::expect_true(i %in% names(fmls))
}
})'
lint(
text = text,
linters = assignment_linter(allow_trailing = FALSE)
)
Expected: no lints
Actual: 4 lints
<text>:2:6: style: [assignment_linter] Assignment <- should not be trailing at end of line
ui <- appUI()
^~
<text>:5:8: style: [assignment_linter] Assignment <- should not be trailing at end of line
fmls <- formals(appUI)
^~
<text>:13:10: style: [assignment_linter] Assignment <- should not be trailing at end of line
server <- appServer
^~
<text>:16:8: style: [assignment_linter] Assignment <- should not be trailing at end of line
fmls <- formals(appServer)
^~
Metadata
Metadata
Assignees
Labels
false-positivecode that shouldn't lint, but doescode that shouldn't lint, but does