Skip to content

expect_comparison_linter() gets bad metadata for faulty expect_true() usage #2083

@MichaelChirico

Description

@MichaelChirico

Came across this:

expect_true(is.count(n_draws), n_draws > 1)

This throws expect_comparison_linter(), but gives a bad message:

lint(
  text = "expect_true(is.count(n_draws), n_draws > 1)",
  linters = expect_comparison_linter()
)
<text>:1:1: warning: [expect_comparison_linter] NA(x, y) is better than expect_true(x ( y).
expect_true(is.count(n_draws), n_draws > 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Maybe we shouldn't invest in doing anything here since expect_true()'s been used incorrectly, but certainly it's not a helpful lint message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions