replaced flake8 with ruff

mostly for speed improvements
This commit is contained in:
Matthias Mair 2024-01-07 17:29:21 +01:00
parent 93df90d295
commit 2897c6704d
No known key found for this signature in database
GPG Key ID: A593429DDA23B66A
2 changed files with 25 additions and 17 deletions

View File

@ -4,7 +4,8 @@ exclude: |
(?x)^( (?x)^(
InvenTree/InvenTree/static/.*| InvenTree/InvenTree/static/.*|
InvenTree/locale/.*| InvenTree/locale/.*|
src/frontend/src/locales/.* src/frontend/src/locales/.*|
.*/migrations/.*
)$ )$
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
@ -14,23 +15,12 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-yaml - id: check-yaml
- id: mixed-line-ending - id: mixed-line-ending
- repo: https://github.com/pycqa/flake8 - repo: https://github.com/astral-sh/ruff-pre-commit
rev: '6.1.0' rev: v0.1.11
hooks: hooks:
- id: flake8 - id: ruff
additional_dependencies: [ args: [--fix]
'flake8-bugbear', - id: ruff-format
'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
- repo: https://github.com/jazzband/pip-tools - repo: https://github.com/jazzband/pip-tools
rev: 7.3.0 rev: 7.3.0
hooks: hooks:

18
pyproject.toml Normal file
View File

@ -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"]