Skip to contents

Thank you for helping with stagemap. It is an R package for relation maps: things placed by stage and lane, joined by links whose kind means something, shown in Shiny apps, Quarto documents and pkgdown sites. It is in early development. What is in scope, and what is not, is in docs/scope.md. To report a bug or suggest an idea, open an issue with one of the issue forms.

Setup

  • R: the current release is recommended. The package needs R 4.1 or later.
  • Dev packages: from the package root, run pak::local_install_dev_deps() (or devtools::install_dev_deps()).
  • Air, the formatter for R code: https://posit-dev.github.io/air/. Use version 0.11.0, the one CI uses.
  • Biome, the formatter and linter for JavaScript and CSS in inst/: https://biomejs.dev. Use version 2.5.14.
  • The gate’s packages: devtools, roxygen2, lintr, spelling and jsonlite; also covr, callr and withr for the tests mode, and rcmdcheck, pkgbuild and processx for full. If one is missing, the gate stops and names it.
  • Google Chrome or Chromium, for the shinytest2 tests.
  • Git worktrees: if you use renv, it keeps a package project’s library outside the repository, so in a worktree set R_LIBS to the path that Rscript -e 'cat(.libPaths()[1])' prints in the main checkout.

Workflow

  1. Start with an issue, using an issue form. State the goal and a “done when” checklist. One issue per piece of work; ask first if the change is large. Keep its description current when scope or decisions change, and add dated progress comments. Tick the items a PR delivers; say what stays open and where it went.
  2. Make a branch from main for that issue.
  3. Commit with Conventional Commits, short: feat:, fix:, docs:, chore:, test:, ci:, refactor:. Follow the Public text rules.
  4. Open a pull request using the template. Keep the sections that apply. Follow its checks table for repeatable commands and put one-off observations in Notes.
  5. Suggest labels in the pull request: one type (enhancement, bug, documentation, chore) and one or more area: *. The package creator applies them; the release notes are built from them.
  6. The package creator merges once CI is green. Pull requests are squash-merged, so the pull request title becomes the commit message on main: keep it a Conventional Commit.

Update every text that describes what you changed, in the same pull request: help pages (through roxygen), articles, the README, NEWS.md and the examples; workflow comments, tools/README.md, .github/workflows/README.md, tests/testthat/README.md and the rules files; and any other page, function or file that describes the behaviour, including ones added later. It works both ways: if you edit an article, guide or example, check that the help page still agrees. Search the repository for the old wording and list the search terms in the pull request.

Changes reach main through pull requests, and a ruleset stops anyone from force-pushing to main or deleting it. Never force-push, push to main, or use --no-verify. Never edit renv/ or LICENSE by hand. Generated documentation follows the roxygen rules. CI on a pull request from a fork waits for a maintainer to approve the run. Leave “Allow edits by maintainers” on, so a maintainer can fix a small thing (a typo or a failing format check) on your branch.

Stacked pull requests are fine. Base the second one on the branch below it, and say so in its description.

Before you open a pull request

Run the quality gate from the package root. It is launchR’s gate, the same one CI’s checks use; tools/README.md says how to run it (from a clone of launchR, or downloaded at the version CI uses), and its modes, options and exit codes. The modes:

gate fast     # before every commit
gate tests    # tests and coverage: before a pull request that touches R/ or tests/
gate full     # everything, including the built tarball: before a release

It needs the packages listed under Setup.

  • fast checks formatting (Air and Biome), that man/ and NAMESPACE match the roxygen2 comments, lint, that every export has @returns, spelling, and R CMD check --as-cran without the tests.
  • tests runs the tests once under covr with NOT_CRAN=true, so the Chrome tests run, and that run gives the coverage. Coverage must be at least 70%.
  • The gate prints one PASS, FAIL or SKIP line for each step, then a summary, and keeps a run folder with one log per step (its path is printed). Open a log only for a failing step.
  • Unknown words fail the spelling step: list them in your PR; the package creator adds agreed ones to inst/WORDLIST.
  • The docs step runs devtools::document() and may update man/, NAMESPACE or DESCRIPTION. If it fails, review the regenerated files and commit them with the source; see the roxygen rules.
  • If the gate itself gets something wrong, open an issue in launchR, where it is maintained (CI rules).

CI requirements are in the CI rules; local gate results do not replace CI.

Code in short

The standards explain the reasons and sources behind these rules.

  • Check arguments with checkmate and use cli for messages; see the R code rules.
  • Call other packages with pkg::fn() and follow the dependency rules.
  • Write help and offline examples with roxygen2; regenerate help pages and NAMESPACE using the documentation rules.
  • Keep JavaScript and CSS in inst/ plain and readable. Bundle what the package needs; do not load anything from a CDN.
  • Accessibility: meaning never rests on colour alone (a link kind also has its line style or mark). Honour prefers-reduced-motion.

Tests

Tests use testthat in BDD style, one test file per R file (plus -browser, -snap and -extended files for the tests CRAN skips), with coverage at least 70%: see the test rules. How the tests are organised, and how to run them as CRAN does: tests/testthat/README.md.

NEWS.md

Add one bullet for each user-facing change, in the same pull request. Write it for users, in the present tense, start with the function or feature, and end with the issue number:

* `sm_trace()` gains a `depth` argument (#123).

Where new bullets go and what is left out: the NEWS rules. Release headings and versions belong to the package creator (release rules).

Licence of contributions

Contributions use the package’s MIT licence: by opening a pull request you agree that your change is released under it. You keep the copyright in what you wrote and release it under the same MIT terms. Before adding third-party files, follow the bundled-file rules.

The drawing engine in inst/kit/ is built elsewhere and copied in by tools/copy-kit.R; it is never edited here. To report a problem with how a map is drawn, open an issue. A pull request that edits inst/kit/ cannot be merged.

Conduct and data

Everyone taking part follows the code of conduct. Be kind and patient, and give feedback on the work, not the person. For a security problem, do not open an issue; follow the security policy. For questions, use Discussions rather than an issue.

Use the Public text rules for examples, data and screenshots.