From ac907d2c75b4413145bba61751ff6e1dad6d55b0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 26 Nov 2023 07:10:47 +0100 Subject: [PATCH 1/2] Replace flake8 with ruff --- .pre-commit-config.yaml | 7 ++----- Makefile | 2 +- pyproject.toml | 12 ++++++++++++ tests/requirements.txt | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2410ad..f7fef78 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,17 +18,14 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.1.6 hooks: - - id: ruff - + - id: ruff # See pyproject.toml for args - repo: https://github.com/codespell-project/codespell rev: v2.2.6 hooks: - - id: codespell + - id: codespell # See pyproject.toml for args additional_dependencies: - tomli - args: - [--skip, "*.po"] - repo: https://github.com/abravalheri/validate-pyproject rev: v0.15 diff --git a/Makefile b/Makefile index dd931cc..e29945d 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ docs: $(MAKE) -C docs clean html test: - @flake8 + @ruff . @isort --check-only --diff formtools tests @ python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m coverage run `which django-admin` test tests @coverage report diff --git a/pyproject.toml b/pyproject.toml index 2ebb7f5..48170ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,9 @@ zip-safe = false exclude = ["tests"] # tests.* namespaces = false +[tool.codespell] +skip = "*.po" + [tool.isort] combine_as_imports = true default_section = "THIRDPARTY" @@ -63,3 +66,12 @@ include_trailing_comma = true known_first_party = ["formtools"] line_length = 79 multi_line_output = 5 + +[tool.ruff] +ignore = ["PLW2901", "UP031", "UP032"] +line-length = 119 +select = ["ASYNC", "C4", "C90", "DJ", "E", "F", "PL", "UP", "W"] + +[tool.ruff.per-file-ignores] +"tests/wizard/test_forms.py" = ["DJ007", "DJ008"] +"tests/wizard/wizardtests/tests.py" = ["DJ007"] diff --git a/tests/requirements.txt b/tests/requirements.txt index e0c7a88..d17a8c3 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,3 +1,3 @@ coverage==7.3.2 -flake8 isort>=5.11.1, <6.0 +ruff From e815c9b375aabf0de75b93290b5974008c96c545 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 26 Nov 2023 17:37:46 +0100 Subject: [PATCH 2/2] ruff --select=UP --fix . --- formtools/wizard/views.py | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/formtools/wizard/views.py b/formtools/wizard/views.py index 07e0a6b..42783da 100644 --- a/formtools/wizard/views.py +++ b/formtools/wizard/views.py @@ -41,7 +41,7 @@ def __len__(self): return self.count def __repr__(self): - return '' % (self._wizard, self.all) + return f'' @property def all(self): @@ -109,7 +109,7 @@ class based views. template_name = 'formtools/wizard/wizard_form.html' def __repr__(self): - return '<%s: forms: %s>' % (self.__class__.__name__, self.form_list) + return f'<{self.__class__.__name__}: forms: {self.form_list}>' @classonlymethod def as_view(cls, *args, **kwargs): diff --git a/pyproject.toml b/pyproject.toml index 48170ef..b2db56f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,7 +68,7 @@ line_length = 79 multi_line_output = 5 [tool.ruff] -ignore = ["PLW2901", "UP031", "UP032"] +ignore = ["PLW2901"] line-length = 119 select = ["ASYNC", "C4", "C90", "DJ", "E", "F", "PL", "UP", "W"]