Skip to content

Commit 59094fe

Browse files
committed
Add point about commenting
1 parent 33699c7 commit 59094fe

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

.github/CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ This project is intended to contain high quality implementations of data structu
22

33
If you are planning to add a new module (data structure or algorithm), you may want to open an issue to discuss your plan with the project maintainer first. This will avoid wasted effort on your part.
44

5-
If you are planning to submit a pull request, please ensure that your change:
5+
If you are planning to submit a pull request, please ensure that your code:
66
* Is written in the C programming language.
77
* Conforms to the project's [style guidelines](../STYLE.md).
88
* Does not duplicate existing code already present.
99
* Passes all unit test checks (existing code). Run `make check` to confirm.
1010
* Adds unit tests (new code) with at least 95% coverage. Build with `configure –enable-coverage` to confirm.
11+
* Is appropriately commented using full English sentences.
1112
* Is properly documented using Doxygen comments.
1213

1314
Automated continuous integration checks will fail for many of the above requirements if they are not satisfied.

.github/pull_request_template.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ This project is intended to contain high quality implementations of data structu
55
66
If you are planning to add a new module (data structure or algorithm), you may want to open an issue to discuss your plan with the project maintainer first. This will avoid wasted effort on your part.
77
8-
Before filing your pull request, please ensure that your change:
8+
Before filing your pull request, please ensure that your code:
99
* Is written in the C programming language.
1010
* Conforms to the project's style guidelines (see STYLE.md).
1111
* Does not duplicate existing code already present.
1212
* Passes all unit test checks (existing code). Run `make check` to confirm.
1313
* Adds unit tests (new code) with at least 95% coverage. Build with `configure –enable-coverage` to confirm.
14+
* Is appropriately commented using full English sentences.
1415
* Is properly documented using Doxygen comments.
1516
1617
Automated continuous integration checks will fail for many of the above requirements if they are not satisfied.
17-
18+
-->

STYLE.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,23 @@ Tests should [cover](https://en.wikipedia.org/wiki/Code_coverage) at least
5959
95% of lines. Configure the project using `./configure --enable-coverage` and
6060
then run `make check`.
6161
62-
## Documentation
62+
## Comments
6363
64+
Code should be commented using full English sentences. In general, try not to
65+
document "what" the code is doing, but rather the "how" and "why". Most people,
66+
for example, would agree that the following is an example of a comment that is
67+
not useful:
68+
```c
69+
/* Free the node */
70+
free(node);
71+
```
72+
The following is a comment that is more enlightening to the reader:
73+
```c
74+
/* The node to be removed must be swapped with an "adjacent"
75+
* node, ie. one which has the closest key to this one. Find
76+
* a node to swap with. */
77+
swap_node = avl_tree_node_get_replacement(tree, node);
78+
```
6479
All public interfaces must be documented using
6580
[Doxygen](https://www.doxygen.nl/). For example:
6681
```c

0 commit comments

Comments
 (0)