
Check a report project without rendering it
Source:R/check-report-project.R
check_report_project.RdA 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.qmdexists,_quarto.ymlsetsoutput-dir: report/shell, the reportifyr*_init.jsonmarker is present, the reference-doc andstandard_footnotes.yamlexist).render_report()shares this implementation, so the two can't disagree;that the required Quarto extensions are present in
_extensions/(a directory scan, unlikecheck_quarto_extensions(), which asks the Quarto CLI);every
{rpfy}:placeholder in the.qmd(and everysynopsis:image:entry in its front matter): the artifact exists underfigures_path/tables_path, its<stem>_<ext>_metadata.jsonsidecar exists and parses, and the abbreviation keys andmeta_typethe sidecar references exist instandard_footnotes.yaml;placeholders that are the last thing in their section, which crashes reportifyr's
build_report()(see the "Known upstream gotcha" section ofrender_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 forrender_report().- figures_path, tables_path
Where the
{rpfy}:artifacts live; default toOUTPUTS/figuresandOUTPUTS/tablesalongsideshell_qmd, as forrender_report().- standard_footnotes_yaml
Path to
standard_footnotes.yaml; defaults toreport/standard_footnotes.yamlalongsideshell_qmd.- reference_doc
Path to the docx reference-template, as for
render_report().NULL(default) uses areference-docconfigured in the.qmdfront matter or_quarto.yml, else the package default.- check_extensions
Whether to check
_extensions/for the required Quarto extensions (see quartifyr_quarto_extensions). DefaultTRUE.
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.