diff --git a/.gitignore b/.gitignore index 36a05a7b2..f5cc3fade 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .idea/ .mypy_cache/ .pytest_cache/ +.ruff_cache/ .venv/ __pycache__/ drf_source/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32652669d..354669f1d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,14 +15,11 @@ repos: hooks: - id: pyupgrade args: ["--py38-plus"] - - repo: https://github.com/pycqa/isort - rev: 5.12.0 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.270 hooks: - - id: isort - name: isort (python) - - id: isort - name: isort (pyi) - types: [pyi] + - id: ruff + args: ["--fix", "--fixable=I001", "--exit-non-zero-on-fix"] - repo: https://github.com/psf/black rev: 23.3.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 2a369e0dc..587565bbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,11 +2,21 @@ line-length = 120 include = '\.pyi?$' -[tool.isort] -line_length = 120 -multi_line_output = 3 -include_trailing_comma = true -profile = 'black' +[tool.ruff] +# Adds to default excludes: https://ruff.rs/docs/settings/#exclude +extend-exclude = [ + "drf_source", + "stubgen", + "out", +] +line-length = 120 +target-version = "py38" +select = [ + "I", # isort +] + +[tool.ruff.isort] +split-on-trailing-comma = false [build-system] requires = ["setuptools<64", "wheel"]