
Lint an R script or Quarto/RMarkdown document for statistical hazards
Source:R/lint-engine.R
stat_lint.RdParses .R, .qmd, or .Rmd source code into an abstract syntax tree (AST)
and evaluates registered statistical and methodological lint rules.
Arguments
- path
Path to an
.R,.r,.qmd, or.Rmdfile.- rules
Optional subset of rules to run: a character vector of rule IDs, a list of
statci_ruleobjects, orNULL(default) to run all registered rules.- exclude_rules
Optional character vector of rule IDs to skip.
- skip_eval_false
Logical; for
.qmd/.Rmdfiles, skip chunks witheval = FALSEor#| eval: false. DefaultFALSE.
Value
An S3 object of class "statci_lint" containing findings (a
tibble::tibble), files, rules_run, summary, and status
("pass", "warn", or "fail").
Examples
res <- stat_lint_text("x <- rnorm(100)\n")
res
#> [FAIL] statci lint: 1 file(s), 20 rule(s) | 1 error(s), 0 warning(s), 0 info
#> ERROR <text:r>:1:6 (unseeded_randomness): Stochastic call `rnorm()` invoked
#> without a preceding `set.seed()` or `withr::with_seed()` call.