Skip to content

Commit 449f657

Browse files
committed
lint: switch black+import+flake8 -> Ruff
1 parent 4cb99b4 commit 449f657

File tree

2 files changed

+69
-15
lines changed

2 files changed

+69
-15
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
---
22
repos:
3-
- repo: https://github.com/psf/black-pre-commit-mirror
4-
rev: 24.2.0
5-
hooks:
6-
- id: black
7-
args: [--safe, --quiet, --target-version, py37]
83
- repo: https://github.com/pre-commit/pre-commit-hooks
94
rev: v4.5.0
105
hooks:
@@ -15,17 +10,13 @@ repos:
1510
- id: check-yaml
1611
- id: debug-statements
1712
language_version: python3
18-
- repo: https://github.com/PyCQA/flake8
19-
rev: 7.0.0
20-
hooks:
21-
- id: flake8
22-
language_version: python3
23-
additional_dependencies: [flake8-typing-imports>=1.9.0]
24-
- repo: https://github.com/asottile/reorder_python_imports
25-
rev: v3.12.0
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
rev: v0.2.0
2615
hooks:
27-
- id: reorder-python-imports
28-
args: ['--application-directories=.:src', --py3-plus]
16+
- id: ruff-format
17+
args: ["--preview"]
18+
- id: ruff
19+
args: ["--fix"]
2920
- repo: https://github.com/asottile/pyupgrade
3021
rev: v3.15.1
3122
hooks:

pyproject.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,66 @@ requires = [
33
"setuptools >= 40.0",
44
]
55
build-backend = "setuptools.build_meta"
6+
7+
8+
9+
[tool.ruff]
10+
target-version = "py38"
11+
# Enable Pyflakes `E` and `F` codes by default.
12+
lint.select = [
13+
"E",
14+
"W", # see: https://pypi.org/project/pycodestyle
15+
"F", # see: https://pypi.org/project/pyflakes
16+
"I", #see: https://pypi.org/project/isort/
17+
# "D", # see: https://pypi.org/project/pydocstyle
18+
# "N", # see: https://pypi.org/project/pep8-naming
19+
# "S", # see: https://pypi.org/project/flake8-bandit
20+
]
21+
#lint.extend-select = [
22+
# "A", # see: https://pypi.org/project/flake8-builtins
23+
# "B", # see: https://pypi.org/project/flake8-bugbear
24+
# "C4", # see: https://pypi.org/project/flake8-comprehensions
25+
# "PT", # see: https://pypi.org/project/flake8-pytest-style
26+
# "RET", # see: https://pypi.org/project/flake8-return
27+
# "SIM", # see: https://pypi.org/project/flake8-simplify
28+
# "YTT", # see: https://pypi.org/project/flake8-2020
29+
# "ANN", # see: https://pypi.org/project/flake8-annotations
30+
# "TID", # see: https://pypi.org/project/flake8-tidy-imports/
31+
# "T10", # see: https://pypi.org/project/flake8-debugger
32+
# "Q", # see: https://pypi.org/project/flake8-quotes
33+
# "RUF", # Ruff-specific rules
34+
# "EXE", # see: https://pypi.org/project/flake8-executable
35+
# "ISC", # see: https://pypi.org/project/flake8-implicit-str-concat
36+
# "PIE", # see: https://pypi.org/project/flake8-pie
37+
# "PLE", # see: https://pypi.org/project/pylint/
38+
# "PERF", # see: https://pypi.org/project/perflint/
39+
# "PYI", # see: https://pypi.org/project/flake8-pyi/
40+
#]
41+
#lint.ignore = [
42+
# "E731", # Do not assign a lambda expression, use a def
43+
# "D100", # todo: Missing docstring in public module
44+
# "D104", # todo: Missing docstring in public package
45+
# "D107", # Missing docstring in `__init__`
46+
# "ANN101", # Missing type annotation for `self` in method
47+
# "S301", # todo: `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue # todo
48+
# "S310", # todo: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. # todo
49+
# "B905", # todo: `zip()` without an explicit `strict=` parameter
50+
#]
51+
lint.ignore-init-module-imports = true
52+
lint.unfixable = ["F401"]
53+
54+
#[tool.ruff.lint.per-file-ignores]
55+
#"setup.py" = ["ANN202", "ANN401"]
56+
#"src/**" = ["ANN401"]
57+
#"tests/**" = ["S101", "ANN001", "ANN201", "ANN202", "ANN401"]
58+
59+
[tool.ruff.lint.pydocstyle]
60+
# Use Google-style docstrings.
61+
convention = "google"
62+
63+
#[tool.ruff.pycodestyle]
64+
#ignore-overlong-task-comments = true
65+
66+
[tool.ruff.lint.mccabe]
67+
# Unlike Flake8, default to a complexity level of 10.
68+
max-complexity = 10

0 commit comments

Comments
 (0)