Skip to content

Commit 612e088

Browse files
cclaussstokhos
authored andcommitted
Update CONTRIBUTING.md to match TheAlgorithms#964 (TheAlgorithms#969)
* Update CONTRIBUTING.md to match TheAlgorithms#964 Blocked by TheAlgorithms#964 * Do not modify README or DIRECTORY file. * Update CONTRIBUTING.md
1 parent 5fc80c8 commit 612e088

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

Diff for: CONTRIBUTING.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ We appreciate any contribution, from fixing a grammar mistake in a comment to im
2828
We want your work to be readable by others; therefore, we encourage you to note the following:
2929

3030
- Please write in Python 3.x.
31+
- Please consider running [__python/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not a requirement but it does make your code more readable. There are other code formatters (autopep8, yapf) but the __black__ style is now the recommendation of the Python core team. To use it,
32+
```bash
33+
pip3 install black # only required the first time
34+
black my-submission.py
35+
```
36+
37+
- All submissions will need to pass the test __flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics__ before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
3138

3239
- If you know [PEP 8](https://www.python.org/dev/peps/pep-0008/) already, you will have no problem in coding style, though we do not follow it strictly. Read the remaining section and have fun coding!
3340

@@ -74,11 +81,17 @@ We want your work to be readable by others; therefore, we encourage you to note
7481

7582
The following "testing" approaches are **not** encouraged:
7683

77-
```python*
84+
```python
7885
input('Enter your input:')
7986
# Or even worse...
8087
input = eval(raw_input("Enter your input: "))
8188
```
89+
90+
However, if your code uses __input()__ then we encourage you to gracefully deal with leading and trailing whitespace in user input by adding __.strip()__ to the end as in:
91+
92+
```python
93+
starting_value = int(input("Please enter a starting value: ").strip())
94+
```
8295

8396
Please write down your test case, like the following:
8497

@@ -92,8 +105,10 @@ We want your work to be readable by others; therefore, we encourage you to note
92105
print("1 + 2 = ", sumab(1,2)) # 1+2 = 3
93106
print("6 + 4 = ", sumab(6,4)) # 6+4 = 10
94107
```
108+
109+
Better yet, if you know how to write [__doctests__](https://docs.python.org/3/library/doctest.html), please consider adding them.
95110

96-
- Avoid importing external libraries for basic algorithms. Use those libraries for complicated algorithms.
111+
- Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms.
97112

98113
#### Other Standard While Submitting Your Work
99114

@@ -105,15 +120,17 @@ We want your work to be readable by others; therefore, we encourage you to note
105120

106121
- If you have modified/added code work, make sure the code compiles before submitting.
107122

108-
- If you have modified/added documentation work, make sure your language is concise and contains no grammar mistake.
123+
- If you have modified/added documentation work, ensure your language is concise and contains no grammar errors.
109124

110-
- Update the README file if you have added any new algorithm. Only entry corresponding to the algorithm is to be made, not need to add sample data, test files or solutions to problems like Project Euler, in the README.
125+
- Do not update the README.md or DIRECTORY.md file which will be periodically autogenerated by our Travis CI processes.
111126

112127
- Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended).
113128

129+
- All submissions will be tested with [__mypy__](http://www.mypy-lang.org) so we encourage to add [__Python type hints__](https://docs.python.org/3/library/typing.html) where it makes sense to do so.
130+
114131
- Most importantly,
115132

116-
- **Be consistent with this guidelines while submitting.**
133+
- **Be consistent in the use of these guidelines when submitting.**
117134
- **Join** [Gitter](https://gitter.im/TheAlgorithms) **now!**
118135
- Happy coding!
119136

0 commit comments

Comments
 (0)