mirror of
https://github.com/kjanat/livegraphs-django.git
synced 2026-01-16 08:42:07 +01:00
Add configuration and scripts for linting, testing, and dependency management
- Introduced .pre-commit-config.yaml for pre-commit hooks using uv-pre-commit. - Created lint.sh script to run Ruff and Black for linting and formatting. - Added test.sh script to execute tests with coverage reporting. - Configured .uv file for uv settings including lockfile management and dependency resolution. - Updated Makefile with targets for virtual environment setup, dependency installation, linting, testing, formatting, and database migrations. - Established requirements.txt with main and development dependencies for the project.
This commit is contained in:
92
.pre-commit-config.yaml
Normal file
92
.pre-commit-config.yaml
Normal file
@ -0,0 +1,92 @@
|
||||
default_install_hook_types:
|
||||
- pre-commit
|
||||
- post-checkout
|
||||
- post-merge
|
||||
- post-rewrite
|
||||
repos:
|
||||
# uv hooks for dependency management
|
||||
- repo: https://github.com/astral-sh/uv-pre-commit
|
||||
rev: 0.7.5
|
||||
hooks:
|
||||
- id: uv-export
|
||||
|
||||
# Standard pre-commit hooks
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-json
|
||||
- id: check-toml
|
||||
- id: check-added-large-files
|
||||
args: ["--maxkb=500"]
|
||||
- id: detect-private-key
|
||||
- id: check-merge-conflict
|
||||
- id: check-case-conflict
|
||||
- id: debug-statements
|
||||
- id: mixed-line-ending
|
||||
args: ["--fix=lf"]
|
||||
|
||||
# # HTML/Django template linting
|
||||
# - repo: https://github.com/rtts/djhtml
|
||||
# rev: 3.0.7
|
||||
# hooks:
|
||||
# - id: djhtml
|
||||
# entry: djhtml --tabwidth 4 --
|
||||
# - id: djcss
|
||||
# - id: djjs
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v4.0.0-alpha.8
|
||||
hooks:
|
||||
- id: prettier
|
||||
types_or: [javascript, jsx, ts, tsx, css, scss, html, json, yaml, markdown]
|
||||
additional_dependencies:
|
||||
- prettier
|
||||
- prettier-plugin-jinja-template
|
||||
|
||||
# Ruff for linting and formatting
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.11.10
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix]
|
||||
- id: ruff-format
|
||||
|
||||
# Django-specific hooks
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: django-check
|
||||
name: Django Check
|
||||
entry: uv run python dashboard_project/manage.py check
|
||||
language: system
|
||||
pass_filenames: false
|
||||
types: [python]
|
||||
always_run: true
|
||||
|
||||
- id: django-check-migrations
|
||||
name: Django Check Migrations
|
||||
entry: uv run python dashboard_project/manage.py makemigrations --check --dry-run
|
||||
language: system
|
||||
pass_filenames: false
|
||||
types: [python]
|
||||
|
||||
# Security checks
|
||||
- repo: https://github.com/pycqa/bandit
|
||||
rev: 1.8.3
|
||||
hooks:
|
||||
- id: bandit
|
||||
args: ["-c", "pyproject.toml", "-r", "dashboard_project"]
|
||||
additional_dependencies: ["bandit[toml]"]
|
||||
|
||||
# # Type checking
|
||||
# - repo: https://github.com/pre-commit/mirrors-mypy
|
||||
# rev: v1.15.0
|
||||
# hooks:
|
||||
# - id: mypy
|
||||
# additional_dependencies:
|
||||
# - django-stubs>=5.0.2
|
||||
# - types-python-dateutil
|
||||
# - types-requests
|
||||
# - types-PyYAML
|
||||
Reference in New Issue
Block a user