style: add type hints to lint-commit.py
This commit is contained in:
parent
f9b8cfa71d
commit
beac9584cb
1 changed files with 8 additions and 2 deletions
|
@ -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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue