Skip to content

Commit

Permalink
Use ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Feb 5, 2024
1 parent e679484 commit 3d8fc4a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ jobs:
run: pip install tox
- name: isort
run: tox -e isort
- name: flake8
run: tox -e flake8
- name: ruff
run: tox -e ruff
19 changes: 18 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tests = [
"tox",
]
linting = [
"flake8<=6.99",
"ruff",
"isort<=5.99",
]

Expand All @@ -70,6 +70,23 @@ Homepage = "https://github.com/jazzband/django-two-factor-auth"
Documentation = "https://django-two-factor-auth.readthedocs.io/en/stable/"
Changelog = "https://github.com/jazzband/django-two-factor-auth/blob/master/CHANGELOG.md"

[tool.ruff]
line-length = 119
target-version = "py38"
extend-exclude = ["docs"]

[tool.ruff.lint]
select = [
"F", # Pyflakes
"E", # pycodestyle (Error)
"W", # pycodestyle (Warning)
# "I", # isort (waiting for https://github.com/astral-sh/ruff/issues/2600)
]

# [tool.ruff.lint.isort]
# combine-as-imports = true
# known-first-party = ["two_factor"]

[tool.isort]
combine_as_imports = true
default_section = "THIRDPARTY"
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ commands =
coverage run {env:COVERAGE_OPTIONS:} {envbindir}/django-admin test -v 2 --pythonpath=./ --settings=tests.settings
coverage report

[testenv:flake8]
[testenv:ruff]
basepython = python3
extras = linting
commands = flake8 example tests two_factor
commands = ruff

[testenv:isort]
basepython = python3
Expand Down
11 changes: 11 additions & 0 deletions two_factor/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,14 @@
)
from .mixins import OTPRequiredMixin
from .profile import DisableView, ProfileView

__all__ = (
"BackupTokensView",
"LoginView",
"QRGeneratorView",
"SetupCompleteView",
"SetupView",
"OTPRequiredMixin",
"DisableView",
"ProfileView"
)

0 comments on commit 3d8fc4a

Please sign in to comment.