Skip to content

Commit

Permalink
use ruff.flake8-tidy-imports to enforce absolute imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mathause committed Jan 29, 2024
1 parent e22b475 commit 8579bef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ repos:
- id: check-yaml
- id: debug-statements
- id: mixed-line-ending
- repo: https://github.com/MarcoGorelli/absolufy-imports
rev: v0.3.1
hooks:
- id: absolufy-imports
name: absolufy-imports
files: ^xarray/
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.1.9'
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ extend-exclude = [
"doc",
"_typed_ops.pyi",
]
extend-safe-fixes = [
"TID252", # absolute imports
]
target-version = "py39"

[tool.ruff.lint]
Expand All @@ -257,13 +260,18 @@ select = [
"F", # Pyflakes
"E", # Pycodestyle
"W",
"TID", # flake8-tidy-imports (absolute imports)
"I", # isort
"UP", # Pyupgrade
]

[tool.ruff.lint.isort]
known-first-party = ["xarray"]

[tool.ruff.lint.flake8-tidy-imports]
# Disallow all relative imports.
ban-relative-imports = "all"

[tool.pytest.ini_options]
addopts = ["--strict-config", "--strict-markers"]
filterwarnings = [
Expand Down

0 comments on commit 8579bef

Please sign in to comment.