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:
Danilo Reyes
2025-11-02 00:08:37 -06:00
parent 4c94793aba
commit b55ac51fe2
32 changed files with 470 additions and 171 deletions

View File

@@ -14,10 +14,10 @@ class Base(DeclarativeBase):
# Generate __tablename__ automatically from class name
@declared_attr.directive
def __tablename__(cls) -> str:
def __tablename__(self) -> str:
"""Generate table name from class name."""
# Convert CamelCase to snake_case
name = cls.__name__
name = self.__name__
return "".join(["_" + c.lower() if c.isupper() else c for c in name]).lstrip("_")
# Common columns for all models
@@ -27,4 +27,3 @@ class Base(DeclarativeBase):
def dict(self) -> dict[str, Any]:
"""Convert model to dictionary."""
return {c.name: getattr(self, c.name) for c in self.__table__.columns}