|
| 1 | +CONTRIBUTING |
| 2 | +================ |
| 3 | +Francisco Bischoff |
| 4 | +\- 28 Aug 2018 |
| 5 | + |
| 6 | +<!-- CONTRIBUTING.md is generated from CONTRIBUTING.Rmd Please edit that file --> |
| 7 | + |
| 8 | +## Contributing to tsmp |
| 9 | + |
| 10 | +First off, thanks for taking the time to contribute\! |
| 11 | + |
| 12 | +The goal of this guide is to help you contribute to tsmp as quickly and |
| 13 | +as easily possible. The guide is divided into two main pieces: |
| 14 | + |
| 15 | +1. Filing a bug report or feature request in an issue. |
| 16 | +2. Suggesting a change via a pull request. |
| 17 | + |
| 18 | +## Issues |
| 19 | + |
| 20 | +Before you file an issue: |
| 21 | + |
| 22 | +1. Check that you’re using the latest version of tsmp. It’s quite |
| 23 | + possible that the problem you’re experiencing has already been |
| 24 | + fixed. |
| 25 | + |
| 26 | +2. Spend a few minutes looking at the existing issues. It’s possible |
| 27 | + that your issue has already been filed. But it’s almost always |
| 28 | + better to open a new issue instead of commenting on an existing |
| 29 | + issue. The only exception is that you are confident that your issue |
| 30 | + is identical to an existing problem, and your contribution will help |
| 31 | + us better understand the general case. It’s generally a bad idea to |
| 32 | + comment on a closed issue or a commit. Those comments don’t show up |
| 33 | + in the issue tracker and are easily misplaced. |
| 34 | + |
| 35 | +When filing an issue, the most important thing is to include a minimal |
| 36 | +reproducible example so that we can quickly verify the problem, and then |
| 37 | +figure out how to fix it. There are three things you need to include to |
| 38 | +make your example reproducible: required packages, data, code. |
| 39 | + |
| 40 | +1. **Packages** should be loaded at the top of the script, so it’s easy |
| 41 | + to see which ones the example needs. Unless you’ve been specifically |
| 42 | + asked for it, please don’t include the output of `sessionInfo()` |
| 43 | + |
| 44 | +2. The easiest way to include **data** is to use `dput()` to generate |
| 45 | + the R code to recreate it. For example, to recreate the `mtcars` |
| 46 | + dataset in R, I’d perform the following steps: |
| 47 | + |
| 48 | + 1. Run `dput(mtcars)` in R |
| 49 | + 2. Copy the output |
| 50 | + 3. In my reproducible script, type `mtcars <-` then paste. |
| 51 | + |
| 52 | + But even better is if you can create a `data.frame()` with just a |
| 53 | + handful of rows and columns that still illustrates the problem. |
| 54 | + |
| 55 | +3. Spend a little bit of time ensuring that your **code** is easy for |
| 56 | + others to read: |
| 57 | + |
| 58 | + - make sure you’ve used spaces and your variable names are |
| 59 | + concise, but informative |
| 60 | + |
| 61 | + - use comments to indicate where your problem lies |
| 62 | + |
| 63 | + - do your best to remove everything that is not related to the |
| 64 | + problem. |
| 65 | + The shorter your code is, the easier it is to understand. |
| 66 | + |
| 67 | + Learn a little |
| 68 | + [markdown](https://help.github.com/articles/basic-writing-and-formatting-syntax/) |
| 69 | + so you can correctly format your issue. The most important thing is |
| 70 | + to surround your code with ` ``` R` and ` ``` ` so it’s syntax |
| 71 | + highlighted (which makes it easier to read). |
| 72 | + |
| 73 | +4. Check that you’ve actually made a reproducible example by using the |
| 74 | + [reprex package](https://github.com/jennybc/reprex). |
| 75 | + |
| 76 | +## Pull requests |
| 77 | + |
| 78 | + - Your pull request will be easiest for us to read if you use a common |
| 79 | + style: <http://r-pkgs.had.co.nz/r.html#style>. Please pay particular |
| 80 | + attention to whitespace. |
| 81 | + |
| 82 | + - You should always add a bullet point to `NEWS.Rmd` motivating the |
| 83 | + change. It should look like “This is what changed (@yourusername, |
| 84 | + \#issuenumber)”. Please don’t add headings like “bug fix” or “new |
| 85 | + features” - these are added during the release process. |
| 86 | + |
| 87 | + - If you can, also write a test. Do the best you can. |
| 88 | + |
| 89 | + - If you’re adding new parameters or a new function, you’ll also need |
| 90 | + to document them with [roxygen2](http://r-pkgs.had.co.nz/man.html). |
| 91 | + Make sure to re-run `devtools::document()` on the code before |
| 92 | + submitting. |
| 93 | + |
| 94 | +A pull request is a process, and unless you’re a practiced contributor |
| 95 | +it’s unlikely that your pull request will be accepted as is. Typically |
| 96 | +the process looks like this: |
| 97 | + |
| 98 | +1. You submit the pull request. |
| 99 | + |
| 100 | +2. We review at a high-level and determine if this is something that we |
| 101 | + want to include in the package. If not, we’ll close the pull request |
| 102 | + and suggest an alternative home for your code. |
| 103 | + |
| 104 | +3. We’ll take a closer look at the code and give you feedback. |
| 105 | + |
| 106 | +4. You respond to our feedback, update the pull request and add a |
| 107 | + comment like “PTAL” (please take a look). Adding the comment is |
| 108 | + important, otherwise we don’t get any notification that your pull |
| 109 | + request is ready for review. |
| 110 | + |
| 111 | +Don’t worry if your pull request isn’t perfect. It’s a learning process |
| 112 | +and we’ll be happy to help you out. |
| 113 | + |
| 114 | +Thanks\! |
0 commit comments