From 98d1c65b404e77756289e32d1ef718318a36ece7 Mon Sep 17 00:00:00 2001 From: Michael Deyaso Date: Sat, 25 Mar 2023 13:34:30 +0300 Subject: [PATCH] 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 00000000..bea95b42 --- /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 be4ed84d..eff02309 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 25657107..9fba42e9 100644 --- a/requirements.d/development.txt +++ b/requirements.d/development.txt @@ -10,3 +10,4 @@ pytest-cov pytest-benchmark Cython twine +pre-commit