refactor: strict pre-commit rules

This commit is contained in:
phv2312
2026-02-28 16:21:24 +07:00
parent fe52d208e2
commit 559abfbaa0
2 changed files with 37 additions and 46 deletions

View File

@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v5.0.0
hooks:
- id: check-yaml
args: ["--unsafe"]
@@ -14,56 +14,28 @@ repos:
- id: check-added-large-files
args: ["--maxkb=750"]
- id: debug-statements
- repo: https://github.com/ambv/black
rev: 22.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]
language_version: python3.10
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
args: ["--max-line-length", "88", "--extend-ignore", "E203"]
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
- id: ruff-check
args:
[
"--in-place",
"--remove-unused-variables",
"--remove-all-unused-imports",
"--ignore-init-module-imports",
"--exclude=tests/*",
]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
types_or: [markdown, yaml]
- --fix
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.7.1"
rev: "v1.19.1"
hooks:
- id: mypy
files: "^(libs/)"
additional_dependencies:
[
types-PyYAML==6.0.12.11,
"types-requests",
"sqlmodel",
"types-Markdown",
"types-cachetools",
types-tzlocal,
]
args: ["--check-untyped-defs", "--ignore-missing-imports"]
exclude: "^templates/"
- pydantic
- types-PyYAML==6.0.12.11,
- "types-requests"
- "sqlmodel"
- "types-Markdown"
- "types-cachetools"
- types-tzlocal
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:

View File

@@ -64,5 +64,24 @@ ignore-words-list = "llm,fo"
quiet-level = 3
check-filenames = ""
[tool.isort]
known_first_party = ["kotaemon"]
[tool.ruff]
exclude = ["*.ipynb"]
[tool.mypy]
python_version = "3.12"
files = ["libs"]
check_untyped_defs = true
disallow_untyped_defs = true
disallow_untyped_calls = true
disallow_any_generics = true
ignore_missing_imports = true
follow_imports = "normal"
no_implicit_reexport = true
warn_redundant_casts = true
warn_unused_ignores = true
plugins = ["pydantic.mypy"]
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true