Skip to content

Commit

Permalink
Switch to ruff for linting
Browse files Browse the repository at this point in the history
Ruff is a newer linter which re-implements flake8 (plus a few of its
plugins), isort and pyupgrade into one single codebase. It's stupid
fast, and after some testing is proving to be quite reliable.
  • Loading branch information
WhyNotHugo committed Jan 17, 2023
1 parent 37b6970 commit 6c9f8d4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 deletions.
24 changes: 6 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,10 @@ repos:
- id: check-toml
- id: check-added-large-files
- id: debug-statements
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/psf/black
rev: "22.10.0"
rev: "22.12.0"
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: "6.0.0" # pick a git hash / tag to point to
hooks:
- id: flake8
additional_dependencies:
- flake8-comprehensions
- flake8-bugbear
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.991"
hooks:
Expand All @@ -39,3 +22,8 @@ repos:
- types-freezegun
- types-pytz
- types-python-dateutil
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.224'
hooks:
- id: ruff
args: ["--force-exclude"]
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
[tool.ruff]
exclude = [
".tox",
"build",
".eggs",
]
select = [
"E",
"F",
"W",
"B",
"I",
"UP",
# "N",
# "ANN",
# "A",
"C4",
# "PT",
# "SIM",
"TID",
]
target-version = "py38"

[tool.ruff.isort]
force-single-line = true

[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]

Expand Down
3 changes: 1 addition & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
flake8
flake8-import-order
freezegun
hypothesis
pytest
pytest-cov
pytest-runner
ruff
12 changes: 0 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
[flake8]
exclude=.tox,build,.eggs
extend-ignore =
# Black-incompatible colon spacing.
E203,
# Line jump before binary operator.
W503,
max-line-length = 88

[aliases]
test=pytest

[tool:pytest]
testpaths = tests
addopts = --cov=todoman --cov-report=term-missing --color=yes --verbose

[isort]
force_single_line=true

[mypy]
ignore_missing_imports = True
# See https://github.com/python/mypy/issues/7511:
Expand Down

0 comments on commit 6c9f8d4

Please sign in to comment.