feat: add unified linting scripts and git hooks for code quality enforcement
- Introduced `lint` and `lint-fix` applications in `flake.nix` for unified linting of backend (Python) and frontend (TypeScript/Svelte) code. - Added `scripts/lint.sh` for manual linting execution. - Created `scripts/install-hooks.sh` to set up git hooks for automatic linting before commits and optional tests before pushes. - Updated `README.md` with instructions for using the new linting features and git hooks.
This commit is contained in:
@@ -33,10 +33,6 @@ requires = ["setuptools>=61.0"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.ruff]
|
||||
# Enable pycodestyle (`E`), Pyflakes (`F`), isort (`I`)
|
||||
select = ["E", "F", "I", "W", "N", "UP", "B", "C4", "SIM"]
|
||||
ignore = []
|
||||
|
||||
# Exclude common paths
|
||||
exclude = [
|
||||
".git",
|
||||
@@ -46,16 +42,24 @@ exclude = [
|
||||
"alembic/versions",
|
||||
]
|
||||
|
||||
# Same as Black.
|
||||
line-length = 100
|
||||
|
||||
# Allow unused variables when underscore-prefixed.
|
||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||
# Line length (slightly longer for SQLAlchemy models)
|
||||
line-length = 120
|
||||
|
||||
# Target Python 3.12
|
||||
target-version = "py312"
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
[tool.ruff.lint]
|
||||
# Enable pycodestyle (`E`), Pyflakes (`F`), isort (`I`)
|
||||
select = ["E", "F", "I", "W", "N", "UP", "B", "C4", "SIM"]
|
||||
ignore = [
|
||||
"B008", # Allow Depends() in FastAPI function defaults
|
||||
"N818", # Allow WebRefException without Error suffix
|
||||
]
|
||||
|
||||
# Allow unused variables when underscore-prefixed.
|
||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"__init__.py" = ["F401"] # Allow unused imports in __init__.py
|
||||
"tests/*" = ["S101"] # Allow assert in tests
|
||||
|
||||
|
||||
Reference in New Issue
Block a user