mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 05:29:12 +00:00
Replace isort, black with ruff for faster linting, formatting
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: 23.1.0
|
rev: v0.12.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: ruff-check
|
||||||
|
args: [ --fix ]
|
||||||
|
files: \.py$
|
||||||
|
- id: ruff-format
|
||||||
|
files: \.py$
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v4.4.0
|
||||||
@@ -16,13 +20,6 @@ repos:
|
|||||||
- id: check-toml
|
- id: check-toml
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
|
|
||||||
- repo: https://github.com/pycqa/isort
|
|
||||||
rev: 5.12.0
|
|
||||||
hooks:
|
|
||||||
- id: isort
|
|
||||||
name: isort (python)
|
|
||||||
args: ["--profile", "black", "--filter-files"]
|
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v1.0.0
|
rev: v1.0.0
|
||||||
hooks:
|
hooks:
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ dev = [
|
|||||||
"freezegun >= 1.2.0",
|
"freezegun >= 1.2.0",
|
||||||
"factory-boy >= 3.2.1",
|
"factory-boy >= 3.2.1",
|
||||||
"mypy >= 1.0.1",
|
"mypy >= 1.0.1",
|
||||||
"black >= 23.1.0",
|
"ruff >= 0.12.0",
|
||||||
"pre-commit >= 3.0.4",
|
"pre-commit >= 3.0.4",
|
||||||
"gitpython ~= 3.1.43",
|
"gitpython ~= 3.1.43",
|
||||||
"datasets",
|
"datasets",
|
||||||
@@ -149,11 +149,31 @@ non_interactive = true
|
|||||||
show_error_codes = true
|
show_error_codes = true
|
||||||
warn_unused_ignores = false
|
warn_unused_ignores = false
|
||||||
|
|
||||||
[tool.black]
|
[tool.ruff]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
|
|
||||||
[tool.isort]
|
[tool.ruff.lint]
|
||||||
profile = "black"
|
select = ["E", "F", "I"] # Enable error, warning, and import checks
|
||||||
|
ignore = [
|
||||||
|
"E501", # Ignore line length
|
||||||
|
"F405", # Ignore name not defined (e.g., from imports)
|
||||||
|
"E402", # Ignore module level import not at top of file
|
||||||
|
]
|
||||||
|
unfixable = ["F841"] # Don't auto-remove unused variables
|
||||||
|
exclude = [ "tests/*.py" ]
|
||||||
|
[tool.ruff.lint.per-file-ignores]
|
||||||
|
"src/khoj/main.py" = [
|
||||||
|
"I001", # Ignore Import order
|
||||||
|
"I002", # Ignore Import not at top of file
|
||||||
|
"E402", # Ignore module level import not at top of file
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.ruff.format]
|
||||||
|
quote-style = "double"
|
||||||
|
indent-style = "space"
|
||||||
|
|
||||||
|
[tool.ruff.lint.isort]
|
||||||
|
known-first-party = ["khoj"]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
addopts = "--strict-markers"
|
addopts = "--strict-markers"
|
||||||
|
|||||||
Reference in New Issue
Block a user