From beac9584cbbbc7618327c17df0b6e3791397c6b0 Mon Sep 17 00:00:00 2001 From: Alexander Minges Date: Thu, 17 Jul 2025 15:09:39 +0200 Subject: [PATCH] style: add type hints to lint-commit.py --- scripts/lint-commit.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/lint-commit.py b/scripts/lint-commit.py index a424e43..a37ed4f 100644 --- a/scripts/lint-commit.py +++ b/scripts/lint-commit.py @@ -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"]