From 98d1c65b404e77756289e32d1ef718318a36ece7 Mon Sep 17 00:00:00 2001 From: Michael Deyaso Date: Sat, 25 Mar 2023 13:34:30 +0300 Subject: [PATCH 1/2] Installed and configured pre-commit to lint and format code. Fixes #7476 --- .pre-commit-config.yaml | 10 ++++++++++ docs/development.rst | 7 +++++++ requirements.d/development.txt | 1 + 3 files changed, 18 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 000000000..bea95b42b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: +- repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black +- repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + files: '(src|scripts|conftest.py)' diff --git a/docs/development.rst b/docs/development.rst index be4ed84d9..eff02309c 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -179,6 +179,13 @@ virtual env and run:: pip install -r requirements.d/development.txt +This project utilizes pre-commit to format and lint code before it is committed. +Although pre-commit is installed when running the command above, the pre-commit hooks +will have to be installed separately. Run this command to install the pre-commit hooks:: + + pre-commit install + + Running the tests ----------------- diff --git a/requirements.d/development.txt b/requirements.d/development.txt index 256571076..9fba42e9f 100644 --- a/requirements.d/development.txt +++ b/requirements.d/development.txt @@ -10,3 +10,4 @@ pytest-cov pytest-benchmark Cython twine +pre-commit From 20a4c960ecde95474c16ab59c9ca227fe425e676 Mon Sep 17 00:00:00 2001 From: Michael Deyaso Date: Sat, 25 Mar 2023 19:26:32 +0300 Subject: [PATCH 2/2] Changed black rev in pre-commit yaml. Fixes #7476 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bea95b42b..2ce85f8a6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/pycqa/flake8