Skip to content

Commit 0c5c096

Browse files
authored
[feat/fix]: Improve the contributing guidelines... (#1522)
...and add the `CodingGuidelines.md` file, taken and edited from the [C](https://github.com/TheAlgorithms/C) repository.
1 parent 47c8413 commit 0c5c096

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

CONTRIBUTING.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Welcome to [TheAlgorithms/C-Plus-Plus](https://github.com/TheAlgorithms/C-Plus-P
66

77
## Contributing
88

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+
913
### Contributor
1014

1115
Being a contributor at The Algorithms, we request you to follow the points mentioned below:
@@ -49,7 +53,7 @@ You can add new algorithms or data structures which are **not present in the rep
4953

5054
- Make sure to add examples and test cases in your `main()` function.
5155
- If you find an 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 the expected output. Use the `assert()` function to confirm that the tests will pass. Requires including the `cassert` header.
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.
5357

5458
#### Typical structure of a program
5559

@@ -58,23 +62,23 @@ You can add new algorithms or data structures which are **not present in the rep
5862
* @file
5963
* @brief Add one line description here
6064
* @details
61-
* This is a multi line
65+
* This is a multi-line
6266
* description containing links, references,
63-
* math equations, etc
67+
* math equations, etc.
6468
* @author [Name](https://github.com/handle)
6569
* @see related_file.cpp, another_file.cpp
6670
*/
6771

68-
#include <cassert>
69-
#include
72+
#include <cassert> /// for assert
73+
#include /// for `some function here`
7074

7175
/**
7276
* @namespace <check from other files in this repo>
7377
*/
7478
namespace name {
7579

7680
/**
77-
* Class documentation
81+
* @brief Class documentation
7882
*/
7983
class class_name {
8084
private:
@@ -86,7 +90,7 @@ class class_name {
8690
}
8791

8892
/**
89-
* Function documentation
93+
* @brief Function documentation
9094
* @tparam T this is a one-line info about T
9195
* @param param1 on-line info about param1
9296
* @param param2 on-line info about param2
@@ -105,7 +109,7 @@ bool func(int param1, T param2) {
105109
} // namespace name
106110

107111
/**
108-
* @brief Test implementations
112+
* @brief Self-test implementations
109113
* @returns void
110114
*/
111115
static void test() {
@@ -122,7 +126,7 @@ static void test() {
122126
* @returns 0 on exit
123127
*/
124128
int main(int argc, char *argv[]) {
125-
test(); // execute the tests
129+
test(); // run self-test implementations
126130
// code here
127131
return 0;
128132
}
@@ -139,7 +143,7 @@ my_new_cpp_class.cpp is correct format
139143
```
140144

141145
- It will be used to dynamically create a directory of files and implementation.
142-
- File name validation will run on docker to ensure validity.
146+
- File name validation will run on Docker to ensure validity.
143147
- 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`.
144148

145149
#### New Directory guidelines
@@ -196,15 +200,15 @@ cmake -B build -S .
196200

197201
#### Static Code Analyzer
198202

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).
200204

201205
```bash
202206
clang-tidy --fix --quiet -p build subfolder/file_to_check.cpp --
203207
```
204208

205209
#### Code Formatter
206210

207-
[__clang-format__](https://clang.llvm.org/docs/ClangFormat.html) is used for code forrmating.
211+
[`__clang-format__`](https://clang.llvm.org/docs/ClangFormat.html) is used for code forrmating.
208212

209213
- Installation (only needs to be installed once.)
210214
- Mac (using home-brew): `brew install clang-format`

CodingGuidelines.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Code style convention
2+
3+
Please orient on this guide before you sent a pull request.
4+
5+
---
6+
7+
## User-interface
8+
9+
Please write a simple user interface for your programs. Not a blinking cursor!
10+
What does the program do?
11+
What want the program an user informations?
12+
13+
---
14+
15+
## Code style conventions
16+
17+
See [here](https://users.ece.cmu.edu/~eno/coding/CppCodingStandard.html)
18+
Don't push all code in one line!

0 commit comments

Comments
 (0)