Add tests to detect accidental debug output in C++ and debugging calls in R source#8
Conversation
…er() calls in R Co-authored-by: annahuynhly <97189987+annahuynhly@users.noreply.github.com>
|
Need to ask Ben regarding the debugging statements in |
|
@copilot I have more specific instructions regarding what types of statements we should be detecting. The kind of statements I was referring to were definitely print statements. These are mostly in the form of if we added a "(debug)" [or "(dbg)" for brevity, or some other tag that would be unlikely to occur as a regular message to all of these outputs we could do a test that ran some models with more generally, capture.output(
suppressMessages(
suppressWarnings(
{ <lme4 code that would produce debugging output *if* debugging output were enabled > }
)
)
)might be a good way to see what was going on. For debugging statements in |
Agent-Logs-Url: https://github.com/annahuynhly/lme4/sessions/b94e1be2-e793-49b4-aa2e-dec513868a3a Co-authored-by: annahuynhly <97189987+annahuynhly@users.noreply.github.com>
Great question. In this codebase, the C++ debugging mechanism is mostly print-based (e.g.,
Implemented this in commit |
Without automated checks, debugging artifacts can be accidentally committed and shipped, causing noisy or broken behavior for users.
Changes
tests/testthat/test-debug.R— two tests:C++/runtime behavior check: runs representative
lmer(...)andglmer(...)fits inside:capture.output(...)suppressMessages(...)suppressWarnings(...)and asserts that no stdout output is produced (
expect_length(out, 0L)), which is intended to catch accidental print-style debug output (e.g.if (debug) Rcpp::Rcout ...).R source check: scans
R/*.Rfor uncommentedbrowser()calls.Runtime output check pattern
R source pattern details
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.