Skip to contents

Guards the glob fields in a package's schema.yaml files against drifting away from their pattern fields. For every table, each test-fixture file that pattern matches must also be matched by at least one glob — otherwise that file would never be synced down and the parser would silently see nothing.

Usage

schema_glob_check(pkg, fixture_dir = NULL)

Arguments

pkg

(character(1))
Package name whose schemas to check.

fixture_dir

(character(1))
Directory of test fixtures to match against. Defaults to the package's extdata.

Value

(tibble())
One row per (tool, table, file) that pattern matches but no glob does. Zero rows means the schemas are consistent.

Details

Only the too-narrow direction is checked: a glob wider than its pattern merely syncs a few extra files, which the parsers ignore.

pattern is matched against basenames (as Tool does when discovering files) while glob is matched against the path relative to fixture_dir (as aws s3 sync matches keys relative to the sync root), so a glob may be tightened with a directory prefix without failing this check.

Examples

(bad <- schema_glob_check("nemo"))
#> # A tibble: 0 × 3
#> # ℹ 3 variables: tool <chr>, table <chr>, file <chr>