You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+41-37
Original file line number
Diff line number
Diff line change
@@ -2,54 +2,58 @@
2
2
3
3
## Before contributing
4
4
5
-
Welcome to [TheAlgorithms/C-Plus-Plus](https://github.com/TheAlgorithms/C-Plus-Plus)! 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-Plus-Plus/issues/new/choose) and clearly state your concerns.
5
+
Welcome to [TheAlgorithms/C-Plus-Plus](https://github.com/TheAlgorithms/C-Plus-Plus)! 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-Plus-Plus/issues/new/choose)or ask in our [Discord server](https://discord.gg/c7MnfGFGa6), and clearly state your concerns.
6
6
7
7
## Contributing
8
8
9
+
### Maintainer/reviewer
10
+
11
+
**Please check the [reviewer code](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/REVIEWER_CODE.md) file for maintainers and reviewers.**
12
+
9
13
### Contributor
10
14
11
-
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:
12
16
13
17
- You did your own work.
14
18
- No plagiarism allowed. Any plagiarized work will not be merged.
15
-
- Your work will be distributed under [MIT License](License) once your pull request has been merged.
16
-
-You submitted work fulfils or mostly fulfils our styles and standards.
19
+
- Your work will be distributed under the [MIT License](https://github.com/TheAlgoritms/C-Plus-Plus/blob/master/LICENSE) once your pull request has been merged.
20
+
-Please follow the repository guidelines and standards mentioned below.
17
21
18
-
**New implementation** New implementation are welcome!
22
+
**New implementation** New implementations are welcome!
19
23
20
-
**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)
21
25
22
-
**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.
23
27
24
28
### Making Changes
25
29
26
30
#### Code
27
31
28
32
- Please use the directory structure of the repository.
29
-
-File extension for code should be `*.hpp`, `*.h` or `*.cpp`.
30
-
- Don't use **bits/stdc++.h** because this is quite Linuxspecific and slows down the compilation process.
31
-
- Organize your code using **`struct`**, **`class`** and/or **`namespace`** keywords
33
+
-Make sure the file extensions should be `*.hpp`, `*.h` or `*.cpp`.
34
+
- Don't use **`bits/stdc++.h`** because this is quite Linux-specific and slows down the compilation process.
35
+
- Organize your code using **`struct`**, **`class`**, and/or **`namespace`** keywords
32
36
- If an implementation of the algorithm already exists, please refer to the [file-name section below](#new-file-name-guidelines).
33
37
- You can suggest reasonable changes to existing algorithms.
34
38
- Strictly use snake_case (underscore_separated) in filenames.
35
39
- If you have added or modified code, please make sure the code compiles before submitting.
36
-
- Our automated testing runs [__CMake__](https://cmake.org/) on all pull requests so please be sure that your code passes before submitting.
37
-
- 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.
38
-
-**Be consistent in use of these guidelines.**
40
+
- Our automated testing runs [__CMake__](https://cmake.org/) on all the pull requests, so please be sure that your code passes before submitting.
41
+
- 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 the website.
42
+
-**Be consistent in the use of these guidelines.**
39
43
40
44
#### Documentation
41
45
42
-
- Make sure you put useful comments in your code. Do not comment things that are obvious.
46
+
- Make sure you put useful comments in your code. Do not comment on obvious things.
43
47
- 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.
44
-
- If you have modified/added documentation, please ensure that your language is concise and contains no grammar errors.
45
-
- Do not update [`README.md`](https://github.com/TheAlgorithms/C-Plus-Plus/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-Plus-Plus/blob/master/README.md).
46
-
- The repository follows [Doxygen](https://www.doxygen.nl/manual/docblocks.html) standards and auto-generates the [repository website](https://thealgorithms.github.io/C-Plus-Plus). Please ensure the code is documented in this structure. Sample implementation is given below.
48
+
- If you have modified/added documentation, please ensure that your language is concise and must not contain grammatical errors.
49
+
- Do not update [`README.md`](https://github.com/TheAlgorithms/C-Plus-Plus/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-Plus-Plus/blob/master/README.md).
50
+
- The repository follows [Doxygen](https://www.doxygen.nl/manual/docblocks.html) standards and auto-generates the [repository website](https://thealgorithms.github.io/C-Plus-Plus). Please ensure the code is documented in this structure. A sample implementation is given below.
47
51
48
52
#### Test
49
53
50
-
- Make sure to add examples and test cases in your main() function.
51
-
- If you find any algorithm or document without tests, please feel free to create a pull request or issue describing suggested changes.
52
-
- 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 including the `cassert`header.
54
+
- Make sure to add examples and test cases in your `main()` function.
55
+
- If you find an algorithm or document without tests, please feel free to create a pull request or issue describing suggested changes.
56
+
- 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 `cassert`library.
53
57
54
58
#### Typical structure of a program
55
59
@@ -58,23 +62,23 @@ We are very happy that you consider implementing algorithms and data structures
* @namespace <check from other files in this repo>
73
77
*/
74
78
namespacename {
75
79
76
80
/**
77
-
* Class documentation
81
+
*@briefClass documentation
78
82
*/
79
83
class class_name {
80
84
private:
@@ -86,7 +90,7 @@ class class_name {
86
90
}
87
91
88
92
/**
89
-
* Function documentation
93
+
*@briefFunction documentation
90
94
*@tparam T this is a one-line info about T
91
95
*@param param1 on-line info about param1
92
96
*@param param2 on-line info about param2
@@ -105,11 +109,11 @@ bool func(int param1, T param2) {
105
109
} // namespace name
106
110
107
111
/**
108
-
*@briefTest implementations
112
+
*@briefSelf-test implementations
109
113
*@returns void
110
114
*/
111
115
static void test() {
112
-
/*desciptions of the following test */
116
+
/*descriptions of the following test */
113
117
assert(func(...) == ...); // this ensures that the algorithm works as expected
114
118
115
119
// can have multiple checks
@@ -122,15 +126,15 @@ static void test() {
122
126
*@returns 0 on exit
123
127
*/
124
128
int main(int argc, char *argv[]) {
125
-
test(); // execute the tests
129
+
test(); // run self-test implementations
126
130
// code here
127
131
return 0;
128
132
}
129
133
```
130
134
131
135
#### New File Name guidelines
132
136
133
-
- Use lowercase words with ``"_"`` as separator
137
+
- Use lowercase words with ``"_"`` as a separator
134
138
- For instance
135
139
136
140
```markdown
@@ -139,8 +143,8 @@ my_new_cpp_class.cpp is correct format
139
143
```
140
144
141
145
- It will be used to dynamically create a directory of files and implementation.
142
-
- File name validation will run on docker to ensure the validity.
143
-
- 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.cpp` already exists in the `search` folder and you are contributing a new implementation, the filename should be `median_search2.cpp` and for a third implementation, `median_search3.cpp`.
146
+
- File name validation will run on Docker to ensure validity.
147
+
- 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.cpp` already exists in the `search` folder, and you are contributing a new implementation, the filename should be `median_search2.cpp` and for a third implementation, `median_search3.cpp`.
144
148
145
149
#### New Directory guidelines
146
150
@@ -158,7 +162,7 @@ some_new_fancy_category is correct
158
162
159
163
#### Commit Guidelines
160
164
161
-
- 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.
165
+
- It is recommended to keep your changes grouped logically within individual commits. Maintainers find it easier to understand changes that are logically spilled across multiple commits. Try to modify just one or two files in the same directory. Pull requests that span multiple directories are often rejected.
162
166
163
167
```bash
164
168
git add file_xyz.cpp
@@ -196,15 +200,15 @@ cmake -B build -S .
196
200
197
201
#### Static Code Analyzer
198
202
199
-
We use [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) as a static code analyzer with a configuration in [.clang-tidy](.clang-tidy).
203
+
We use [`clang-tidy`](https://clang.llvm.org/extra/clang-tidy/) as a static code analyzer with a configuration in [`.clang-tidy`](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/.clang-tidy).
0 commit comments