Skip to content

Handle unused variable with glue #352

@denrou

Description

@denrou

The following code gives a warning when lint is applied:

library(glue)
test <- function() {
  x <- 1
  glue("{x}")
}

The warning is local variable 'x' assigned but may not be used.

It appears the linter object_usage_linter refers to codetools::checkUsage, which is not available on github unfortunately (so I can't open an issue). I was wondering if this issue could be handle by lintr directly or if a workaround exists.

For now, I applied a #nolint (unused variable) for each problematic line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions