Skip to content

Commit

Permalink
allow_trailing=FALSE lints when EQ_ASSIGN used
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico committed Jan 28, 2025
1 parent 69841ea commit 73e3cac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions R/assignment_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ assignment_linter <- function(operator = c("<-", "<<-"),
c(
"//LEFT_ASSIGN",
"//RIGHT_ASSIGN",
"//EQ_ASSIGN",
"//EQ_SUB",
"//EQ_FORMALS",
"//SPECIAL[text() = '%<>%']"
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-assignment_linter.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ test_that("arguments handle trailing assignment operators correctly", {
),
linter
)

expect_lint(
"a =\n1",
"= should not be trailing",
linter
)
})

test_that("allow_trailing interacts correctly with comments in braced expressions", {
Expand Down

0 comments on commit 73e3cac

Please sign in to comment.