diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 583a2b0184..55e0fc617a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,15 +5,18 @@ default_stages: [commit, push] default_language_version: python: python3 repos: - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + - repo: https://github.com/charliermarsh/ruff-pre-commit + # Ruff version. + rev: 'v0.0.224' hooks: - - id: flake8 - args: [ - --max-line-length=100 - ] - exclude: ^(venv/|docs/) - types: ['python'] + - id: ruff + # Respect `exclude` and `extend-exclude` settings. + args: ["--force-exclude"] + - repo: https://github.com/psf/black + rev: 22.12.0 + hooks: + - id: black + language_version: python3.8 - repo: https://github.com/codespell-project/codespell rev: v2.2.5 hooks: diff --git a/pyproject.toml b/pyproject.toml index 4beb357bb0..4b293b90e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,42 @@ version_scheme = "guess-next-dev" local_scheme = "dirty-tag" write_to = "zarr/version.py" +[tool.ruff] +line-length = 100 +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".mypy_cache", + ".nox", + ".pants.d", + ".ruff_cache", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "venv", + "docs" +] + +[tool.black] +line-length = 100 +exclude = ''' +/( + \.git + | \.mypy_cache + | \.venv + | _build + | buck-out + | build + | dist + | docs +)/ +''' + [tool.mypy] python_version = "3.8" ignore_missing_imports = true