Skip to content

Fix latent bugs and reduce code smells#31

Merged
coatless merged 6 commits into
mainfrom
cleanup-code-smells
Jun 23, 2026
Merged

Fix latent bugs and reduce code smells#31
coatless merged 6 commits into
mainfrom
cleanup-code-smells

Conversation

@coatless

Copy link
Copy Markdown
Contributor

A cleanup pass over the existing code, in self-contained commits:

  • Fix latent bugsopenmp_uninstall() referenced an undefined variable (erroring after removing files), tar_package_install() only caught negative exit codes, a failed DMG install leaked its mount, the install progress bar never advanced, and gfortran() dropped its error message.
  • Remove dead code — unreachable return() calls after cli_abort().
  • Extract shared helpersr_version_full(), system_os(), arch_switch(), and an unsupported-R-version guard, removing duplication across the installer helpers.
  • Split long functions — the 265-line macos_rtools_install() and the gfortran_install() legacy branch into focused, single-purpose helpers.
  • Regenerate documentation with roxygen2 8.0.0.

coatless added 6 commits June 22, 2026 22:09
- openmp_uninstall(): reference the configure_makevars argument instead of an undefined variable that errored after removing files.
- tar_package_install(): treat any non-zero exit as failure (was status < 0, which missed real tar failures).
- dmg_package_install(): unmount the volume before aborting so a failed install does not leak the mount.
- xcode_cli_install(): remove the temp file before aborting (was unreachable after cli_abort).
- gfortran(): carry the error message in $stdout so callers stop silently dropping it.
- macos_rtools_install()/uninstall(): advance the progress bar via id=/set= instead of passing the handle as inc.
- configure_openmp_makevars(): actually return early when ~/.R cannot be created.
Drop 14 unreachable return() statements that followed cli::cli_abort() (which always throws) across gfortran.R, xcode.R, and openmp.R. Also make block_replace() actually print the block it tells the user to copy instead of discarding the paste0() result.
- Add r_version_full() and route the 6 inline paste(R.version...) call sites through it (and is_r_version's full-version branch).
- Use system_os() instead of re-inlining tolower(Sys.info()[['sysname']]) in assert_mac() and .onAttach().
- Add arch_switch() for the arm64/aarch64/x86_64 dispatch + shared 'not recognized' error, collapsing four duplicated switch() blocks in installers.R.
- Add assert_supported_r_version_for() for the unsupported-R-version guard duplicated across three installer helpers.
- Break the 265-line macos_rtools_install() into rtools_install_announce/xcode_cli/gfortran/recipes/summary helpers; the orchestrator is now a short, readable sequence with the same behavior and output.
- Extract the softwareupdate label pipeline in xcode_cli_install() into xcode_cli_available_label().
- Rewrite the toolchain tests to target the new step seams instead of mocking base-R internals, and add test-openmp.R (OpenMP was previously untested).
Move the R 4.0-4.2 architecture dispatch (Intel Mojave DMG, arm64 gfortran 11/12, and the unsupported-arch/old-R aborts) into install_gfortran_legacy(), flattening gfortran_install() from 142 to ~100 lines. Add a focused test covering each legacy dispatch branch.
Run devtools::document() to add man pages for the new internal version helpers and migrate RoxygenNote to Config/roxygen2/version (8.0.0).
@coatless coatless merged commit f23a85f into main Jun 23, 2026
3 checks passed
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.

1 participant