Skip to content

[LINT_BUG]: box_unused_att_pkg_fun_linter() doesn't recognize replacement functions #181

@calderonsamuel

Description

@calderonsamuel

box.linters version

box.linters: ‘0.10.5’
R 4.5.1
Windows 11

Sample source code to lint

code1 <- "box::use(
  methods[
    `slot<-`,
    setClass,
  ],
)

setClass('Person', slots = c(name = 'character'))
person <- new('Person')
slot(person, 'name') <- 'John' # using replacement function here
"

lintr::lint(code1, linters = box.linters::box_unused_att_pkg_fun_linter())
#> <text>:3:5: warning: [box.linters::box_unused_att_pkg_fun_linter] Imported function unused.
#>     `slot<-`,
#>     ^~~~~~~~

Created on 2025-10-21 with reprex v2.1.1

Lint command used

lintr::lint(code1, linters = box.linters::box_unused_att_pkg_fun_linter())

Lint result

#> :3:5: warning: [box.linters::box_unused_att_pkg_fun_linter] Imported function unused.
#> slot<-,
#> ^~~~~~~~

Expected result

No lint results

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions