Contributing to ofemeantest
Source:CONTRIBUTING.md
Thanks for your interest in improving the package. This document covers the local dev setup we expect contributors to have before opening a PR.
Development setup
-
Clone and open the project in your R IDE:
-
Install the dev dependencies (one-off):
install.packages(c("devtools", "roxygen2", "testthat", "pkgdown")) -
Enable the project’s git hooks (one-off per clone). This points git at the versioned
.githooks/directory so the pre-push check runs on everygit push:You can verify it took effect with
git config --get core.hooksPath(should print.githooks).
What the pre-push hook does
Before every git push the hook runs devtools::document() and checks whether anything in man/, NAMESPACE or DESCRIPTION changed. If it did, the push is blocked with a list of files to commit. This prevents the most common source of “stale docs” PRs — editing a roxygen comment in R/foo.R and forgetting to regenerate the .Rd.
To bypass the hook for a single push (e.g., emergency hotfix where the doc regen is unrelated):
The same check runs in GitHub Actions on every PR (.github/workflows/document.yaml), so even pushes that bypass the local hook will be caught at review time.
Running tests locally
devtools::test() # run testthat suite
devtools::check() # full R CMD check
pkgdown::build_site() # rebuild the docs site under docs/The docs/ directory is gitignored — it’s only used for local preview and is rebuilt by CI on push to main.
Style
- Keep functions documented with roxygen2; mark internals with
@keywords internal. - Add tests for new public behaviour. Contract tests in
tests/testthat/test-dependency-contracts.Rguard the interfaces we rely on fromspdep,spatialreg,permucoandmultcompView— add a new entry there when you start depending on a new upstream function. - Prefer base R over
dplyr/tidyrto keep the Imports list small.