diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6b6e4d21bfc7..20934b456aff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,7 +56,13 @@ Use [pre-commit](https://pre-commit.com/#installation) to automatically format y python3 -m pip install pre-commit # only required the first time pre-commit install ``` -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: +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. +Pre-commit includes +[black](https://github.com/psf/black), +[ruff](https://beta.ruff.rs/docs/) +[mypy](http://mypy-lang.org). + +You can even run the plugin manually on all files: ```bash pre-commit run --all-files --show-diff-on-failure @@ -148,15 +154,14 @@ We want your work to be readable by others; therefore, we encourage you to note starting_value = int(input("Please enter a starting value: ").strip()) ``` - The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. Our automated testing will run [mypy](http://mypy-lang.org) so run that locally before making your submission. + The use of [Python type hints](https://docs.python.org/3/library/typing.html) is encouraged for function parameters and return values. + Our automated testing will run [mypy](http://mypy-lang.org) so run that locally with pre-commit before making your submission. ```python def sum_ab(a: int, b: int) -> int: return a + b ``` - Instructions on how to install mypy can be found [here](https://github.com/python/mypy). Please use the command `mypy --ignore-missing-imports .` to test all files or `mypy --ignore-missing-imports path/to/file.py` to test a specific file. - - [__List comprehensions and generators__](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions) are preferred over the use of `lambda`, `map`, `filter`, `reduce` but the important thing is to demonstrate the power of Python in code that is easy to read and maintain. - Avoid importing external libraries for basic algorithms. Only use those libraries for complicated algorithms. @@ -172,7 +177,6 @@ We want your work to be readable by others; therefore, we encourage you to note - If you have modified/added documentation work, ensure your language is concise and contains no grammar errors. - Do not update the README.md or DIRECTORY.md file which will be periodically autogenerated by our GitHub Actions processes. - Add a corresponding explanation to [Algorithms-Explanation](https://github.com/TheAlgorithms/Algorithms-Explanation) (Optional but recommended). -- All submissions will be tested with [__mypy__](http://www.mypy-lang.org) so we encourage you to add [__Python type hints__](https://docs.python.org/3/library/typing.html) where it makes sense to do so. - Most importantly, - __Be consistent in the use of these guidelines when submitting.__