Skip to content

Commit 55ff323

Browse files
committed
Update CONTRIBUTING.md
1 parent 9ffc6dd commit 55ff323

File tree

1 file changed

+108
-74
lines changed

1 file changed

+108
-74
lines changed

CONTRIBUTING.md

+108-74
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,46 @@ Send your PR! Thanks!
77
## Slightly more Details
88

99
You want to contribute? Awesome! Small changes, like fixing typos in
10-
documentation are completely fine and also most welcome. For bigger
11-
changes, we suggest that you open an issue before you start coding, so that
12-
we can maximize the probability that we can successfully merge in your
13-
code.
10+
documentation are completely fine and also most welcome. For bigger changes, we
11+
suggest that you open an issue before you start coding, so that we can maximize
12+
the probability that we can successfully merge in your code.
1413

1514
## R or C
1615

1716
This guide is for the igraph R package, but note that the package uses the
1817
igraph C library internally for most things. If your changes involve the C
19-
library as well, then you need to make those changes first, in the repository
20-
of the C library: https://github.com/igraph/igraph.
18+
library as well, then you need to make those changes first, in the repository of
19+
the C library: https://github.com/igraph/igraph.
2120

2221
## Development and Compilation
2322

24-
All development is being done on the default branch, so that it can be
25-
automatically installed using `remotes::install_github("igraph/rigraph")`
26-
or `pak::pak("igraph/rigraph")` . Some parts of the code (sources for the
27-
C library, `.Rd` documentation files, ...) are stored redundantly
28-
and updated by running `make` or `make igraph`.
29-
30-
If you clone the repository, you can locally build and test the `igraph`
31-
package using the `testthat` package as follows:
32-
33-
```R
34-
testthat::test_local()
35-
```
23+
All development is being done on the default branch so that it can be
24+
automatically installed using `remotes::install_github("igraph/rigraph")` or
25+
`pak::pak("igraph/rigraph")`. If you have the stable version of igraph already
26+
installed, you can avoid conflicts by installing the development version in its
27+
own directory, e.g. `remotes::install_github("igraph/rigraph", lib =
28+
"~/testing/")`. Then, to load the development version in an R session, use
29+
`library(igraph, lib.loc = "~/testing/")`. Remove the development version with
30+
`remove.packages("igraph", lib = "~/testing/")`.
31+
32+
You can locally build and test the `igraph` package as follows. From an R
33+
process running in the local `./rigraph` directory, run `pkgload::load_all()` to
34+
compile the cloned version of igraph and load it for use in the current
35+
session. You can run the package tests with `testthat::test_local()`. If your
36+
change includes updates to the documentation, also run `devtools::document()` to
37+
update the package documentation. Note that you can either clone the package and
38+
locally build it with `pkgload::load_all()` _or_ install the package from GitHub
39+
with `remotes::install_github()`---you do not need to do both. You can keep your
40+
local clone up to date with `git` tools, or remove it by deleting the local
41+
`./rigraph` directory.
42+
43+
### Windows
3644

3745
When building from source on Windows, you need to have
3846
[RTools](https://cran.r-project.org/bin/windows/Rtools/) installed.
39-
Additionally, the two system requirements of `glpk` and `libxml2` are
40-
not optional, but hard requirements. For version R >= 4.0 you can install these
41-
two from an RTools terminal using
47+
Additionally, the two system requirements of `glpk` and `libxml2` are not
48+
optional, but hard requirements. For version R >= 4.0 you can install these two
49+
from an RTools terminal using
4250

4351
```sh
4452
pacman -Sy mingw-w64-{i686,x86_64}-glpk mingw-w64-{i686,x86_64}-libxml2
@@ -55,83 +63,109 @@ directly to the branch that is being tested.
5563

5664
## Making Trivial Changes
5765

58-
- Then look for the file you want to modify.
59-
- Click on the edit symbol (pen) on the upper right corner of the file
60-
view.
66+
- [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the
67+
repository. You should have a copy of `/rigraph` under your username, at
68+
`https://github.com/<username>/rigraph`.
69+
- In _your_ forked repository, look for the file you want to modify.
70+
- Click on the edit symbol (pen) on the upper right corner of the file view.
6171
- Make your edits.
62-
- Write a short commit message, less than 65 characters. E.g. "Fix manual
63-
page typo" or "Fix degree bug for loops". If needed, elaborate your
64-
changes below in the "extended description" field.
72+
- Write a short commit message, less than 65 characters. E.g. "Fix manual page
73+
typo" or "Fix degree bug for loops". If needed, elaborate your changes below
74+
in the "extended description" field.
6575
- Commit your changes.
66-
- Go back to the start page of _your_ forked repository. It is at
67-
`https://github.com/<username>/rigraph`.
68-
- Click on the green button before the branch name to create a pull
69-
request.
76+
- Go back to the start page of your forked repository.
77+
- Click on the green button before the branch name to create a pull request.
7078
- Click on "Create pull request".
71-
- Provide a more detailed description if you like. Please also indicate
72-
that you are fine with licensing your contribution under igraph's license
73-
(see Legal Stuff below).
79+
- Provide a more detailed description if you like. Please also indicate that you
80+
are fine with licensing your contribution under igraph's license (see Legal
81+
Stuff below).
7482
- Click on "Create pull request".
75-
- That's it! It is probably a good idea to keep your forked repository
76-
until the change is accepted into igraph, in case you need to modify it.
77-
- Now you need to wait for us, unfortunately. Please ping us, if it takes
78-
long to respond. E.g. a week is considered to be long.
83+
- That's it! It is probably a good idea to keep your forked repository until the
84+
change is accepted into igraph, in case you need to modify it.
85+
- Now you need to wait for us, unfortunately. Please ping us, if it takes long
86+
to respond. E.g. a week is considered to be long.
7987
- Once your pull request is accepted, you can delete your forked repository.
8088

8189
## Making More Involved Changes
8290

83-
This is mostly the same as for trivial changes, but you probably want to
84-
edit the sources on your computer, instead of online on GitHub.
85-
86-
- Open an issue in the issue tracker about the proposed changes. This is
87-
not required for smaller things, but I suggest you do it for others. Just
88-
in case somebody is already working on the same thing, or it is something
89-
we don't want in igraph.
90-
- Fork the repository, and clone it to the machine you'll work on.
91-
- Make sure you work on the `dev` branch, or alternatively, create a new branch
92-
based on the `dev` branch.
93-
- Once ready with your changes, build igraph, and run the tests as indicated above.
94-
- Submit your pull request.
95-
- Now you need to wait for us, unfortunately. Please ping us, if it takes
96-
long to respond. E.g. a week is considered to be long.
91+
This is mostly the same as for trivial changes, but you probably want to edit
92+
the sources on your computer, instead of online on GitHub. If you are unfamiliar
93+
with cloning repositories from GitHub, the manual
94+
[page](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories)
95+
for working with remote repositories is a good place to start. There is also a
96+
more general introduction page
97+
[here](https://docs.github.com/en/get-started/quickstart), which includes
98+
information on setting up
99+
[`git`](https://docs.github.com/en/get-started/quickstart/set-up-git). The `git`
100+
manual is [here](https://www.git-scm.com/docs). R development environments may
101+
also include support for `git`/GitHub integration (for an introduction to the
102+
RStudio tools, see this
103+
[tutorial](https://geo.uzh.ch/microsite/reproducible_research/post/rr-rstudio-git/);
104+
Emacs/ESS users can use [Magit](https://magit.vc/)).
105+
106+
- Open an issue in the issue tracker about the proposed changes. This is not
107+
required for smaller things, but we suggest you do it for others. Just in case
108+
somebody is already working on the same thing, or it is something we don't
109+
want in igraph.
110+
- Fork and clone the repository. If you have already forked the repository,
111+
synch your forked copy to get the latest version of the `main` branch, then
112+
fetch the updated `main` to your local clone.
113+
- Make changes to the appropriate files in the local clone.
114+
- Once ready with your changes, build igraph and run the tests as indicated
115+
above.
116+
- Commit your changes to a new branch. Give the branch a descriptive name that
117+
is specific to the changes you want to make. Then, push those changes to your
118+
forked copy of igraph on GitHub.
119+
- Submit your pull request to the main branch. You should see text similar to
120+
"`<username>` wants to merge 1 commit into `igraph:main` from
121+
`<username>:fix-some-func`". If your pull request relates directly to an issue
122+
(e.g., if you opened an issue to discuss the proposed changes), include the
123+
keyword "fix" and the issue number (e.g., "Fix #123) on its own line in your
124+
initial comment for the pull request. This step supports better issue
125+
tracking; for a list of keywords, see
126+
[here](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).
127+
- Now you need to wait for us, unfortunately. Please ping us, if it takes long
128+
to respond. E.g. a week is considered to be long.
97129

98130
## Writing igraph Code
99131

100-
Some tips on writing igraph code. In general, look at how things are done,
101-
and try to do them similarly. (Unless you think they are not done well, in
102-
which case please tell us.)
132+
Some tips on writing igraph code. In general, look at how things are done, and
133+
try to do them similarly. (Unless you think they are not done well, in which
134+
case please tell us.)
103135

104136
### Code Formatting
105137

106138
We follow the [tidyverse style guide](https://style.tidyverse.org/) for
107-
formatting. The styler package helps apply this style to the code.
108-
Look at the style (indentation, braces, etc.) of some recently committed
109-
bigger change, and try to mimic that.
139+
formatting. The [styler package](https://styler.r-lib.org/) helps apply this
140+
style to the code (see also the [lintr package](https://lintr.r-lib.org/)).
141+
Look at the style (indentation, braces, etc.) of some recently committed bigger
142+
change, and try to mimic that.
110143

111144
### Documentation
112145

113-
Please document your new functions using `roxygen2`, and run `devtools::document()`
114-
or `make igraph` to update the `.Rd` files.
146+
Please document your new functions using
147+
[roxygen2](https://roxygen2.r-lib.org/), and run `devtools::document()` or `make
148+
igraph` to update the `.Rd` files.
115149

116150
### Test Cases
117151

118-
Unless you change something trivial, please consider adding test cases.
119-
This is important! See the files in the `inst/tests` directory for
120-
examples.
152+
Unless you change something trivial, please consider adding test cases. This is
153+
important! See the files in the `./rigraph/tests/testthat` directory for
154+
examples. See the r-utils package [testthat](https://testthat.r-lib.org/) for
155+
some unit testing support functions.
121156

122157
### Ask Us!
123158

124-
In general, if you are not sure about something, please ask! You can
125-
open an issue on Github, write to the igraph-help mailing list (see the
126-
homepage at http://igraph.org), or write to Tamás and Gábor. We prefer
127-
the public forums, though, because then others can learn from it, too.
159+
In general, if you are not sure about something, please ask! You can open an
160+
issue on Github, write to the igraph-help mailing list (see the homepage at
161+
http://igraph.org), or write to Tamás and Gábor. We prefer the public forums,
162+
though, because then others can learn from it, too.
128163

129164
## Legal Stuff
130165

131-
This is a pain to deal with, but we can't avoid it, unfortunately. So,
132-
igraph is licensed under the "General Public License (GPL) version 2, or
133-
later". The igraph manual is licensed under the "GNU Free Documentation
134-
License". If your contribution is bigger than a typo fix, then please
135-
indicate that you are fine with releasing your code/text under these
136-
licenses. E.g. adding a sentence that reads as "I'm fine with GPL 2 or
137-
later and FDL." is perfectly enough.
166+
This is a pain to deal with, but we can't avoid it, unfortunately. So, igraph is
167+
licensed under the "General Public License (GPL) version 2, or later". The
168+
igraph manual is licensed under the "GNU Free Documentation License". If your
169+
contribution is bigger than a typo fix, then please indicate that you are fine
170+
with releasing your code/text under these licenses. E.g. adding a sentence that
171+
reads as "I'm fine with GPL 2 or later and FDL." is perfectly enough.

0 commit comments

Comments
 (0)