Skip to content

sprintf_linter() for 1-argument calls? #2980

@MichaelChirico

Description

@MichaelChirico

Is there any reason not to lint this?

# known string
sprintf(paste0(x, y))
# assumed string
sprintf(foo())

We already lint the literal version:

lint(text = "sprintf('a')", linters = sprintf_linter())
# <text>:1:1: warning: [sprintf_linter] sprintf call can be removed when a constant string is provided.
# sprintf('a')
# ^~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-negativecode that should lint, but doesn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions