Skip to contents

A fast, render-free preflight. Reports everything that would make a render_report() call fail, or come out with unfilled placeholders, before the long Quarto + reportifyr build starts. It never invokes Quarto, R subprocesses or Python, so it is cheap enough to call from a launcher or a CI step ahead of queueing a job.

It checks:

  • the project preconditions render_report() itself enforces (the shell .qmd exists, _quarto.yml sets output-dir: report/shell, the reportifyr *_init.json marker is present, the reference-doc and standard_footnotes.yaml exist). render_report() shares this implementation, so the two can't disagree;

  • that the required Quarto extensions are present in _extensions/ (a directory scan, unlike check_quarto_extensions(), which asks the Quarto CLI);

  • every {rpfy}: placeholder in the .qmd (and every synopsis: image: entry in its front matter): the artifact exists under figures_path/tables_path, its <stem>_<ext>_metadata.json sidecar exists and parses, and the abbreviation keys and meta_type the sidecar references exist in standard_footnotes.yaml;

  • placeholders that are the last thing in their section, which crashes reportifyr's build_report() (see the "Known upstream gotcha" section of render_report()).

Placeholders are only recognized in the .qmd itself, not in files it pulls in with {{< include >}}, and not inside HTML comments or fenced code blocks.

Usage

check_report_project(
  shell_qmd,
  figures_path = file.path(dirname(shell_qmd), "OUTPUTS", "figures"),
  tables_path = file.path(dirname(shell_qmd), "OUTPUTS", "tables"),
  standard_footnotes_yaml = file.path(dirname(shell_qmd), "report",
    "standard_footnotes.yaml"),
  reference_doc = NULL,
  check_extensions = TRUE
)

Arguments

shell_qmd

Path to the shell .qmd, as for render_report().

figures_path, tables_path

Where the {rpfy}: artifacts live; default to OUTPUTS/figures and OUTPUTS/tables alongside shell_qmd, as for render_report().

standard_footnotes_yaml

Path to standard_footnotes.yaml; defaults to report/standard_footnotes.yaml alongside shell_qmd.

reference_doc

Path to the docx reference-template, as for render_report(). NULL (default) uses a reference-doc configured in the .qmd front matter or _quarto.yml, else the package default.

check_extensions

Whether to check _extensions/ for the required Quarto extensions (see quartifyr_quarto_extensions). Default TRUE.

Value

A data frame of class quartifyr_findings with one row per finding and columns check (a short identifier), severity ("error" or "warning"), path (the file concerned) and message. Zero rows when nothing is wrong. Errors are things that make a render fail or leave a placeholder unfilled; warnings are things worth a look.

Examples

if (FALSE) { # \dontrun{
findings <- check_report_project("path/to/project/report.qmd")
findings
if (any(findings$severity == "error")) {
  stop("fix the errors above before rendering")
}
} # }