Contributing to pdfium
Source:CONTRIBUTING.md
Thanks for your interest in contributing.
Quick start
git clone https://github.com/humanpred/rpdfium
cd rpdfium
# Install Python pre-commit (one-time, per clone)
pip install --user pre-commit
pre-commit install
pre-commit install --hook-type pre-push
# Install R dev dependencies
Rscript -e 'install.packages(c("devtools","testthat","covr","lintr","styler","withr","roxygen2"))'
# Configure the package (downloads the bblanchon PDFium binary)
R CMD INSTALL .
# Run the test suite (parallel, per worker)
Rscript -e 'devtools::test()'Workflow
- Create a feature branch (
claude/...for AI-authored,feature/...otherwise) offmain. Never push tomaindirectly. - Make your change. Add or update tests for every behavioural change.
- Run
pre-commit run --all-filesuntil it passes. - Run
devtools::check()(orR CMD check --as-cran .) and confirm zero errors / zero warnings. - Run
covr::package_coverage()and confirm R coverage stays at 100%. Untestable code paths must be marked# nocov start/# nocov endwith a comment explaining why. - Push your branch and open a pull request using the template at
.github/PULL_REQUEST_TEMPLATE.md.
Commit messages
We follow Conventional Commits:
feat: short summary in imperative mood
Optional longer body. Reference issues with "Closes #N".
Allowed types: feat, fix, docs, chore, test, refactor, perf, ci, build, style, revert. Subject line under 70 chars.
Architectural decisions
Material decisions (API shape, dependencies, binary distribution, memory model) are recorded as Architecture Decision Records under dev/decisions/. Use the template at dev/decisions/ADR-000-template.md. ADRs are immutable once accepted — supersede with a new ADR that references the old.
Pre-commit fast / slow stages
The .pre-commit-config.yaml splits hooks into two stages:
-
pre-commitruns on everygit commit. Fast checks: lintr, styler, parsable-R, spell-check, header sanity. Optimized for tight feedback. -
pre-pushruns only when yougit push. Slower checks: roxygen regeneration, full lint, parallel testthat run. Slow enough that we don’t want it on every commit but cheap enough to run before the branch leaves your machine.
If a pre-push hook fails, fix the issue and create a new commit — don’t --amend (that complicates code review).