Skip to content

expect_true_false_linter catches TRUE/FALSE not passed to expected #1520

@heavywatal

Description

@heavywatal

This false positive happens when expect_identical() is used with piping and optional arguments to waldo.

lintr::lint(linters = list(lintr::expect_true_false_linter()), text = "
library(testthat)
42 |> expect_identical(42, ignore_attr = TRUE)
")
#> <text>:3:7: warning: [expect_true_false_linter] expect_true(x) is better than expect_identical(x, TRUE)
#> 42 |> expect_identical(42, ignore_attr = TRUE)
#>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-positivecode that shouldn't lint, but does

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions