From 58c1629b2d627b3e9e451ebaa18dcb9e0919c349 Mon Sep 17 00:00:00 2001 From: Henrik Koski Date: Mon, 22 Jul 2024 09:39:22 +0300 Subject: [PATCH] Add pre-commit hooks Now both isort and black are included in the pre-commit hooks. Re spine-tools/Spine-Toolbox#2897 --- .pre-commit-config.yaml | 9 +++++++++ dev-requirements.txt | 1 + pyproject.toml | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ec98826 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: +- repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort +- repo: https://github.com/python/black + rev: 24.4.2 + hooks: + - id: black diff --git a/dev-requirements.txt b/dev-requirements.txt index b4ad95b..2ef2b60 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -6,3 +6,4 @@ sphinx_rtd_theme sphinx-autoapi pylint black == 24.4.2 +pre-commit diff --git a/pyproject.toml b/pyproject.toml index 90100d5..dbb42ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,13 +56,13 @@ ignore_errors = true [tool.black] line-length = 120 -exclude = '\.git|version.py' +force-exclude = '\.git|version.py' [tool.isort] profile = "black" lines_between_sections = 0 force_sort_within_sections = true honor_case_in_force_sorted_sections = true -skip = ["version.py"] +skip = [".git", "version.py"] line_length = 120 known_first_party = ["spinedb_api"]