From 3fdaec3b47b5cceee29df39a6bfe25d9d0de3d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 23 Nov 2024 18:04:51 +0100 Subject: [PATCH] ci: add fastapi linter --- pyproject.toml | 1 + src/runboat/webhooks.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c026c59..ef226f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ select = [ "T20", # flake8-print "PLE", # pylint errors "RUF", + "FAST", # fastapi ] [tool.ruff.lint.mccabe] diff --git a/src/runboat/webhooks.py b/src/runboat/webhooks.py index ec81d26..f3e5cbc 100644 --- a/src/runboat/webhooks.py +++ b/src/runboat/webhooks.py @@ -1,5 +1,6 @@ import hmac import logging +from typing import Annotated from fastapi import APIRouter, BackgroundTasks, Header, Request @@ -31,8 +32,8 @@ def _verify_github_signature( async def receive_payload( background_tasks: BackgroundTasks, request: Request, - x_github_event: str = Header(...), - x_hub_signature_256: str | None = Header(None), + x_github_event: Annotated[str, Header(...)], + x_hub_signature_256: Annotated[str | None, Header(None)], ) -> None: body = await request.body() if not _verify_github_signature(