Skip to content

Commit 9c8137a

Browse files
committed
style: add ruff and black to pre-commit
[pre-commit.ci skip]
1 parent aa5db9f commit 9c8137a

File tree

2 files changed

+47
-8
lines changed

2 files changed

+47
-8
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ default_stages: [commit, push]
55
default_language_version:
66
python: python3
77
repos:
8-
- repo: https://github.com/PyCQA/flake8
9-
rev: 6.0.0
8+
- repo: https://github.com/charliermarsh/ruff-pre-commit
9+
# Ruff version.
10+
rev: 'v0.0.224'
1011
hooks:
11-
- id: flake8
12-
args: [
13-
--max-line-length=100
14-
]
15-
exclude: ^(venv/|docs/)
16-
types: ['python']
12+
- id: ruff
13+
# Respect `exclude` and `extend-exclude` settings.
14+
args: ["--force-exclude"]
15+
- repo: https://github.com/psf/black
16+
rev: 22.12.0
17+
hooks:
18+
- id: black
19+
language_version: python3.8
1720
- repo: https://github.com/codespell-project/codespell
1821
rev: v2.2.5
1922
hooks:

pyproject.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,42 @@ version_scheme = "guess-next-dev"
7272
local_scheme = "dirty-tag"
7373
write_to = "zarr/version.py"
7474

75+
[tool.ruff]
76+
line-length = 100
77+
exclude = [
78+
".bzr",
79+
".direnv",
80+
".eggs",
81+
".git",
82+
".mypy_cache",
83+
".nox",
84+
".pants.d",
85+
".ruff_cache",
86+
".venv",
87+
"__pypackages__",
88+
"_build",
89+
"buck-out",
90+
"build",
91+
"dist",
92+
"venv",
93+
"docs"
94+
]
95+
96+
[tool.black]
97+
line-length = 100
98+
exclude = '''
99+
/(
100+
\.git
101+
| \.mypy_cache
102+
| \.venv
103+
| _build
104+
| buck-out
105+
| build
106+
| dist
107+
| docs
108+
)/
109+
'''
110+
75111
[tool.mypy]
76112
python_version = "3.8"
77113
ignore_missing_imports = true

0 commit comments

Comments
 (0)