# will produce lints
lint(
text = "expect_true(x && y)",
linters = conjunct_test_linter()
)
lint(
text = "expect_false(x || (y && z))",
linters = conjunct_test_linter()
)
lint(
text = "stopifnot('x must be a logical scalar' = length(x) == 1 && is.logical(x) && !is.na(x))",
linters = conjunct_test_linter(allow_named_stopifnot = FALSE)
)
lint(
text = "dplyr::filter(mtcars, mpg > 20 & vs == 0)",
linters = conjunct_test_linter()
)
lint(
text = "filter(mtcars, mpg > 20 & vs == 0)",
linters = conjunct_test_linter()
)
# okay
lint(
text = "expect_true(x || (y && z))",
linters = conjunct_test_linter()
)
lint(
text = 'stopifnot("x must be a logical scalar" = length(x) == 1 && is.logical(x) && !is.na(x))',
linters = conjunct_test_linter(allow_named_stopifnot = TRUE)
)
lint(
text = "dplyr::filter(mtcars, mpg > 20 & vs == 0)",
linters = conjunct_test_linter(allow_filter = "always")
)
lint(
text = "filter(mtcars, mpg > 20 & vs == 0)",
linters = conjunct_test_linter(allow_filter = "not_dplyr")
)
lint(
text = "stats::filter(mtcars$cyl, mtcars$mpg > 20 & mtcars$vs == 0)",
linters = conjunct_test_linter()
)
Run the code above in your browser using DataLab