Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 3.2 KB

CONTRIBUTING.md

File metadata and controls

67 lines (45 loc) · 3.2 KB

How to contribute code (DRAFT)

👍🎉 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.

Most changes to code should follow this route:

Open issue

  • 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

Install software

  • install Git on to your machine
  • install R
  • install Rstudio - recommended - other editors are available

Create new branch

Following discussion around the issue:

  • If you have admin/contributor rights on aquaMetrics team, you can create a new branch there. Click 'Branch: ...' button on the main repository page.
  • Or otherwise clone the repository to your local machine:
git clone https://github.com/aquaMetrics/phytobenthosMetrics
cd phytobenthosMetrics/
git checkout -b issue-??

(Replacing ?? with the issue number found on Github)

The first two lines above will clone the repository and open the directory where the files have been copied to. The last line will 'checkout' and create new branch called issue-...so you can now start work editing your new branch.

Or using RStudio, use open > new project > version control > paste url:

https://github.com/aquaMetrics/phytobenthosMetrics

  • If you created the branch on Github remember to Pull to Rstudio and change into that branch using the 'Git' panel

Coding style

  • Do some coding and/or write documentation etc
  • Add comments as required to explain the why rather than the how
  • Not every line needs comments - but any large or unusual sections
  • Document code and follow standard CRAN checks and file structure
  • R Package guidance is a very useful resource
  • Run checks and tests locally - before commit (this includes standard lintr rules with exception that camel case is used for function/variable names e.g. 'coolFunction' not 'cool_function')
  • Recommend downloading lintr from Github. The CRAN package appears out of date and doesn't work on Windows:
    library(devtools)
    install_github(jimhester/lintr)

Commit

  • Commit message should reference the issue number e.g. 'docs: closes #1'
  • Not sure how to write a commit message? Try to use this commit message guidance, although this is not enforced.
  • Push changes to remote branch

Pull request

  • On Github create a Pull Request to master branch from your issue-?? branch
  • Wait for a maintainer to review, they will check no tests break, and the code has been tested if required
  • Changes are merged to master and the 'test-1' branch deleted.

All Done! ☺