FredHutch / VISCtemplates

Tools for writing reproducible reports at VISC
Other
4 stars 2 forks source link

Warnings when knitting report templates #174

Closed slager closed 3 days ago

slager commented 1 week ago

6 warnings occur in the unit tests when knitting reports from templates (the reports still knit).

These same warnings occur across all the CI platforms, so it should be possible to debug them locally on any platform using devtools::test(filter = 'template').

See: https://github.com/FredHutch/VISCtemplates/actions/runs/9800977516/job/27063579270

3 of the warnings are the same one, from the docx knit for non-empty reports:

  ── Warning ('test-template.R:23:7'): knit bama report docx ─────────────────────
  Chunk option fig.align is not supported for docx output
  ── Warning ('test-template.R:23:7'): knit nab report docx ──────────────────────
  Chunk option fig.align is not supported for docx output
  ── Warning ('test-template.R:23:7'): knit generic report docx ──────────────────
  Chunk option fig.align is not supported for docx output

This likely originates here: https://github.com/FredHutch/VISCtemplates/blob/954da311ed27f2719279ed3934307b892ebadde7/inst/rmarkdown/templates/visc_report/skeleton/skeleton.Rmd#L65-L67

The same code is also found in the empty skeleton, but doesn't seem to throw a warning: https://github.com/FredHutch/VISCtemplates/blob/331abbba8cd8f2766396c93e38da279715fefb6b/inst/rmarkdown/templates/visc_empty/skeleton/skeleton.Rmd#L49-L51

The other 3 also probably refer to a single problem, an undefined reference in the bama report which affects both pdf and docx knits:

  ── Warning ('test-template.R:23:7'): knit bama report pdf ──────────────────────
  LaTeX Warning: Reference `tab:sample-size' on page 6 undefined on input line 525.
  ── Warning ('test-template.R:23:7'): knit bama report pdf ──────────────────────
  LaTeX Warning: There were undefined references.
  ── Warning ('test-template.R:23:7'): knit bama report docx ─────────────────────
  The label(s) tab:sample-size not found

These seem to relate to this: https://github.com/FredHutch/VISCtemplates/blob/331abbba8cd8f2766396c93e38da279715fefb6b/inst/templates/methods-bama/bama-statistical-methods.Rmd#L150

Once we resolve these warnings, we could daylight the knitting warnings during the CI checks via expect_no_warning() so that the runners will show a failure checkmark if there is a knit warning. This would allow us to more easily notice new knit warnings getting introduced from future PRs, and prevent those from becoming part of the codebase.

slager commented 3 days ago

Fixed by #182.