Skip to content

Commit

Permalink
Replace flake8 with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored Nov 26, 2023
1 parent e7b9365 commit e56c457
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions formtools/wizard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __len__(self):
return self.count

def __repr__(self):
return '<StepsHelper for %s (steps: %s)>' % (self._wizard, self.all)
return f'<StepsHelper for {self._wizard} (steps: {self.all})>'

@property
def all(self):
Expand Down Expand Up @@ -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):
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,22 @@ zip-safe = false
exclude = ["tests"] # tests.*
namespaces = false

[tool.codespell]
skip = "*.po"

[tool.isort]
combine_as_imports = true
default_section = "THIRDPARTY"
include_trailing_comma = true
known_first_party = ["formtools"]
line_length = 79
multi_line_output = 5

[tool.ruff]
ignore = ["PLW2901"]
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"]
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
coverage==7.3.2
flake8
isort>=5.11.1, <6.0
ruff

0 comments on commit e56c457

Please sign in to comment.