This outlines how to propose a change to fusen.
We are open to any contribution, from typos to new features. We will guide you throughout the process and make you in a safe position to contribute, whatever is your level in R programming.
Package 'fusen' is used to build the code base and documentation of 'fusen'. 'fusen' is a package that provides a framework for building R packages from a Rmarkdown file (or Quarto file). See documentation of 'fusen' for more details: https://thinkr-open.github.io/fusen
We are here to help.
If you know how to modify a package without 'fusen', contribute as you would do normally.
Forget the flat files for a moment. A 'fusen' package is still a classical package if you remove the "dev/" directory. There is no difference.
Open a Pull Request and we will help you to integrate your contribution in the 'fusen' framework.
-
Most of modifications can be realized by modifying a 'flat' file in the "dev/" directory. Then, run
fusen::inflate_all()
to generate the corresponding R, test or vignette files. -
You can see the list of all
active
flat files and the corresponding generated files by opening the "dev/config_fusen.yaml" file. There is one section for each flat file. -
You will see text like
"# WARNING - Generated by 'fusen' from dev/flat_***.Rmd: do not edit by hand"
on the top of all generated R, test or vignette files, when they are actually generated by 'fusen'. All other file, not generated by 'fusen', should be listed under the"keep"
section in the "dev/config_fusen.yaml" file. You can runfusen::check_not_registered_files()
to check if that's the case.
- You will find the roxygen skeleton in the corresponding
function
chunk - Text of the vignette is generally the text between chunk of the flat file
We recommend a test driven development approach:
- Write or modify a unit test in the corresponding
test
chunk of the function - Modify the code of the function in the corresponding
function
chunk - Run the 'inflate' command at the bottom of the flat file
- Run
devtools::test()
to check if the test is passing
To avoid multiple inflates, you can run the code locally
- Instead of inflating, run
fusen::load_flat_functions()
to load the function of the current flat file in your global environment - Run your tests line by line from the
test
chunk - You can also use your favorite debuging tools
You can fix typos, spelling mistakes, or grammatical errors in the documentation directly using the GitHub web interface, as long as the changes are made in the source file.
This generally means you'll need to edit roxygen2 comments in an .R
, not a .Rd
file.
You can find the .R
file that generates the .Rd
by reading the comment in the first line.
If you want to make a bigger change, it's a good idea to first file an issue and make sure someone from the team agrees that it’s needed. If you’ve found a bug, please file an issue that illustrates the bug with a minimal reprex (this will also help you write a unit test, if needed).
-
Fork the package and clone onto your computer. If you haven't done this before, we recommend using
usethis::create_from_github("ThinkR-open/fusen", fork = TRUE)
. -
Install all development dependences with
devtools::install_dev_deps()
, and then make sure the package passes R CMD check by runningdevtools::check()
. If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing. -
Create a Git branch for your pull request (PR). We recommend using
usethis::pr_init("brief-description-of-change")
. -
Make your changes
-
Open the dev/dev_history.R file:
rstudioapi::navigateToFile("dev/dev_history.R")
Find the "# Dependencies ----" part and run theattachment::att_amend_desc(...)
as presented there. This will update documentation and list of dependencies in DESCRIPTION with the ones needed by {fusen}. -
Commit to git, and then create a PR by running
usethis::pr_push()
, and following the prompts in your browser. The title of your PR should briefly describe the change. The body of your PR should containFixes #issue-number
. -
For user-facing changes, add a bullet to the top of
NEWS.md
(i.e. just below the first header). Follow the style described in https://style.tidyverse.org/news.html.
-
New code should follow the tidyverse style guide. You can use the styler package to apply these styles, but please don't restyle code that has nothing to do with your PR.
-
We use roxygen2, with Markdown syntax, for documentation.
-
We use testthat for unit tests. Contributions with test cases included are easier to accept.
Please note that the fusen project is released with a Contributor Code of Conduct. By contributing to this project you agree to abide by its terms.