Skip to content

Commit 08157c4

Browse files
authored
[feat/fix]: Improve the contributing guidelines (#839)
Mostly all of the changes are taken from TheAlgorithms/C-Plus-Plus#1503.
1 parent 373f9c4 commit 08157c4

File tree

1 file changed

+33
-42
lines changed

1 file changed

+33
-42
lines changed

CONTRIBUTING.md

+33-42
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,57 @@
22

33
## Before contributing
44

5-
Welcome to [TheAlgorithms/C](https://github.com/TheAlgorithms/C)! Before submitting pull requests, please make sure that you have **read the whole guidelines**. If you have any doubts about this contribution guide, please open [an issue](https://github.com/TheAlgorithms/C/issues/new/choose) and clearly state your concerns.
5+
Welcome to [TheAlgorithms/C](https://github.com/TheAlgorithms/C)! Before submitting pull requests, please make sure that you have **read the whole guidelines**. If you have any doubts about this contribution guide, please open [an issue](https://github.com/TheAlgorithms/C/issues/new/choose) or ask in our [Discord server](https://discord.gg/c7MnfGFGa6), and clearly state your concerns.
66

77
## Contributing
88

9-
### Maintainer/developer
9+
### Maintainer/reviewer
1010

11-
If you are a maintainer of this repository, please consider the following:
12-
13-
- It is a protocol to contribute via pull requests.
14-
- Reviewers will advise and guide you up to make the code refined and documented.
15-
- When reviewing pull requests, be sure to:
16-
- Be kind.
17-
- Be respectful.
18-
- Make useful suggestions/comments.
19-
- Be sure not to make invalid suggestions/comments.
20-
- Guide and advise up the pull request author.
11+
**Please check the [reviewer code](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/REVIEWER_CODE.md) file for maintainers and reviewers.**
2112

2213
### Contributor
2314

24-
We are very happy that you consider implementing algorithms and data structures for others! This repository is referred to and used by learners from around the globe. Being one of our contributors, you agree and confirm that:
15+
Being a contributor at The Algorithms, we request you to follow the points mentioned below:
2516

2617
- You did your own work.
2718
- No plagiarism allowed. Any plagiarized work will not be merged.
2819
- Your work will be distributed under the [GNU General Public License v3.0](https://github.com/TheAlgorithms/C/blob/master/LICENSE) once your pull request has been merged.
29-
- You submitted work fulfils or mostly fulfils our styles and standards.
20+
- Please follow the repository guidelines and standards mentioned below.
3021

31-
**New implementation** New implementation are welcome!
22+
**New implementation** New implementations are welcome!
3223

33-
**Improving comments** and **adding tests** to existing algorithms are much appreciated.
24+
You can add new algorithms or data structures which are **not present in the repository** or that can **improve** the old implementations (**documentation**, **improving test cases**, removing bugs or in any other resonable sense)
3425

35-
**Issues** Please avoid opening issues asking to be "assigned” to a particular algorithm. This merely creates unnecessary noise for maintainers. Instead, please submit your implementation in a pull request and it will be evaluated by project maintainers.
26+
**Issues** Please avoid opening issues asking to be "assigned” to a particular algorithm. This merely creates unnecessary noise for maintainers. Instead, please submit your implementation in a pull request, and it will be evaluated by project maintainers.
3627

3728
### Making Changes
3829

3930
#### Code
4031

4132
- Please use the directory structure of the repository.
42-
- File extension for code should be `*.h` `*.c`
43-
- Organize your code using **`struct`** keywords
33+
- Make sure the file extensions should be `*.h` `*.c`
34+
- Organize your code using the **`struct`** keyword
4435
- If an implementation of the algorithm already exists, please refer to the [file-name section below](#file-name-guidelines).
4536
- You can suggest reasonable changes to existing algorithms.
4637
- Strictly use snake_case (underscore_separated) in filenames.
4738
- If you have added or modified code, please make sure the code compiles before submitting.
48-
- Our automated testing runs [__CMake__](https://cmake.org/) on all pull requests so please be sure that your code passes before submitting.
49-
- Please conform to [doxygen](https://www.doxygen.nl/manual/docblocks.html) standard and document the code as much as possible. This not only facilitates the readers but also generates the correct info on website.
50-
- **Be consistent in use of these guidelines.**
39+
- Our automated testing runs [__CMake__](https://cmake.org/) on all the pull requests, so please be sure that your code passes before submitting.
40+
- Please conform to [Doxygen](https://www.doxygen.nl/manual/docblocks.html) standard and document the code as much as possible. This not only facilitates the readers but also generates the correct info on website.
41+
- **Be consistent in the use of these guidelines.**
5142

5243
#### Documentation
5344

54-
- Make sure you put useful comments in your code. Do not comment things that are obvious.
45+
- Make sure you put useful comments in your code. Do not comment on obvious things.
5546
- Please avoid creating new directories if at all possible. Try to fit your work into the existing directory structure. If you want to create a new directory, then please check if a similar category has been recently suggested or created by other pull requests.
56-
- If you have modified/added documentation, please ensure that your language is concise and contains no grammar errors.
57-
- Do not update README.md along with other changes, first create an issue and then link to that issue in your pull request to suggest specific changes required to README.md
58-
- The repository follows [Doxygen](https://www.doxygen.nl/manual/docblocks.html) standards and auto-generates the [repository website](https://thealgorithms.github.io/C). Please ensure the code is documented in this structure. Sample implementation is given below.
47+
- If you have modified/added documentation, please ensure that your language is concise and must not contain grammatical errors.
48+
- Do not update [`README.md`](https://github.com/TheAlgorithms/C/blob/master/README.md) along with other changes. First, create an issue and then link to that issue in your pull request to suggest specific changes required to [`README.md`](https://github.com/TheAlgorithms/C/blob/master/README.md).
49+
- The repository follows [Doxygen](https://www.doxygen.nl/manual/docblocks.html) standards and auto-generates the [repository website](https://thealgorithms.github.io/C). Please ensure the code is documented in this structure. A sample implementation is given below.
5950

6051
#### Test
6152

62-
- Make sure to add examples and test cases in your main() function.
63-
- If you find any algorithm or document without tests, please feel free to create a pull request or issue describing suggested changes.
64-
- Please try to add one or more `test()` functions that will invoke the algorithm implementation on random test data with expected output. Use `assert()` function to confirm that the tests will pass. Requires adding the `assert.h` library.
53+
- Make sure to add examples and test cases in your `main()` function.
54+
- If you find an algorithm or document without tests, please feel free to create a pull request or issue describing suggested changes.
55+
- Please try to add one or more `test()` functions that will invoke the algorithm implementation on random test data with the expected output. Use the `assert()` function to confirm that the tests will pass. Requires including the `assert.h` library.
6556

6657
#### Typical structure of a program
6758

@@ -70,15 +61,15 @@ We are very happy that you consider implementing algorithms and data structures
7061
* @file
7162
* @brief Add one line description here
7263
* @details
73-
* This is a multi line
64+
* This is a multi-line
7465
* description containing links, references,
75-
* math equations, etc
66+
* math equations, etc.
7667
* @author [Name](https://github.com/handle)
7768
* @see related_file.c, another_file.c
7869
*/
7970

80-
#include <assert.h>
81-
#include
71+
#include <assert.h> /// for assert
72+
#include /// for `some function here`
8273

8374
/**
8475
* @brief Struct documentation
@@ -89,7 +80,7 @@ struct struct_name {
8980
};
9081

9182
/**
92-
* Function documentation
83+
* @brief Function documentation
9384
* @param param1 one-line info about param1
9485
* @param param2 one-line info about param2
9586
* @returns `true` if ...
@@ -105,7 +96,7 @@ bool func(int param1, int param2) {
10596
}
10697

10798
/**
108-
* @brief Test function
99+
* @brief Self-test implementations
109100
* @returns void
110101
*/
111102
static void test() {
@@ -120,15 +111,15 @@ static void test() {
120111
* @returns 0 on exit
121112
*/
122113
int main() {
123-
test(); // execute the tests
114+
test(); // run self-test implementations
124115
// code here
125116
return 0;
126117
}
127118
```
128119
129120
#### File name guidelines
130121
131-
- Use lowercase words with ``"_"`` as separator
122+
- Use lowercase words with ``"_"`` as a separator
132123
- For instance
133124
134125
```markdown
@@ -137,8 +128,8 @@ my_new_c_struct.c is correct format
137128
```
138129

139130
- It will be used to dynamically create a directory of files and implementation.
140-
- File name validation will run on docker to ensure the validity.
141-
- If an implementation of the algorithm already exists and your version is different from that implemented, please use incremental numeric digit as a suffix. For example, if `median_search.c` already exists in the `search` folder and you are contributing a new implementation, the filename should be `median_search2.c` and for a third implementation, `median_search3.c`.
131+
- File name validation will run on Docker to ensure validity.
132+
- If an implementation of the algorithm already exists and your version is different from that implemented, please use incremental numeric digit as a suffix. For example: if `median_search.c` already exists in the `search` folder, and you are contributing a new implementation, the filename should be `median_search2.c` and for a third implementation, `median_search3.c`.
142133

143134
#### Directory guidelines
144135

@@ -156,7 +147,7 @@ some_new_fancy_category is correct
156147

157148
#### Commit Guidelines
158149

159-
- It is recommended to keep your changes grouped logically within individual commits. Maintainers find it easier to understand changes that are logically spilt across multiple commits. Try to modify just one or two files in the same directory. Pull requests that span multiple directories are often rejected.
150+
- It is recommended to keep your changes grouped logically within individual commits. Maintainers find it easier to understand changes that are logically spilt across multiple commits. Try to modify just one or two files in the same directory. Pull requests that span multiple directories are often rejected.
160151

161152
```bash
162153
git add file_xyz.c
@@ -213,14 +204,14 @@ clang-tidy --fix --quiet -p build subfolder/file_to_check.c --
213204
#### GitHub Actions
214205

215206
- Enable GitHub Actions on your fork of the repository.
216-
After enabling it will execute `clang-tidy` and `clang-format` after every a push (not a commit).
207+
After enabling, it will execute `clang-tidy` and `clang-format` after every a push (not a commit).
217208
- Click on the tab "Actions", then click on the big green button to enable it.
218209

219210
![GitHub Actions](https://user-images.githubusercontent.com/51391473/94609466-6e925100-0264-11eb-9d6f-3706190eab2b.png)
220211

221212
- The result can create another commit if the actions made any changes on your behalf.
222213
- Hence, it is better to wait and check the results of GitHub Actions after every push.
223-
- Run `git pull` in your local clone if these actions made many changes in order to avoid merge conflicts.
214+
- Run `git pull` in your local clone if these actions made many changes to avoid merge conflicts.
224215

225216
Most importantly,
226217

0 commit comments

Comments
 (0)