From 9e7b20660b3792f64b83b37b0e62f56a93f46b79 Mon Sep 17 00:00:00 2001 From: Michael Deyaso Date: Sat, 25 Mar 2023 13:34:30 +0300 Subject: [PATCH 1/3] Installed and configured pre-commit to lint and format code. Fixes #7476 (cherry picked from commit 98d1c65b404e77756289e32d1ef718318a36ece7) --- .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 d54c6c4e9..51e11bf34 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -164,6 +164,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 3c30b2ac2..a8da71dcf 100644 --- a/requirements.d/development.txt +++ b/requirements.d/development.txt @@ -11,3 +11,4 @@ pytest-benchmark Cython twine python-dateutil +pre-commit From 172b03ef4d95511fa79f7fb157131ff4c16172c7 Mon Sep 17 00:00:00 2001 From: Michael Deyaso Date: Sat, 25 Mar 2023 19:26:32 +0300 Subject: [PATCH 2/3] Changed black rev in pre-commit yaml. Fixes #7476 (cherry picked from commit 20a4c960ecde95474c16ab59c9ca227fe425e676) --- .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 From 5b5e9282e38ccc46776f33f5d1078c387d9dfd18 Mon Sep 17 00:00:00 2001 From: Sasha Boginsky <41092741+sashadev-sky@users.noreply.github.com> Date: Sun, 7 May 2023 18:52:42 -0400 Subject: [PATCH 3/3] Remove black formatting from cherry-pick --- .pre-commit-config.yaml | 4 ---- docs/development.rst | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2ce85f8a6..f7a03542b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,4 @@ repos: -- repo: https://github.com/psf/black - rev: 23.1.0 - hooks: - - id: black - repo: https://github.com/pycqa/flake8 rev: 6.0.0 hooks: diff --git a/docs/development.rst b/docs/development.rst index 51e11bf34..f589f25b1 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -164,7 +164,7 @@ 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. +This project utilizes pre-commit to 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::