style: add type hints to lint-commit.py

This commit is contained in:
Alexander Minges 2025-07-17 15:09:39 +02:00
parent f9b8cfa71d
commit beac9584cb
Signed by: Athemis
SSH key fingerprint: SHA256:TUXshgulbwL+FRYvBNo54pCsI0auROsSEgSvueKbkZ4

View file

@ -23,7 +23,9 @@ import sys
from pathlib import Path
def run_command(cmd, check=True):
def run_command(
cmd: list[str], check: bool = True
) -> subprocess.CompletedProcess[str] | subprocess.CalledProcessError:
"""Run a shell command and return the result."""
try:
result = subprocess.run(cmd, capture_output=True, text=True, check=check)
@ -46,7 +48,11 @@ def check_gitlint_installed():
sys.exit(1)
def lint_commit(commit_hash=None, commit_range=None, staged=False):
def lint_commit(
commit_hash: str | None = None,
commit_range: str | None = None,
staged: bool = False,
) -> bool:
"""Lint commit message(s) using gitlint."""
# Build gitlint command
cmd = ["gitlint"]