Skip to content

Commit a3f60c7

Browse files
amaank404dhruvmanilacclauss
authored
Update CONTRIBUTING.md with pre-commit plugin instructions (TheAlgorithms#3979)
* Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md Co-authored-by: Christian Clauss <[email protected]> * Update CONTRIBUTING.md Co-authored-by: Christian Clauss <[email protected]> * Update CONTRIBUTING.md Co-authored-by: Dhruv Manilawala <[email protected]> Co-authored-by: Christian Clauss <[email protected]>
1 parent c23d043 commit a3f60c7

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Diff for: CONTRIBUTING.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ Algorithms should:
4949

5050
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. 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.
5151

52+
#### Pre-commit plugin
53+
Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style:
54+
55+
```bash
56+
python3 -m pip install pre-commit # required only once
57+
pre-commit install
58+
```
59+
That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files:
60+
61+
```bash
62+
pre-commit run --all-files --show-diff-on-failure
63+
```
64+
5265
#### Coding Style
5366

5467
We want your work to be readable by others; therefore, we encourage you to note the following:
@@ -64,14 +77,14 @@ We want your work to be readable by others; therefore, we encourage you to note
6477
- Please consider running [__psf/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not yet a requirement but it does make your code more readable and automatically aligns it with much of [PEP 8](https://www.python.org/dev/peps/pep-0008/). There are other code formatters (autopep8, yapf) but the __black__ formatter is now hosted by the Python Software Foundation. To use it,
6578

6679
```bash
67-
pip3 install black # only required the first time
80+
python3 -m pip install black # only required the first time
6881
black .
6982
```
7083

7184
- All submissions will need to pass the test __flake8 . --ignore=E203,W503 --max-line-length=88__ before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request.
7285

7386
```bash
74-
pip3 install flake8 # only required the first time
87+
python3 -m pip install flake8 # only required the first time
7588
flake8 . --ignore=E203,W503 --max-line-length=88 --show-source
7689
```
7790

0 commit comments

Comments
 (0)