Skip to content

Commit c1e6076

Browse files
authored
pre-commit hook maintenance (#44)
* use the `black` mirror * replace `isort` and `flake8` with `ruff` * use a working mirror of `prettier` * use `taplo` * remove the redundant `yaml` check
1 parent cc3bddf commit c1e6076

File tree

4 files changed

+61
-29
lines changed

4 files changed

+61
-29
lines changed

.flake8

Lines changed: 0 additions & 13 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/.hypothesis/
22
__pycache__/
3+
4+
/.prettier_cache/

.pre-commit-config.yaml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,28 @@ repos:
77
hooks:
88
- id: trailing-whitespace
99
- id: end-of-file-fixer
10-
- id: check-yaml
1110

12-
- repo: https://github.com/psf/black
11+
- repo: https://github.com/psf/black-pre-commit-mirror
1312
rev: 24.10.0
1413
hooks:
1514
- id: black
1615

17-
- repo: https://github.com/pycqa/isort
18-
rev: 5.13.2
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.8.2
1918
hooks:
20-
- id: isort
19+
- id: ruff
20+
args: ["--fix", "--show-fixes"]
2121

22-
- repo: https://github.com/pycqa/flake8
23-
rev: 7.1.1
22+
- repo: https://github.com/rbubley/mirrors-prettier
23+
rev: v3.4.2
2424
hooks:
25-
- id: flake8
25+
- id: prettier
26+
args: ["--cache-location=.prettier_cache/cache"]
2627

27-
- repo: https://github.com/pre-commit/mirrors-prettier
28-
rev: v4.0.0-alpha.8
28+
- repo: https://github.com/ComPWA/taplo-pre-commit
29+
rev: v0.9.3
2930
hooks:
30-
- id: prettier
31+
- id: taplo-format
32+
args: ["--option", "array_auto_collapse=false"]
33+
- id: taplo-lint
34+
args: ["--no-schema"]

pyproject.toml

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
1-
[tool.isort]
2-
profile = "black"
3-
skip_gitignore = true
4-
float_to_top = true
5-
default_section = "THIRDPARTY"
1+
[tool.ruff]
2+
target-version = "py310"
3+
builtins = ["ellipsis"]
4+
exclude = [
5+
".git",
6+
".eggs",
7+
"build",
8+
"dist",
9+
"__pycache__",
10+
]
11+
line-length = 100
12+
13+
[tool.ruff.lint]
14+
# E402: module level import not at top of file
15+
# E501: line too long - let black worry about that
16+
# E731: do not assign a lambda expression, use a def
17+
ignore = [
18+
"E402",
19+
"E501",
20+
"E731",
21+
]
22+
select = [
23+
"F", # Pyflakes
24+
"E", # Pycodestyle
25+
"I", # isort
26+
"UP", # Pyupgrade
27+
"TID", # flake8-tidy-imports
28+
"W",
29+
]
30+
extend-safe-fixes = [
31+
"TID252", # absolute imports
32+
]
33+
fixable = ["I", "TID252"]
34+
35+
[tool.ruff.lint.flake8-tidy-imports]
36+
# Disallow all relative imports.
37+
ban-relative-imports = "all"
38+
39+
[tool.coverage.run]
40+
branch = true
41+
42+
[tool.coverage.report]
43+
show_missing = true
44+
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING"]

0 commit comments

Comments
 (0)