From e7b93654a930cbd3ad9f7209cfda2b9ba5ef1156 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 26 Nov 2023 17:02:36 +0100 Subject: [PATCH] Add pre-commit checks --- .pre-commit-config.yaml | 37 ++++++++++++++++++++++++++++++++++++- pyproject.toml | 1 - tests/wizard/test_forms.py | 2 +- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e6a92c..a2410ad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1 +1,36 @@ -repos: [] +# To enable this pre-commit hook run: +# `pip install pre-commit` or `brew install pre-commit` +# Then run `pre-commit install` + +# Learn more about this config here: https://pre-commit.com + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-toml + - id: check-yaml + - id: detect-private-key + - id: end-of-file-fixer + - id: mixed-line-ending + - id: requirements-txt-fixer + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.6 + hooks: + - id: ruff + + + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli + args: + [--skip, "*.po"] + + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.15 + hooks: + - id: validate-pyproject diff --git a/pyproject.toml b/pyproject.toml index f1a2160..2ebb7f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,4 +63,3 @@ include_trailing_comma = true known_first_party = ["formtools"] line_length = 79 multi_line_output = 5 - diff --git a/tests/wizard/test_forms.py b/tests/wizard/test_forms.py index 9bee6cf..e637cae 100644 --- a/tests/wizard/test_forms.py +++ b/tests/wizard/test_forms.py @@ -88,7 +88,7 @@ class TestWizardWithInitAttrs(TestWizard): class TestWizardWithTypeCheck(TestWizard): def done(self, form_list, **kwargs): - assert type(form_list) is list, "`form_list` was {}, should be a list".format(type(form_list)) + assert isinstance(form_list, list), f"`form_list` was {type(form_list)}, should be a list" return http.HttpResponse("All good")