From 488c839f6bef446c0567dfb27d0b4343f746aaaf Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sat, 16 Mar 2024 09:13:27 +0100 Subject: [PATCH] Use ruff instead of flake8 and isort --- .github/workflows/tests.yml | 4 +--- docs/contribute.rst | 9 +++------ pyproject.toml | 8 ++++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8de9881..fd08565 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,6 +38,4 @@ jobs: - name: Launch tests run: python -m pytest - name: Check coding style - run: python -m flake8 - - name: Check imports order - run: python -m isort . --check --diff + run: python -m ruff check diff --git a/docs/contribute.rst b/docs/contribute.rst index f94a3d6..d14e6b9 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -50,16 +50,13 @@ You can launch tests using the following command:: venv/bin/pytest -WeasyPrint also uses isort_ to check imports and flake8_ to check the coding -style:: +pydyf also uses ruff_ to check the coding style:: - venv/bin/python -m isort . --check --diff - venv/bin/python -m flake8 + venv/bin/python -m ruff check .. _pytest: https://docs.pytest.org/ .. _Ghostscript: https://www.ghostscript.com/ -.. _isort: https://pycqa.github.io/isort/ -.. _flake8: https://flake8.pycqa.org/ +.. _ruff: https://docs.astral.sh/ruff/ Documentation diff --git a/pyproject.toml b/pyproject.toml index 795dc43..0096863 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Donation = 'https://opencollective.com/courtbouillon' [project.optional-dependencies] doc = ['sphinx', 'sphinx_rtd_theme'] -test = ['pytest', 'isort', 'flake8', 'pillow'] +test = ['pytest', 'ruff', 'pillow'] [tool.flit.sdist] exclude = ['.*'] @@ -52,6 +52,6 @@ include = ['tests/*', 'pydyf/*'] exclude_lines = ['pragma: no cover', 'def __repr__', 'raise NotImplementedError'] omit = ['.*'] -[tool.isort] -default_section = 'FIRSTPARTY' -multi_line_output = 4 +[tool.ruff.lint] +select = ['E', 'W', 'F', 'I', 'N', 'RUF'] +ignore = ['RUF001', 'RUF002', 'RUF003']