Skip to content

Commit 2e3aa83

Browse files
committed
Use ruff
1 parent e47eb92 commit 2e3aa83

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,12 @@ repos:
1313
- id: mixed-line-ending
1414
- repo: https://github.com/astral-sh/ruff-pre-commit
1515
# Ruff version.
16-
rev: 'v0.2.0'
16+
rev: 'v0.2.1'
1717
hooks:
1818
- id: ruff
1919
args: ["--fix", "--show-fixes"]
20-
# https://github.com/python/black#version-control-integration
21-
- repo: https://github.com/psf/black-pre-commit-mirror
22-
rev: 24.1.1
23-
hooks:
24-
- id: black-jupyter
25-
- repo: https://github.com/keewis/blackdoc
26-
rev: v0.3.9
27-
hooks:
28-
- id: blackdoc
29-
exclude: "generate_aggregations.py"
30-
additional_dependencies: ["black==24.1.1"]
31-
- id: blackdoc-autoupdate-black
20+
- id: ruff-format
21+
types_or: [ python, pyi, jupyter ]
3222
- repo: https://github.com/pre-commit/mirrors-mypy
3323
rev: v1.8.0
3424
hooks:

pyproject.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING"]
8686
[tool.mypy]
8787
enable_error_code = "redundant-self"
8888
exclude = [
89-
'xarray/util/generate_.*\.py',
90-
'xarray/datatree_/.*\.py',
89+
'xarray/util/generate_.*\.py',
90+
'xarray/datatree_/.*\.py',
9191
]
9292
files = "xarray"
9393
show_error_codes = true
@@ -247,7 +247,6 @@ reportMissingTypeStubs = false
247247
[tool.ruff]
248248
builtins = ["ellipsis"]
249249
extend-exclude = [
250-
"doc",
251250
"_typed_ops.pyi",
252251
]
253252
target-version = "py39"
@@ -256,6 +255,9 @@ target-version = "py39"
256255
# E402: module level import not at top of file
257256
# E501: line too long - let black worry about that
258257
# E731: do not assign a lambda expression, use a def
258+
extend-safe-fixes = [
259+
"TID252", # absolute imports
260+
]
259261
ignore = [
260262
"E402",
261263
"E501",
@@ -269,9 +271,6 @@ select = [
269271
"I", # isort
270272
"UP", # Pyupgrade
271273
]
272-
extend-safe-fixes = [
273-
"TID252", # absolute imports
274-
]
275274

276275
[tool.ruff.lint.per-file-ignores]
277276
# don't enforce absolute imports
@@ -284,6 +283,13 @@ known-first-party = ["xarray"]
284283
# Disallow all relative imports.
285284
ban-relative-imports = "all"
286285

286+
[tool.ruff.lint.pydocstyle]
287+
convention = "numpy"
288+
289+
[tool.ruff.format]
290+
docstring-code-format = true
291+
preview = false
292+
287293
[tool.pytest.ini_options]
288294
addopts = ["--strict-config", "--strict-markers"]
289295
filterwarnings = [

0 commit comments

Comments
 (0)