Skip to content

Fix double periods, spaces, prevent c++ errors with Stan flags, update snapshots, etc. - #573

Merged
rempsyc merged 1 commit into
mainfrom
minor_corrections_brms
Sep 16, 2025
Merged

rempsyc merged 1 commit into
mainfrom
minor_corrections_brms

Conversation

@rempsyc

@rempsyc rempsyc commented Sep 16, 2025

Copy link
Copy Markdown
Member

Fix double periods, spaces, prevent c++ errors with Stan flags, update snapshots, etc.

@rempsyc
rempsyc requested a review from Copilot September 16, 2025 01:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR focuses on improving text formatting and fixing compilation issues in the report package tests and functions. The main goals are to clean up double periods/spaces in generated text, prevent C++ compilation errors from Stan flags, and update test snapshots.

  • Removes redundant library loading and duplicate skip statements in test files
  • Adds a new setup file to neutralize C/C++ compilation flags that could interfere with tests
  • Improves text formatting logic in report functions to prevent double periods and extra spaces

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/testthat/setup-00-toolchain.R New setup file to neutralize C/C++ compilation flags and prevent Stan-related compilation errors
R/report.lm.R Enhanced text formatting with helper functions to prevent double periods and extra spaces
R/report.brmsfit.R Fixed double period issue in prior descriptions
tests/testthat/test-report.lm.R Improved code formatting by breaking long lines into multiple lines
tests/testthat/test-report.brmsfit.R Removed duplicate skip statements and improved code formatting
tests/testthat/test-report.survreg.R Removed unnecessary namespace unloading
tests/testthat/test-report.estimate_contrasts.R Removed redundant library loading
tests/testthat/test-report.BFBayesFactor.R Removed redundant library loading

Comment thread R/report.lm.R
Comment on lines +752 to +758
sep_after <- function(x) {
x <- trimws(x)
if (!nzchar(x)) {
return("")
} # nothing to add if empty
if (grepl("[.!?]\\s*$", x)) " " else ". " # space if already ends with .!?; else ". "
}

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helper function sep_after lacks documentation. Add a docstring explaining its purpose: to add appropriate spacing after text fragments, returning a single space if the text already ends with punctuation, or '. ' otherwise.

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +24
# message("FLAGS after cleanup:\n",
# paste(sprintf("%s='%s'", vars, Sys.getenv(vars)), collapse="\n"))

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider removing the commented debug code or moving it to a conditional block that can be enabled via an environment variable for debugging purposes, rather than leaving it as commented code.

Suggested change
# message("FLAGS after cleanup:\n",
# paste(sprintf("%s='%s'", vars, Sys.getenv(vars)), collapse="\n"))
if (identical(Sys.getenv("DEBUG_TOOLCHAIN_SETUP"), "1")) {
message("FLAGS after cleanup:\n",
paste(sprintf("%s='%s'", vars, Sys.getenv(vars)), collapse="\n"))
}

Copilot uses AI. Check for mistakes.
@rempsyc
rempsyc merged commit dea8d66 into main Sep 16, 2025
25 of 26 checks passed
@rempsyc
rempsyc deleted the minor_corrections_brms branch September 16, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants