From 785f50feeb6fcff1165f7a78d2c71d4d73b1c092 Mon Sep 17 00:00:00 2001 From: Tadej Date: Sun, 29 Aug 2021 15:15:37 +0200 Subject: [PATCH 1/2] chore: add pre-commit file --- .pre-commit-config.yaml | 13 +++++++++++++ CONTRIBUTING.md | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 .pre-commit-config.yaml 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..8fa7fd96 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,6 +65,8 @@ 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. + ### 📖 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. From a107048c622b36757330170c333dba637145cc22 Mon Sep 17 00:00:00 2001 From: Tadej Date: Sun, 29 Aug 2021 16:35:51 +0200 Subject: [PATCH 2/2] docs: add install instructions --- CONTRIBUTING.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8fa7fd96..3d4adef2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,7 +65,12 @@ 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. +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