diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..e80a7428 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,13 @@ +repos: + - repo: https://github.com/psf/black + rev: 21.7b0 + hooks: + - id: black + - repo: https://github.com/pycqa/flake8 + rev: "3.9.2" + hooks: + - id: flake8 + - repo: https://github.com/pycqa/isort + rev: "5.8.0" + hooks: + - id: isort diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fec5d205..3d4adef2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,6 +65,13 @@ If you are working from the command line, you should use these tools form the ro black jinahub/encoders/text/BERTTextEncoder ``` +We also provide a `.pre-commit-config.yaml` file, which enables you to use [pre-commit](https://pre-commit.com/index.html) to automatically perform the required linting/formatting actions before you commit your changes. You can install it using + +``` +pip install pre-commit +pre-commit install +``` + ### 📖 Documentation When writing code you should already be adding documentation, by writing docstrings for all classes, methods and functions. Type hints for all arguments and return values should be added as well.