Skip to content

Commit e2ea7be

Browse files
authored
Merge pull request #146 from DoubleML/m-contr-guidelines
Contributing guidelines
2 parents 4e5c45a + ae8c58b commit e2ea7be

File tree

5 files changed

+364
-0
lines changed

5 files changed

+364
-0
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
^docs$
55
^pkgdown$
66
^README.Rmd
7+
^CONTRIBUTING.md
8+
^CODE_OF_CONDUCT.md
79
^\.github$
810
^codecov\.yml$
911
^doc$

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Thanks for contributing to DoubleML.
2+
Before submitting a PR, please take a look at our [contribution guidelines](https://github.com/DoubleML/doubleml-for-r/blob/master/CONTRIBUTING.md).
3+
Additionally, please fill out the PR checklist below.
4+
5+
### Description
6+
Please describe all changes and additions.
7+
In addition, you may want to comment on the diff in GitHub.
8+
9+
### Reference to Issues or PRs
10+
Add references to related issues or PRs here.
11+
12+
### Comments
13+
Here you can add further comments.
14+
You can also delete this section, if it is not necessary.
15+
16+
### PR Checklist
17+
Please fill out this PR checklist (see our [contributing guidelines](https://github.com/DoubleML/doubleml-for-r/blob/master/CONTRIBUTING.md#checklist-for-pull-requests-pr) for details).
18+
19+
- [ ] The title of the pull request summarizes the changes made.
20+
- [ ] The PR contains a detailed description of all changes and additions.
21+
- [ ] References to related issues or PRs are added.
22+
- [ ] The code passes `R CMD check` and all (unit) tests (see our [contributing guidelines](https://github.com/DoubleML/doubleml-for-r/blob/master/CONTRIBUTING.md#checklist-for-pull-requests-pr) for details).
23+
- [ ] Enhancements or new feature are equipped with unit tests.
24+
- [ ] The changes adhere to the "mlr-style" standards (see our [contributing guidelines](https://github.com/DoubleML/doubleml-for-r/blob/master/CONTRIBUTING.md#checklist-for-pull-requests-pr) for details).

CODE_OF_CONDUCT.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
22+
* Being respectful of differing opinions, viewpoints, and experiences
23+
24+
* Giving and gracefully accepting constructive feedback
25+
26+
* Accepting responsibility and apologizing to those affected by our mistakes,
27+
and learning from the experience
28+
29+
* Focusing on what is best not just for us as individuals, but for the
30+
overall community
31+
32+
Examples of unacceptable behavior include:
33+
34+
* The use of sexualized language or imagery, and sexual attention or
35+
advances of any kind
36+
37+
* Trolling, insulting or derogatory comments, and personal or political attacks
38+
39+
* Public or private harassment
40+
41+
* Publishing others' private information, such as a physical or email
42+
address, without their explicit permission
43+
44+
* Other conduct which could reasonably be considered inappropriate in a
45+
professional setting
46+
47+
## Enforcement Responsibilities
48+
49+
Community leaders are responsible for clarifying and enforcing our standards of
50+
acceptable behavior and will take appropriate and fair corrective action in
51+
response to any behavior that they deem inappropriate, threatening, offensive,
52+
or harmful.
53+
54+
Community leaders have the right and responsibility to remove, edit, or reject
55+
comments, commits, code, wiki edits, issues, and other contributions that are
56+
not aligned to this Code of Conduct, and will communicate reasons for moderation
57+
decisions when appropriate.
58+
59+
## Scope
60+
61+
This Code of Conduct applies within all community spaces, and also applies when
62+
an individual is officially representing the community in public spaces.
63+
Examples of representing our community include using an official e-mail address,
64+
posting via an official social media account, or acting as an appointed
65+
representative at an online or offline event.
66+
67+
## Enforcement
68+
69+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
70+
reported to the project maintainers.
71+
All complaints will be reviewed and investigated promptly and fairly.
72+
73+
All community leaders are obligated to respect the privacy and security of the
74+
reporter of any incident.
75+
76+
## Enforcement Guidelines
77+
78+
Community leaders will follow these Community Impact Guidelines in determining
79+
the consequences for any action they deem in violation of this Code of Conduct:
80+
81+
### 1. Correction
82+
83+
**Community Impact**: Use of inappropriate language or other behavior deemed
84+
unprofessional or unwelcome in the community.
85+
86+
**Consequence**: A private, written warning from community leaders, providing
87+
clarity around the nature of the violation and an explanation of why the
88+
behavior was inappropriate. A public apology may be requested.
89+
90+
### 2. Warning
91+
92+
**Community Impact**: A violation through a single incident or series
93+
of actions.
94+
95+
**Consequence**: A warning with consequences for continued behavior. No
96+
interaction with the people involved, including unsolicited interaction with
97+
those enforcing the Code of Conduct, for a specified period of time. This
98+
includes avoiding interactions in community spaces as well as external channels
99+
like social media. Violating these terms may lead to a temporary or
100+
permanent ban.
101+
102+
### 3. Temporary Ban
103+
104+
**Community Impact**: A serious violation of community standards, including
105+
sustained inappropriate behavior.
106+
107+
**Consequence**: A temporary ban from any sort of interaction or public
108+
communication with the community for a specified period of time. No public or
109+
private interaction with the people involved, including unsolicited interaction
110+
with those enforcing the Code of Conduct, is allowed during this period.
111+
Violating these terms may lead to a permanent ban.
112+
113+
### 4. Permanent Ban
114+
115+
**Community Impact**: Demonstrating a pattern of violation of community
116+
standards, including sustained inappropriate behavior, harassment of an
117+
individual, or aggression toward or disparagement of classes of individuals.
118+
119+
**Consequence**: A permanent ban from any sort of public interaction within
120+
the community.
121+
122+
## Attribution
123+
124+
This Code of Conduct is adapted from the Contributor Covenant [homepage](https://www.contributor-covenant.org),
125+
version 2.0, available at
126+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
127+
128+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
129+
enforcement ladder](https://github.com/mozilla/diversity).
130+
131+
For answers to common questions about this code of conduct, see the FAQ at
132+
https://www.contributor-covenant.org/faq. Translations are available at
133+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# DoubleML - Contributing Guidelines <a href="https://docs.doubleml.org"><img src="man/figures/logo.png" align="right" width = "120" /></a>
2+
3+
DoubleML is a community effort.
4+
Everyone is welcome to contribute.
5+
All contributors should adhere to this contributing guidelines
6+
and our [code of conduct](https://github.com/DoubleML/doubleml-for-r/blob/master/CODE_OF_CONDUCT.md).
7+
The contributing guidelines are particularly helpful to get started for your first contribution.
8+
9+
## Submit a Bug Report :bug:
10+
To submit a **bug report**, you can use our
11+
[issue template for bug reports](https://github.com/DoubleML/doubleml-for-r/issues/new/choose).
12+
13+
- A good bug report contains a **minimum reproducible code snippet**, like for example
14+
15+
```R
16+
library(DoubleML)
17+
library(mlr3)
18+
library(mlr3learners)
19+
library(data.table)
20+
set.seed(2)
21+
ml_g = lrn("regr.ranger", num.trees = 10, max.depth = 2)
22+
ml_m = ml_g$clone()
23+
obj_dml_data = make_plr_CCDDHNR2018(alpha = 0.5)
24+
dml_plr_obj = DoubleMLPLR$new(obj_dml_data, ml_g, ml_m)
25+
dml_plr_obj$fit()
26+
dml_plr_obj$summary()
27+
```
28+
29+
- State the **result you would have expected** and the **result you actually got**.
30+
In case of an exception the full traceback is appreciated.
31+
32+
- State the **versions of your code** by running the following lines and copy-paste the result.
33+
34+
```R
35+
sessionInfo()
36+
packageVersion('DoubleML')
37+
packageVersion('mlr3')
38+
```
39+
40+
## Submit a Feature Request :bulb:
41+
We welcome **feature requests and suggestions** towards improving and/or extending the DoubleML package.
42+
For feature requests you can use the corresponding
43+
[issue template](https://github.com/DoubleML/doubleml-for-r/issues/new/choose).
44+
45+
## Submit a Question or Start a Discussion
46+
We use **[GitHub Discussions](https://github.com/DoubleML/doubleml-for-r/discussions)** to give the community a platform
47+
for asking questions about the DoubleML package and for discussions on topics related to the package.
48+
49+
## Contribute Code :computer:
50+
Everyone is welcome to contribute to the DoubleML code base.
51+
The following guidelines and hints help you to get started.
52+
53+
### Development Workflow
54+
In the following, the recommended way to contribute to DoubleML is described in detail.
55+
If you are just starting to work with Git and GitHub, we recommend to read [Happy Git and GitHub for the useR](https://happygitwithr.com/index.html) and the [chapter on Git and GitHub](https://r-pkgs.org/git.html) in Hadley Wickham's book R Packages.
56+
The most important steps are: To **fork** the repo, then **add your changes** and finally submit a **pull-request**.
57+
1. **Fork** the [DoubleML repo](https://github.com/DoubleML/doubleml-for-r)
58+
by clicking on the Fork button (this requires a GitHub account).
59+
60+
2. **Clone** your fork to your local machine via
61+
```bash
62+
$ git clone git@github.com:YourGitHubAccount/doubleml-for-r.git
63+
$ cd doubleml-for-r
64+
```
65+
66+
3. Create a **feature branch** via
67+
```bash
68+
$ git checkout -b my_feature_branch
69+
```
70+
71+
4. (Optionally) you can add the `upstream` remote.
72+
```bash
73+
$ git remote add upstream https://github.com/DoubleML/doubleml-for-r.git
74+
```
75+
This allows you to easily keep your repository in synch via
76+
```bash
77+
$ git fetch upstream
78+
$ git merge upstream/master
79+
```
80+
81+
5. **Develop** your code changes. A helpful resource for package development in R
82+
is Hadley Wickham's [R Packages](https://r-pkgs.org/preface.html) and [rOpenSci Packages](https://devguide.ropensci.org/).
83+
The changes can be added and pushed via
84+
```bash
85+
$ git add your_new_file your_modified_file
86+
$ git commit -m "A commit message which briefly summarizes the changes made"
87+
$ git push origin my_feature_branch
88+
```
89+
90+
6. Generate a **pull request** from your fork.
91+
Please follow our guidelines for pull requests.
92+
When opening the PR you will be guided with a checklist.
93+
94+
### Checklist for Pull Requests (PR)
95+
- [x] The **title** of the pull request summarizes the changes made.
96+
97+
- [x] The PR contains a **detailed description** of all changes and additions
98+
(you may want to comment on the diff in GitHub).
99+
100+
- [x] **References** to related issues or PRs are added.
101+
102+
- [x] The code passes `R CMD check` and **all (unit) tests**.
103+
To check your code for common problems, run
104+
```R
105+
devtools::check()
106+
```
107+
By default, this runs all tests. In case you only want to run the tests, run
108+
```R
109+
devtools::test()
110+
```
111+
112+
- [x] If you add an **enhancements** or **new feature**, **unit tests**
113+
(with a certain level of coverage) are **mandatory** for getting the PR merged.
114+
115+
- [x] Check whether your changes adhere to the **"mlr-style" standards**.
116+
For the check you can use the following code
117+
```R
118+
require(styler)
119+
remotes::install_github("pat-s/styler@mlr-style")
120+
styler::style_pkg(style = styler::mlr_style) # entire package
121+
styler::style_file(<file>, style = styler::mlr_style) # specific file
122+
```
123+
124+
If your PR is still **work in progress**, please consider marking it a **draft PR**
125+
(see also [here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)).
126+
127+
### Unit Tests and Test Coverage
128+
We use the **testthat** package for unit testing.
129+
Unit testing is considered to be a fundamental part of the development workflow.
130+
We recommend to read the [chapter on testing](https://r-pkgs.org/tests.html) of Hadley Wickham's book R Packages.
131+
The tests are located in the `tests/testthat` subfolder.
132+
The test coverage is determined with the `covr` package.
133+
Coverage reports for the package, PRs, branches etc. are available from
134+
[codecov](https://app.codecov.io/gh/DoubleML/doubleml-for-r).
135+
It is mandatory to equip new features with an appropriate level of unit test coverage.
136+
To **run all unit tests** (for further option see the [devtools docu](https://devtools.r-lib.org/reference/test.html)) call
137+
```R
138+
devtools::test()
139+
```
140+
For a unit test coverage report you can run
141+
```R
142+
covr::report()
143+
```
144+
or, alternatively,
145+
```R
146+
devtools::test_coverage()
147+
```
148+
149+
### Contribute a New Model Class
150+
The **DoubleML package** is particularly designed in a flexible way to make it **easily extendable** with regard to
151+
**new model classes**.
152+
**Contributions** in this direction **are very much welcome**, and we are happy to help authors to integrate their models in the
153+
DoubleML OOP structure.
154+
If you need assistance, just open an issue or contact one of the maintainers
155+
[@MalteKurz](https://github.com/MalteKurz) or [@PhilippBach](https://github.com/PhilippBach).
156+
157+
The **abstract base class `DoubleML` implements all core functionalities** based on a linear Neyman orthogonal score
158+
function.
159+
To contribute a new model class, you only need to **specify all nuisance functions** that need to be estimated for the
160+
new model class (e.g. regressions or classifications).
161+
Furthermore, the **score components for the Neyman orthogonal score function need to be implemented**.
162+
All other functionality is automatically available via inheritance from the abstract base class.
163+
<!---TODO: Add a model template for the R package DoubleML
164+
A **template for new model classes** is available
165+
[here](https://github.com/DoubleML/doubleml-docs/blob/master/model_templates/double_ml_model_template.py).--->
166+
167+
## Contribute Documentation :books:
168+
169+
The **documentation** of DoubleML is generated with **roxygen2**. The corresponding website
170+
for the R API documentation is generated using **pkgdown** and hosted at
171+
[https://docs.doubleml.org/r/stable](https://docs.doubleml.org/r/stable/).
172+
The website [https:://docs.doubleml.org](https://docs.doubleml.org) is built with
173+
sphinx.
174+
The source code for the website, user guide, example gallery, etc. is available in a separate repository
175+
[https://github.com/DoubleML/doubleml-docs](https://github.com/DoubleML/doubleml-docs).
176+
177+
### Contribute to the API Documentation
178+
The **documentation** of DoubleML is generated with **roxygen2**. The corresponding website
179+
for the R API documentation is generated using **pkgdown**.
180+
To build the documentation of the package run
181+
```R
182+
devtools::document()
183+
```
184+
To build the documentation website, run (for more details, see the [pkgdown documentation](https://pkgdown.r-lib.org/))
185+
```R
186+
pkgdown::build_site()
187+
```
188+
189+
### Contribute to the User Guide and Documentation
190+
The **documentation of DoubleML** is hosted at [https://docs.doubleml.org](https://docs.doubleml.org).
191+
The **source code** for the website, user guide, example gallery, etc. is available in a **separate repository
192+
[doubleml-docs](https://github.com/DoubleML/doubleml-docs)**.
193+
Changes, issues and PRs for the documentation (except the API documentation) should be discussed in the
194+
[doubleml-docs](https://github.com/DoubleML/doubleml-docs) repo.
195+
We welcome contributions to the user guide, especially case studies for the
196+
[example gallery](https://docs.doubleml.org/stable/examples/index.html).
197+
A step-by-step guide for contributions to the example gallery is available
198+
[here](https://github.com/DoubleML/doubleml-docs/wiki/Contribute-to-our-Website-and-Example-Gallery).

README.Rmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ remotes::install_github("DoubleML/doubleml-for-r")
8080
* clusterGeneration
8181
* readstata13
8282

83+
## Contributing
84+
DoubleML is a community effort.
85+
Everyone is welcome to contribute.
86+
To get started for your first contribution we recommend reading our
87+
[contributing guidelines](https://github.com/DoubleML/doubleml-for-r/blob/master/CONTRIBUTING.md)
88+
and our
89+
[code of conduct](https://github.com/DoubleML/doubleml-for-r/blob/master/CODE_OF_CONDUCT.md).
8390

8491
## Citation
8592

0 commit comments

Comments
 (0)