From 2897c6704d1311a800ce5aa47878d96d6980b377 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Sun, 7 Jan 2024 17:29:21 +0100 Subject: [PATCH] replaced flake8 with ruff mostly for speed improvements --- .pre-commit-config.yaml | 24 +++++++----------------- pyproject.toml | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd43f93b65..17f20ae78b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,8 @@ exclude: | (?x)^( InvenTree/InvenTree/static/.*| InvenTree/locale/.*| - src/frontend/src/locales/.* + src/frontend/src/locales/.*| + .*/migrations/.* )$ repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -14,23 +15,12 @@ repos: - id: end-of-file-fixer - id: check-yaml - id: mixed-line-ending -- repo: https://github.com/pycqa/flake8 - rev: '6.1.0' +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.11 hooks: - - id: flake8 - additional_dependencies: [ - 'flake8-bugbear', - 'flake8-comprehensions', - 'flake8-docstrings', - 'flake8-string-format', - 'flake8-tidy-imports', - 'pep8-naming', - 'flake8-logging' - ] -- repo: https://github.com/pycqa/isort - rev: '5.12.0' - hooks: - - id: isort + - id: ruff + args: [--fix] + - id: ruff-format - repo: https://github.com/jazzband/pip-tools rev: 7.3.0 hooks: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..2b4fe992c5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ + +[tool.ruff] +exclude=[".git","__pycache__","dist","build","test.py","tests", "venv","env",".venv",".env"] + +[tool.ruff.lint] +select = ["A", "B", "C4", "D", "DJ", "LOG", "N", "I","S"] +ignore = ["N999", ] + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.ruff.lint.isort] +combine-as-imports = true +section-order = ["future", "standard-library", "django", "third-party", "first-party", "local-folder" ] +known-first-party = ["src", "plugin", "InvenTree", "common"] + +[tool.ruff.lint.isort.sections] +"django" = ["django"]