Skip to content

Commit 43cb26c

Browse files
umang-dadhichpre-commit-ci[bot]cclauss
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>
1 parent 367ac40 commit 43cb26c

2 files changed

Lines changed: 36 additions & 16 deletions

File tree

β€ŽCONTRIBUTING.mdβ€Ž

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
# Contributing guidelines
1+
# Contributing Guidelines
22

3-
## Before contributing
3+
## Before Contributing
44

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

77
## Contributing
88

99
### Contributor
1010

1111
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:
1212

13-
- You did your work - no plagiarism allowed.
13+
- You did your work β€” no plagiarism allowed.
1414
- 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.
1616
- Your submitted work fulfills or mostly fulfills our styles and standards.
1717

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.
1919

2020
__Improving comments__ and __writing proper tests__ are also highly welcome.
2121

2222
### Contribution
2323

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.
2525

2626
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.
2727

2828
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.
2929

3030
#### Issues
3131

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.
3333

3434
__Do not__ create an issue to contribute an algorithm. Please submit a pull request instead.
3535

@@ -44,17 +44,36 @@ GitHub will use this tag to [auto-close the issue](https://docs.github.com/en/is
4444

4545
#### What is an Algorithm?
4646

47-
An Algorithm is one or more functions (or classes) that:
47+
An algorithm is one or more functions (or classes) that:
4848

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:
4954
- take one or more inputs,
5055
- perform some internal calculations or data manipulations,
5156
- return one or more outputs,
5257
- have minimal side effects (Ex. `print()`, `plot()`, `read()`, `write()`).
5358

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.
5560

5661
Algorithms should:
5762

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+
5877
- have intuitive class and function names that make their purpose clear to readers
5978
- use Python naming conventions and intuitive variable names to ease comprehension
6079
- be flexible to take different input values
@@ -67,7 +86,7 @@ Algorithms should:
6786
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.
6887
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.
6988

70-
#### Pre-commit plugin
89+
#### Pre-commit
7190

7291
Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style:
7392

@@ -76,7 +95,7 @@ python3 -m pip install pre-commit # only required the first time
7695
pre-commit install
7796
```
7897

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:
8099

81100
```bash
82101
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
118137
The following are considered to be bad and may be requested to be improved:
119138

120139
```python
121-
x = x + 2 # increased by 2
140+
x += 2 # increased by 2
122141
```
123142

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."
125145

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:
127147

128148
```python
129149
def sum_ab(a, b):

β€Žneural_network/simple_neural_network.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Forward propagation explanation:
3-
https://towardsdatascience.com/forward-propagation-in-neural-networks-simplified-math-and-code-version-bbcfef6f9250
3+
https://en.wikipedia.org/wiki/Feedforward_neural_network
44
"""
55

66
import math

0 commit comments

Comments
Β (0)