👍🎉 Hello and a warm welcome to guidelines for contributing code! 🎉👍
Thanks for taking the time to read these guidelines. This helps keep this code repository easy to maintain and the code easy to follow. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
- Open an issue and describe what your update is planning to address.
- It's usually helpful to include a worked example of the update or issue.
- If you are not a maintainer, wait for feedback and comments - maybe there are different approaches that need exploring.
- Go to https://github.com/aquaMetrics/rict and click 'fork' in top right.
- Sign-up to R Studio Cloud.
- Click on New Project dropdown menu and select 'New Project from Git repo'.
- Paste
https://github.com/YOUR-GITHUB-USERNAME/rict
. - replaceYOUR-GITHUB-USERNAME
or navigate to the forked repo you on your profile and copy paste URL. - You can now make changes to the files - look in the 'Files' tab and look for 'R' folder where most R code is held.
- Add
browser()
to the line above where you wish to add a breakpoint in the code/function. - Now run the function, try typing in the console:
rict(observed_demo_values)
- this will run most functions in the package. - The code will break where you added the
browser()
and you can investigate the values and see what needs changing etc. - Make changes as required then 'Install and Restart'.
- Once you are happy with the code, go to 'Commit' section below.
- Install Git on to your machine.
- Install R.
- Install Rstudio - recommended - other editors are available.
- Click on New Project dropdown menu and select 'New Project from Git repo'.
- Follow instructions in 'Via the Cloud' section above from number 5.
- In the 'Git' panel commit select all the files you changes and click commit.
- Add a commit message which should reference the issue number e.g. 'docs: closes #1'- the '#1' is the issue number
- Not sure how to write a commit message? Try to use this commit message guidance, although this is not enforced.
- Select 'Push' changes.
- On your github profile page select the forked rict repo. This will now include the recent changes you made.
- Near the top there is an option to create pull request (PR).
- Select create pull request and enter message reference issue number '#1' that it fixes.
- The PR will be submitted and testing automatically run.
- Wait for response from maintainers.
- Add comments as required to explain the why rather than the how.
- Not every line needs comments - but any large or unusual sections.
- R Package guidance is a very useful resource for writing packages.
- Linting / styling code is not enforced but easy to do.
- Install styler package.
- Run styler to from 'Addins' menu.
- Testing allows check coding 'style' with rules from lintr package.
- But linting/style is not enforced (so failures are okay but not desired).
- Document code and follow standard CRAN checks and file structure
devtools::check()
. - Run tests locally - before commit
devtools::test()
. - See .lintr file for exact linting rules applied during testing.