Repository navigation
Conversation
* Added `use_workflow_rust_compatible_check()` to install a
`.github/workflows/R-CMD-check.yaml` that can build packages shipping Rust
code. It copies the bundled `R-CMD-Check.yaml` template to the target
package, creating `.github/workflows/` when needed. Unlike the workflow from
`usethis::use_github_action("check-standard")`, which only sets up R and
leaves the runner's default toolchain in place, the template installs Rust
through `dtolnay/rust-toolchain` and, on Windows, additionally the
`x86_64-pc-windows-gnu` target: the Windows runner defaults to an MSVC
toolchain while R and Rtools are GNU based, so the static library produced by
`cargo` cannot be linked and the build noise makes `R CMD check` report a
WARNING. The job matrix covers Windows, macOS, Ubuntu release and Ubuntu
devel with `fail-fast: false`, and sets `R_REMOTES_NO_ERRORS_FROM_WARNINGS` so
that download noise from `remotes`/`pak` does not surface as a check failure.
The function aborts when the path is not a package root, when the template is
missing, or when the workflow file already exists and `overwrite = FALSE`, and
it returns the created path invisibly. The template follows the official
`extendr` CI.
* `make_func_arg_explicit()` now accounts for the argument a pipe passes into
its right-hand side call. The piped-in value already fills the function's
first formal, so the arguments written in the call are matched one formal
later: `x %>% stringr::str_remove("Merc")` becomes
`x %>% stringr::str_remove(pattern = "Merc")`, where it previously claimed
`string` and pushed `Merc` onto `pattern`. Placeholders are honoured too: a
`.` anywhere in a magrittr right-hand side (`%>%`, `%<>%`, `%T>%`) cancels
the leading injection, because the piped value is substituted at `.` instead
of being inserted first, and a `_` in a native pipe (`|>`) makes the value
fill the formal it is attached to, so `x |> lm(y ~ z, data = _)` becomes
`x |> lm(formula = y ~ z, data = _)`. Symbols that merely start with a dot,
such as the `.data` pronoun and `..1`, are not mistaken for the placeholder.
A comment between a pipe and its right-hand side no longer hides the call
from the transformation.
* Added `detect_fn_arg_path()` and `package_fn_arg_path()` to report exported
functions whose path-like argument defaults to a concrete location, which CRAN
does not allow. The check is syntactic: the file is parsed, the top-level
`name <- function(...)` definitions that count as exported are kept, and every
formal whose name matches `arg_pattern` (default `"path|file|filename"`) is
reported when its default is not listed in `allow` (default `"NULL"`); an
argument without a default is always fine. Each hit is printed as
`file:line:col` with the function and argument name, the source lines and a
caret marker under `arg = default`. `detect_fn_arg_path()` checks one file and
falls back to the active document; pass `exports` or `export_patterns` when the
exports of that file are known, otherwise every top-level function is checked.
`package_fn_arg_path()` reads the exports from `NAMESPACE` and scans the `.R`
files under `dirs` (default `"R"`). Both return `TRUE` invisibly when nothing
needs fixing.
* Added `use_tidy_addin()` to register an exported function in
`inst/rstudio/addins.dcf`, which makes it available from the RStudio Addins
menu. The new entry is written above the existing ones, a `Binding` that is
already registered is never added twice, and the file is written as UTF-8.
Before writing, the function checks that the path is a package and that the
function is exported in `NAMESPACE`, reads the function body (from the
installed package, or from `R/` when the package has not been documented yet),
and warns when the body calls no `rstudioapi` function or, with
`Interactive = TRUE`, no `shiny`/`miniUI` function; a non-interactive session
cannot confirm, so it only reports the warning and continues. It returns the
path of the dcf file invisibly, or `NULL` when the operation is cancelled.
* `rpkgkit` now registers its own addins in `inst/rstudio/addins.dcf`:
`package_lost_glue_brace()` and `detect_lost_glue_brace()`,
`package_print_and_cat()` and `detect_print_and_cat()`,
`package_fn_arg_path()` and `detect_fn_arg_path()`,
`package_unmatched_nocov_marker()` and `check_pkgdown_reference()`. The
`detect_*()` addins run on the active editor, the package-wide ones on the
current package directory. All of them only report, so none rewrites a file.
## MINOR IMPROVEMENTS
* `detect_lost_glue_brace()` and `detect_print_and_cat()` now print the offending
source line with cli syntax highlighting. The file is highlighted once and then
indexed line by line, because a single source line is usually not parseable (a
continuation such as `x = fn(a, b),` ends with a comma) and
`cli::code_highlight()` silently returns unparseable input unchanged; when the
highlighting fails, or when it returns a different number of lines, the plain
source is printed instead.
* `add_colors_to_cli()` (standalone `colorful_cli.R`) gained `.envir`, defaulting
to `parent.frame()` and forwarded to the wrapped cli function, so glue-style
interpolation such as `"Hello, {name}"` is resolved in the caller's environment
instead of the wrapper's frame.
* `use_zzz()` now resolves `file_name` inside the function body
(`file_name = NULL` means `<pkg>-package.R`) instead of in the default
argument, following the `path = NULL` convention of the other `use_*()`
helpers.
## DOCUMENTATION
* The `code_convertion` vignette gained a "Detect default paths in exported
arguments" section covering `detect_fn_arg_path()` and
`package_fn_arg_path()`, and the `pkg_maintain` vignette an "RStudio addins"
section covering `use_tidy_addin()` and the bundled addins.
* The `standalone_tools` vignette documents the `.envir` argument of the
`colorful_cli.R` wrapper.
* The README gained an "Addin" section, and `README.md` was regenerated from
`README.Rmd`. Both translations under `inst/translations/` were brought back in
sync with the English README: they now share its badge block (the stale
development-version badge is gone), and carry the "recommended packages" and
"AI skills" sections and the "Addin" section they were missing.
* The package skill (`skills/rpkgkit/`) covers the new functions and the addin
workflow.
* Vignette subtitles now report version 0.1.23.
* Added `use_air_table()` to lay out long `c()` and `list()` calls as column-aligned tables with `air` 0.8.0 or newer. A first `air format` run leaves every element on its own line; the experimental `# fmt: table` directive is then inserted above every call holding more than `min_length` elements and the elements are re-flowed so that each row holds `ncol` of them, by collapsing the line breaks inside a row or, for a definition that air kept on a single line, by splitting it into rows. A second `air format` run pads the cells and aligns the columns. Only calls whose elements are all unnamed are converted, because air expands named elements one per line whatever the directive says; only the outermost call of a statement is converted, because air ignores the directive on nested calls; a line ending in a comment is never joined with the next one, which would swallow the following element; and a call that already carries the directive is left untouched, so the function is idempotent. `path = NULL` falls back to the active RStudio document, `air` must be on the `PATH` (checked with `check_air_installed()`), and the normalized path is returned invisibly. * The startup message is now a `cli` progress step: `.onLoad()` starts `cli::cli_progress_step()` and `.onAttach()` closes it with `cli::cli_process_done()`, which also covers the time spent loading the namespace. The hand-written `cli_timestamp_formatter()` helper, which formatted the elapsed time by hand, is gone, and the `use_zzz()` template (`inst/R_template/zzz_template.R`) follows the same pattern. * The `code_convertion` vignette gained a "Lay out long vectors and lists as tables" section covering `use_air_table()` and its requirements. * `use_air_table()` is listed in the README, in both translations under `inst/translations/`, and in the `_pkgdown.yml` reference index. * The package is now spell-checked: `spelling` was added to `Suggests` together with `Language: en-US`, `inst/WORDLIST` holds the accepted words, and `tests/spelling.R` runs `spelling::spell_check_test()`.
`cli_kable()` for printing a data frame, a matrix or any object `as.data.frame()` accepts as the pipe table of `knitr::kable()`, the layout `kableExtra::kable()` shows, with `cli` inline classes instead of Markdown.
…very manager and document them in `check_sysdeps()`
- Rewrite the `add_double_colons()` engine using a Rust-based tokenizer (`mfce_make_calls_explicit_rs`) that respects R's lexical rules for strings, raw strings, comments, and backtick-quoted names. - Qualify exported datasets (e.g. `penguins` -> `palmerpenguins::penguins`) in addition to function calls. - Add `get_defined_fn()` so locally defined functions are included in the default `ignore_functions` set, preventing false rewrites of user-defined helpers that shadow imported names. - Build a shared package lookup context via `mfce_package_context()` (resolved once per invocation) and pass it to each file rewrite, avoiding repeated namespace-export reads. - Add `cli::cli_progress_bar()` and per-file error collection with a summary report in `package_func_call_explicit()`. - Preserve the file's final-newline state during in-place rewrite. - Update tests to use synthetic contexts, covering `$`/`@` accessors, formal arguments, `data()` calls, base-package exclusion, backtick names, and unknown-function warnings. - Add Dependencies section to README and update spell-check WORDLIST. ```
feat(code_highlight): make code highlight theme configurable via option - Add `rpkgkit.code.highlight` option to control cli::code_highlight theme - Set default theme to "Tomorrow Night Bright" in .onAttach - Replace hardcoded cli::code_highlight calls with theme option - Mark get_defined_fn() as internal with \dontrun example - Update .Rbuildignore and .gitignore for agent tooling files ```
Replace the standalone R implementations of `get_var_value()` and `%<-%` (zeallot) with Rust equivalents exposed via extendr. - Add `get_var_value` and `zeallot` modules in src/rust/src/lib.rs - Register `gvv_trace_rs` and `unpack_assign_rs` wrappers - Export `%<-%` and `get_var_value` in NAMESPACE - Remove import-standalone-get_var_value.R and import-standalone-zeallot.R Other changes in this commit: - Bump minimum rustc from 1.65 to 1.77 in DESCRIPTION, Cargo.toml, and NEWS.md - Handle Windows path separators (`\`) in optimize_rmd_yaml for basename, dirname, file_path_sans_ext, and detect_type - Fix test-make_func_call_explicit to account for platform-specific newline (CRLF on Windows) - Update README translations: add extendr badge, dependencies tree, citation section; remove deprecated entries from cheatsheets - Add "destructuring" and "unresolvable" to WORDLIST - Add `extendr-ffi` as a Cargo dependency
feat(use_r): add use_r() to auto-detect minimum R version from source code Introduce `use_r()` which recursively scans `.R` files for base R functions and syntax introduced across R versions 4.1.0 through 4.6.0 (e.g. `|>`, `\()`, `%||%`, `sort_by()`, `use()`, `%notin%`) and records the highest requirement in `DESCRIPTION`. Locally defined names such as the package's own `%||%` are reported but do not raise the requirement. The recursive walk and token-level detection are implemented in Rust (`ur_scan_rs()`). - Refactor `use_r_v4.1.0()` into a shortcut that always pins `R (>= 4.1.0)`; documentation now shared via `@rdname use_r`. - Add `ur_scan_text_rs()` and `ur_scan_rs()` extendr wrappers. - Lower package `Depends` from `R (>= 4.2)` to `R (>= 4.1.0)`. - Add MSRV badge (rustc 1.77.0+) to README and translations. - Update NAMESPACE, _pkgdown.yml, and remove stale .Rd file. ```
fix(win): add -lsynchronization to resolve Rust linking error Recent Rust std releases on *-pc-windows-gnu use WaitOnAddress() from the synchronization import library. Without -lsynchronization the final gcc link fails with "undefined reference to `WaitOnAddress'". Also: - Document use_r() in README and vignette - Reformat test files to stay within line length limits - Fix spacing in zeallot named-argument tests ```
perf(convert): switch Rust text processing from char to byte-level Rewrite cfs_process_once and cil_process_text_impl to operate on raw bytes (&[u8]) instead of Vec<char>, eliminating UTF-8 decoding overhead and per-call allocation. ASCII syntactic characters never appear inside multi-byte UTF-8 sequences, so byte-wise matching is safe and faster. Add lazy batch-flush via a `last` pointer so that unchanged runs cost a single memcpy instead of per-character push. Also add input validation in R wrappers (check_string, file existence, .R extension check, parse_safely) and comprehensive unit tests for edge cases including non-ASCII identifiers, comments, strings, raw strings, and hex/exponent literals. ```
- `inquire_standalone()` and `browse_standalone()` now use Rust (`inquire_standalone_rs()`, `browse_standalone_rs()`) with `ureq` instead of the `gh` package; `dplyr` and `gh` removed from Suggests, `tibble` added - `convert_int_literals()` and `package_convert_int_literals()` support a `# rpkgkit: not int` comment to skip a line; extracted `.cil_convert_file()` and `.cil_package_files()` helpers - Bumped minimum `rustc` from 1.77.0 to 1.85.0 (required by `ureq` 3) - `inquire_standalone()` now returns `repo`, `description` and `usage` columns as documented BREAKING CHANGE: minimum `rustc` is now 1.85.0; `inquire_standalone()` returns additional columns (`repo`, `description`, `usage`).
Mark `.cil_convert_file` as `@keywords internal` so it is excluded from the package index. Detect the minimum macOS version from `libR.dylib` via `otool` at configure time and export `MACOSX_DEPLOYMENT_TARGET` before the cargo build. This prevents linker warnings when crates such as `ring` compile C/assembly sources that inherit a newer SDK default than R itself links against, which `R CMD check` would otherwise flag as a WARNING. Rewrite the spelling test guard to verify that package sources are discoverable in the current working directory layout before invoking `spelling::spell_check_test()`. Tools like `covr` copy tests to a non-standard path where the built-in lookup silently fails; the check is now skipped there instead of producing a misleading result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.