switched to ruff for import sorting

This commit is contained in:
Matthias Mair 2024-01-07 21:14:38 +01:00
parent f83fedbbb8
commit fd74f8d703
No known key found for this signature in database
GPG Key ID: A593429DDA23B66A
3 changed files with 2 additions and 27 deletions

View File

@ -15,10 +15,6 @@ 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/isort
rev: '5.12.0'
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11 rev: v0.1.11
hooks: hooks:

View File

@ -12,17 +12,16 @@ exclude = [
".venv", ".venv",
".env", ".env",
] ]
src = ["../InvenTree"] src = ["InvenTree"]
# line-length = 120 # line-length = 120
[tool.ruff.extend-per-file-ignores] [tool.ruff.extend-per-file-ignores]
"__init__.py" = ["D104"] "__init__.py" = ["D104"]
[tool.ruff.lint] [tool.ruff.lint]
select = ["A", "B", "C4", "D", "N"] select = ["A", "B", "C4", "D", "I", "N"]
# Things that should be enabled in the future: # Things that should be enabled in the future:
# - LOG # - LOG
# - I
# - DJ # for Django stuff # - DJ # for Django stuff
# - S # for security stuff (bandit) # - S # for security stuff (bandit)
@ -63,7 +62,6 @@ section-order = [
"first-party", "first-party",
"local-folder", "local-folder",
] ]
known-first-party = ["src", "plugin", "InvenTree", "common"]
[tool.ruff.lint.isort.sections] [tool.ruff.lint.isort.sections]
"django" = ["django"] "django" = ["django"]

View File

@ -1,19 +0,0 @@
[flake8]
ignore =
# - W605 - invalid escape sequence
W605,
# - E501 - line too long (82 characters)
E501,
# - E722 - do not use bare except
E722,
# - C901 - function is too complex
C901,
# - B009 - Do not call getattr with a constant attribute value
B009
exclude = .git,__pycache__,*/migrations/*,*/lib/*,*/bin/*,*/media/*,*/static/*,InvenTree/plugins/*
[isort]
src_paths=InvenTree
skip_glob =*/migrations/*.py
known_django=django
sections=FUTURE, STDLIB, DJANGO, THIRDPARTY, FIRSTPARTY, LOCALFOLDER