Contributing to r-smarter-api
Source:.github/CONTRIBUTING.md
Thank you for considering contributing to the r-smarter-api project!
How to contribute
- Bug reports: Open an issue describing the problem and steps to reproduce.
- Feature requests: Open an issue with a clear description of the feature and its motivation.
- Pull requests: Fork the repository, create a feature branch, commit your changes, and open a pull request.
Manage dependencies
Package dependencies are managed with renv. You need to clone the repository and restore the environment before working on the code:
renv::restore()NOTE: first time opening the project with RStudio or Positron may take a while as it needs to download and install the
renvdependency in the project folder. After that, your terminal will be able to use therenv::restore().
If you need to add or update a package dependency, use:
To download and install packages in the current renv lockfile: remember that a package will be snapshotted only if it is used in the code (i.e., loaded with library() or require()).
Tracking dependencies in DESCRIPTION
To ensure that all package dependencies are properly tracked, you should:
- Add the package to the
Importsfield in theDESCRIPTIONfile. - Run
renv::snapshot()to update the lockfile.
This can be done automatically by using the usethis package:
usethis::use_package("package_name")You can also specify the type of dependency (e.g., Suggests, Depends):
usethis::use_package("package_name", type = "Suggests")After adding the package, don’t forget to run:
renv::snapshot()Coding style
- Follow the tidyverse style guide (indentation, naming, spacing).
- Use
styler::style_pkg()to auto-format code. - Run
lintr::lint_package()to check for style issues.
Testing
- Add or update unit tests in
tests/testthat/for new features or bug fixes. - Run all tests with
devtools::test()before submitting. - A full check can be performed with
devtools::check().
Documentation
- Document all exported functions with roxygen2 comments.
- Update vignettes if your changes affect user workflows.
- Regenerate documentation with
devtools::document()andpkgdown::build_site()to update the website. - Preview changes with
pkgdown::preview_site().
README
README.md is generated from README.Rmd. To update it, edit README.Rmd and then run:
devtools::build_readme()Workflow
- Create an issue for significant changes in the repository.
- Fork and clone the repository.
- Create a new branch (e.g.
git checkout -b issue-<issue_number>). - Make your changes and commit them with clear messages.
- Run tests and check documentation.
- Open a pull request on GitHub.
Code of Conduct
Please be respectful and constructive. See CODE_OF_CONDUCT.md if available.