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
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Fix formatting and grammar in CONTRIBUTING.md π (#12894)
* Fix formatting and grammar in CONTRIBUTING.md π
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* commited
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Warp long line 72 to placate rumdl in pre-commit
CONTRIBUTING.md:72:351: [MD013] Line length 376 exceeds 350 characters
* Revise pre-commit instructions and docstring guidelines
Updated the CONTRIBUTING.md file to clarify pre-commit plugin usage and improve docstring requirements.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Improve comments guidelines in CONTRIBUTING.md
Reorganize comments on code explanation for clarity.
* Update forward propagation reference link
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: umang-dadhich <umang-dadhich@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+35-15Lines changed: 35 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,35 @@
1
-
# Contributing guidelines
1
+
# Contributing Guidelines
2
2
3
-
## Before contributing
3
+
## Before Contributing
4
4
5
-
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before submitting your pull requests, please ensure that you __read the whole guidelines__. If you have any doubts about the contributing guide, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community on [Gitter](https://gitter.im/TheAlgorithms/community).
5
+
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before submitting your pull requests, please ensure that you __read the entire guidelines__. If you have any doubts about the contributing guide, please feel free to [state them clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community on [Gitter](https://gitter.im/TheAlgorithms/community).
6
6
7
7
## Contributing
8
8
9
9
### Contributor
10
10
11
11
We are delighted that you are considering implementing algorithms and data structures for others! This repository is referenced and used by learners from all over the globe. By being one of our contributors, you agree and confirm that:
12
12
13
-
- You did your work - no plagiarism allowed.
13
+
- You did your work β no plagiarism allowed.
14
14
- Any plagiarized work will not be merged.
15
-
- Your work will be distributed under [MIT License](LICENSE.md) once your pull request is merged.
15
+
- Your work will be distributed under the [MIT License](LICENSE.md) once your pull request is merged.
16
16
- Your submitted work fulfills or mostly fulfills our styles and standards.
17
17
18
-
__New implementation__ is welcome! For example, new solutions for a problem, different representations for a graph data structure or algorithm designs with different complexity, but __identical implementation__ of an existing implementation is not allowed. Please check whether the solution is already implemented or not before submitting your pull request.
18
+
__New implementations__ are welcome! For example, new solutions for a problem, different representations for a graph data structure, or algorithm designs with different complexities. However, __identical implementations__ of an existing one are not allowed. Please check whether the solution is already implemented before submitting your pull request.
19
19
20
20
__Improving comments__ and __writing proper tests__ are also highly welcome.
21
21
22
22
### Contribution
23
23
24
-
We appreciate any contribution, from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work.
24
+
We appreciate any contribution β from fixing a grammar mistake in a comment to implementing complex algorithms. Please read this section if you are contributing your work.
25
25
26
26
Your contribution will be tested by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) to save time and mental energy. After you have submitted your pull request, you should see the GitHub Actions tests start to run at the bottom of your submission page.
27
27
28
28
If those tests fail, then click on the ___details___ button to read through the GitHub Actions output to understand the failure. If you do not understand, please leave a comment on your submission page, and a community member will try to help.
29
29
30
30
#### Issues
31
31
32
-
If you are interested in resolving an [open issue](https://github.com/TheAlgorithms/Python/issues), simply make a pull request with your proposed fix. __We do not assign issues in this repo__ so please do not ask for permission to work on an issue.
32
+
If you are interested in resolving an [open issue](https://github.com/TheAlgorithms/Python/issues), simply make a pull request with your proposed fix. __We do not assign issues in this repo__, so please do not ask for permission to work on an issue.
33
33
34
34
__Do not__ create an issue to contribute an algorithm. Please submit a pull request instead.
35
35
@@ -44,17 +44,36 @@ GitHub will use this tag to [auto-close the issue](https://docs.github.com/en/is
44
44
45
45
#### What is an Algorithm?
46
46
47
-
An Algorithm is one or more functions (or classes) that:
47
+
An algorithm is one or more functions (or classes) that:
48
48
49
+
- take one or more inputs,
50
+
- perform some internal calculations or data manipulations,
51
+
- return one or more outputs,
52
+
- have minimal side effects (e.g., `print()`, `plot()`, `read()`, `write()`).
53
+
An Algorithm is one or more functions (or classes) that:
49
54
- take one or more inputs,
50
55
- perform some internal calculations or data manipulations,
51
56
- return one or more outputs,
52
57
- have minimal side effects (Ex. `print()`, `plot()`, `read()`, `write()`).
53
58
54
-
Algorithms should be packaged in a way that makes it easy for readers to put them into larger programs.
59
+
Algorithms should be packaged in a way that would make it easy for readers to integrate them into larger programs.
55
60
56
61
Algorithms should:
57
62
63
+
- have intuitive class and function names that make their purpose clear to readers,
64
+
- use Python naming conventions and intuitive variable names to ease comprehension,
65
+
- be flexible to take different input values,
66
+
- have Python type hints for their input parameters and return values,
67
+
- raise Python exceptions (`ValueError`, etc.) on erroneous input values,
68
+
- have docstrings with clear explanations and/or URLs to source materials,
69
+
- contain doctests that test both valid and erroneous input values,
70
+
- return all calculation results instead of printing or plotting them.
71
+
72
+
Algorithms in this repo should not be simple how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values.
73
+
These calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value.
74
+
75
+
#### Pre-Commit Plugin
76
+
58
77
- have intuitive class and function names that make their purpose clear to readers
59
78
- use Python naming conventions and intuitive variable names to ease comprehension
60
79
- be flexible to take different input values
@@ -67,7 +86,7 @@ Algorithms should:
67
86
Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values.
68
87
Those calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value.
69
88
70
-
#### Pre-commit plugin
89
+
#### Pre-commit
71
90
72
91
Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style:
73
92
@@ -76,7 +95,7 @@ python3 -m pip install pre-commit # only required the first time
76
95
pre-commit install
77
96
```
78
97
79
-
That's it! The plugin will run every time you commit any changes. If any errors are found during the run, fix them and commit those changes. You can even run the plugin manually on all files:
98
+
That's it! Pre-commit will run every time you commit any changes. If any errors are found during the run, fix them and commit those changes. You can even run the plugin manually on all files:
80
99
81
100
```bash
82
101
pre-commit run --all-files --show-diff-on-failure
@@ -118,12 +137,13 @@ We want your work to be readable by others; therefore, we encourage you to note
118
137
The following are considered to be bad and may be requested to be improved:
119
138
120
139
```python
121
-
x = x +2# increased by 2
140
+
x +=2# increased by 2
122
141
```
123
142
124
-
This is too trivial. Comments are expected to be explanatory. For comments, you can write them above, on, or below a line of code, as long as you are consistent within the same piece of code.
143
+
This is too trivial. Comments should not merely repeat what the code already says. Comments should explain ___why___ we are doing things. Comments on the same line as code should never cause the line to wrap (> 88 characters per line).
144
+
Comments which are not on the same line as code should appear ___before___ the code they describe. "First tell the reader ___why___ with comments and then show them ___how___ with code."
125
145
126
-
We encourage you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example:
146
+
We require you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example:
0 commit comments