gns3-server/justfile
YueGuobin fa3dd827f9
chore: add pre-commit hook running ruff and mypy checks on staged files
Mirrors the fast static checks from CI (justfile lint + type-check):
ruff check, ruff format --check and mypy (gns3server package only,
matching the files = ["gns3server"] scope in pyproject.toml). Only
staged Python files are checked; pytest and pip check are left to CI.

Enable with: just install-hooks
2026-10-15 22:44:24 +08:00

45 lines
1.0 KiB
Makefile

set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
_default:
@just --list --unsorted --list-submodules
# Install the server with all optional features and dev tools
[group('dev')]
install:
python -m pip install --upgrade pip
python -m pip install -e '.[ai-features,dev]'
# Install the git pre-commit hook (lint + type-check on staged files)
[group('dev')]
install-hooks:
git config core.hooksPath .githooks
# Apply ruff autofixes for the enforced rules
[group('dev')]
format:
python -m ruff check --fix
python -m ruff format
# Run ruff checks (no fixes)
[group('dev')]
lint:
python -m ruff check --exit-non-zero-on-fix
python -m ruff format --check --diff
[group('dev')]
type-check:
python -m mypy
# Run tests with coverage, e.g. `just unit tests/controller`
[group('test')]
unit *args='':
python -m pytest --cov --cov-report=term-missing:skip-covered --cov-report=xml {{ args }}
[group('test')]
package:
pip check
# Run all checks
[group('test')]
test: package lint type-check unit