Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tinyrox
Title: Minimal R Documentation Generator
Version: 0.3.3.7
Version: 0.3.3.8
Authors@R:
person("Troy", "Hernandez", email = "troy@cornball.ai", role = c("aut", "cre"),
comment = c(ORCID = "0009-0005-4248-604X"))
Expand Down
8 changes: 7 additions & 1 deletion R/document.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ document <- function(path = ".",
if (!silent) {
message("No documentation blocks found.")
}
return(invisible(list(rd_files = character(), pruned = character(),
# Nothing is generated this run, so every tinyrox-owned Rd is now stale
# (e.g. the last documented topic was deleted). Prune them too.
pruned <- character()
if (prune_rd) {
pruned <- prune_stale_rd(path, character(), silent)
}
return(invisible(list(rd_files = character(), pruned = pruned,
namespace = NULL)))
}

Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,25 @@ add <- function(x, y) {
tinyrox includes automated CRAN compliance checks:

```r
# Check DESCRIPTION for common issues
check_description_cran()
# Warns about: unquoted package names, missing web service links

# Check R code for CRAN policy violations
check_code_cran()
# Warns about: T/F, print()/cat(), .GlobalEnv, installed.packages(), etc.

# Run all checks
check_cran()
# Check exported functions for missing examples and \dontrun overuse
check_examples_cran()

# Auto-fix DESCRIPTION quoting issues
fix_description_cran()
# Run all checks (code + examples)
check_cran()
```

Issues detected:
- Unquoted package/software names in Title/Description
- Missing web service links for packages like hfhub, gh
- `T`/`F` instead of `TRUE`/`FALSE`
- `print()`/`cat()` instead of `message()`
- `installed.packages()` usage
- `.GlobalEnv` modifications
- `setwd()` without `on.exit()` restoration
- Hardcoded `set.seed()` without parameter
- Exported functions without examples; `\dontrun{}` overuse

## Philosophy

Expand All @@ -119,7 +114,7 @@ tinyrox follows the [tinyverse](https://www.tinyverse.org) philosophy:
- Explicit over implicit - no inference magic
- Strict subset of tags - not everything roxygen2 does
- Deterministic output - same input = same output
- Fail fast on unknown tags
- Warn and skip unknown tags (roxygen2 behavior), never abort the run

**What tinyrox does NOT do:**
- Markdown parsing
Expand Down
22 changes: 22 additions & 0 deletions inst/tinytest/test_prune.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,25 @@ expect_false(file.exists(file.path(pkg, "man", "old_topic.Rd"))) # stale tinyro
expect_equal(sort(basename(res$pruned)), c("foo.Rd", "old_topic.Rd"))

unlink(pkg, recursive = TRUE)

# Deleting the last documented topic prunes its Rd: with zero blocks the run
# generates nothing, so every tinyrox-owned Rd is stale (document() must prune
# on the no-blocks path, not return early).
pkg2 <- file.path(tempdir(), "prunelast")
if (dir.exists(pkg2)) unlink(pkg2, recursive = TRUE)
dir.create(file.path(pkg2, "R"), recursive = TRUE)
writeLines(c("Package: prunelast", "Title: Test", "Version: 0.1.0"),
file.path(pkg2, "DESCRIPTION"))
writeLines(c("#' Solo", "#' @export", "solo <- function() 1"),
file.path(pkg2, "R", "solo.R"))
tinyrox::document(pkg2, namespace = "none", cran_check = FALSE, silent = TRUE)
expect_true(file.exists(file.path(pkg2, "man", "solo.Rd")))

# Remove the only roxygen -> no blocks; the now-stale solo.Rd must be pruned.
writeLines("solo <- function() 1", file.path(pkg2, "R", "solo.R"))
res2 <- tinyrox::document(pkg2, namespace = "none", cran_check = FALSE,
silent = TRUE, prune_rd = TRUE)
expect_false(file.exists(file.path(pkg2, "man", "solo.Rd")))
expect_equal(basename(res2$pruned), "solo.Rd")

unlink(pkg2, recursive = TRUE)
Loading