Skip to contents

vl_lint() for a test suite or a CI job: run the rules and stop if anything turns up. A figure that lints clean today stays that way, in the same spirit as font_pin() and scene_hash() — with the difference that this one catches defects rather than changes.

Usage

vl_lint_assert(
  scene,
  ...,
  severity = c("warning", "note"),
  on = c("error", "warn")
)

Arguments

scene

A vl_scene(), or anything with an as_vellum_scene() method.

...

Passed to vl_lint()rules, exclude, the thresholds.

severity

"warning" (default) fails only on warnings; "note" fails on anything at all.

on

"error" (default) or "warn".

Value

Invisibly, the findings that triggered the failure — a zero-row frame when the scene is clean.

See also

vl_lint(), vl_lint_overlay() to see what was reported.

Examples

clean <- vl_scene(3, 2) |> draw(text_grob("fine", gp = vl_gpar(fontsize = 12)))
vl_lint_assert(clean)

# In a test:
# test_that("the figure has no lint findings", vl_lint_assert(my_plot()))