Skip to content

replace flake8 with ruff #1462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ repos:
- id: check-yaml
- id: mixed-line-ending
args: ['--fix=lf']
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
exclude: ^(oauth2_provider/migrations/|tests/migrations/)
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.9.1
hooks:
Expand Down
10 changes: 4 additions & 6 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ add a comment stating you're working on it.
Code Style
==========

The project uses `flake8 <https://flake8.pycqa.org/en/latest/>`_ for linting,
`ruff <https://docs.astral.sh/ruff/>`_ for formatting the code and sorting imports,
and `pre-commit <https://pre-commit.com/>`_ for checking/fixing commits for
correctness before they are made.
The project uses `ruff <https://docs.astral.sh/ruff/>`_ for linting, formatting the code and sorting imports,
and `pre-commit <https://pre-commit.com/>`_ for checking/fixing commits for correctness before they are made.

You will need to install ``pre-commit`` yourself, and then ``pre-commit`` will
take care of installing ``flake8`` and ``ruff``.
take care of installing ``ruff``.

After cloning your repository, go into it and run::

Expand Down Expand Up @@ -264,7 +262,7 @@ add a comment. If you think a function is not trivial, add a docstrings.

To see if your code formatting will pass muster use::

tox -e flake8
tox -e lint

The contents of this page are heavily based on the docs from `django-admin2 <https://github.com/twoscoops/django-admin2>`_

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ ignore-words-list = 'assertIn'

[tool.ruff]
line-length = 110
exclude = [".tox", "oauth2_provider/migrations/", "tests/migrations/", "manage.py"]
exclude = [".tox", "build/", "dist/", "docs/", "oauth2_provider/migrations/", "tests/migrations/", "manage.py"]

[tool.ruff.lint]
select = ["I", "Q"]
select = ["E", "F", "I", "Q", "W"]

[tool.ruff.lint.isort]
lines-after-imports = 2
Expand Down
20 changes: 7 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist =
flake8,
migrations,
migrate_swapped,
docs,
lint,
sphinxlint,
py{38,39,310,311,312}-dj42,
py{310,311,312}-dj50,
Expand All @@ -12,7 +12,7 @@ envlist =

[gh-actions]
python =
3.8: py38, docs, flake8, migrations, migrate_swapped, sphinxlint
3.8: py38, docs, lint, migrations, migrate_swapped, sphinxlint
3.9: py39
3.10: py310
3.11: py311
Expand Down Expand Up @@ -92,12 +92,13 @@ deps =
jwcrypto
django

[testenv:flake8]
[testenv:lint]
basepython = python3.8
deps = ruff>=0.6
skip_install = True
commands = flake8 {toxinidir}
deps =
flake8
commands =
ruff format --check
ruff check

[testenv:migrations]
setenv =
Expand Down Expand Up @@ -129,10 +130,3 @@ omit = */migrations/*

[coverage:report]
show_missing = True

[flake8]
max-line-length = 110
exclude = docs/, oauth2_provider/migrations/, tests/migrations/, .tox/, build/, dist/
application-import-names = oauth2_provider
inline-quotes = double
extend-ignore = E203, W503
Loading