Skip to content

Commit

Permalink
move to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
blancadesal committed Feb 10, 2024
1 parent 7f9bd56 commit 87e9a86
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 39 deletions.
25 changes: 6 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,13 @@ ci:
submodules: false

repos:
- repo: https://github.com/psf/black
rev: 24.1.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: black
language_version: python3.9

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
# args: ["--profile", "black", "--filter-files"]
additional_dependencies: [toml]
files: \.py$
language_version: python3.9

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
language_version: python3.9
# Run the linter.
- id: ruff
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
Expand Down
8 changes: 2 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Below are a few examples of how to run tox:
Code style
----------

- We use flake8_ to enforce `PEP 8`_ conventions, isort_ to sort our imports, and we use the black_ formatter with a line length of 88 characters.
- We use ruff_ for linting and formatting Python code.
Static typing is enforced using mypy_.
Code that does not follow these conventions won't pass our CI.
These tools are configured in either ``tox.ini`` or ``pyproject.toml``.
Expand Down Expand Up @@ -144,15 +144,11 @@ Docs
- If you add a new feature, include one or more usage examples in ``examples.rst``.


.. _`PEP 8`: https://www.python.org/dev/peps/pep-0008/backward-compatibility.html
.. _tox: https://tox.readthedocs.io/
.. _reStructuredText: https://www.sphinx-doc.org/en/stable/usage/
.. _`Sphinx-style format`: https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html#the-sphinx-docstring-format
.. _semantic newlines: https://rhodesmill.org/brandon/2012/one-sentence-per-line/restructuredtext/basics.html
.. _CI: https://github.com/blancadesal/mwsql/actions
.. _black: https://github.com/psf/black
.. _pre-commit: https://pre-commit.com/
.. _isort: https://github.com/PyCQA/isort
.. _flake8: https://flake8.pycqa.org/en/latest/
.. _ruff: https://github.com/astral-sh/ruff-pre-commit
.. _mypy: https://mypy.readthedocs.io/en/stable/
.. _pytest: https://docs.pytest.org/en/6.2.x/
7 changes: 0 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,3 @@ toml = "^0.10.2"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 88

[tool.isort]
profile = "black"
multi_line_output = 3
7 changes: 0 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,3 @@ commands =
basepython = python3.9
commands =
poetry run mypy ./src

[flake8]
# Match the Black line length (default 88),
# rather than using the flake8 default of 79:
max-line-length = 88
extend-ignore = E203, W503
ignore = E127, E501

0 comments on commit 87e9a86

Please sign in to comment.