diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 00000000..3f9723a0 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,16 @@ +pre-commit: + parallel: false + commands: + ruff-lint: + glob: "*.py" + run: ruff check --fix {staged_files} + stage_fixed: true + + ruff-format: + glob: "*.py" + run: ruff format {staged_files} + stage_fixed: true + + mypy: + glob: "*.py" + run: mypy . diff --git a/requirements.txt b/requirements.txt index df25221b..e9778199 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,7 @@ pytest repo-smith # Developer tooling dependencies +lefthook ruff mypy PyGithub diff --git a/setup.sh b/setup.sh index fd50d7dc..0b86e374 100755 --- a/setup.sh +++ b/setup.sh @@ -7,3 +7,9 @@ fi source venv/bin/activate pip install -r requirements.txt -U --no-cache-dir + +if command -v lefthook >/dev/null 2>&1; then + lefthook install +else + echo "LeftHook not installed, failed to set up LeftHook for Git Hooks." +fi