chore: add D212 lint rule to enforce Google-style docstrings (#1892)

This commit is contained in:
Felix Weinberger 2026-01-16 16:10:52 +00:00 • committed by GitHub
commit d41d0c0128
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 452 additions and 925 deletions

View file

@ -1,6 +1,4 @@
"""
Tests for the AuthContext middleware components.
"""
"""Tests for the AuthContext middleware components."""
import time

View file

@ -1,6 +1,4 @@
"""
Tests for the BearerAuth middleware components.
"""
"""Tests for the BearerAuth middleware components."""
import time
from typing import Any, cast

View file

@ -1,6 +1,4 @@
"""
Tests for OAuth error handling in the auth handlers.
"""
"""Tests for OAuth error handling in the auth handlers."""
import base64
import hashlib

View file

@ -1,6 +1,4 @@
"""
Integration tests for MCP Oauth Protected Resource.
"""
"""Integration tests for MCP Oauth Protected Resource."""
from urllib.parse import urlparse

View file

@ -1,6 +1,4 @@
"""
Tests for mcp.server.auth.provider module.
"""
"""Tests for mcp.server.auth.provider module."""
from mcp.server.auth.provider import construct_redirect_uri

View file

@ -1,3 +1 @@
"""
Tests for the MCP server auth components.
"""
"""Tests for the MCP server auth components."""

View file

@ -1,6 +1,4 @@
"""
Integration tests for MCP authorization components.
"""
"""Integration tests for MCP authorization components."""
import base64
import hashlib

View file

@ -1,6 +1,4 @@
"""
Test the elicitation feature using stdio transport.
"""
"""Test the elicitation feature using stdio transport."""
from typing import Any

View file

@ -448,8 +448,7 @@ def test_complex_function_json_schema():
def test_str_vs_int():
"""
Test that string values are kept as strings even when they contain numbers,
"""Test that string values are kept as strings even when they contain numbers,
while numbers are parsed correctly.
"""
@ -463,8 +462,7 @@ def test_str_vs_int():
def test_str_annotation_preserves_json_string():
"""
Regression test for PR #1113: Ensure that when a parameter is annotated as str,
"""Regression test for PR #1113: Ensure that when a parameter is annotated as str,
valid JSON strings are NOT parsed into Python objects.
This test would fail before the fix (JSON string would be parsed to dict)
@ -514,8 +512,7 @@ def test_str_annotation_preserves_json_string():
@pytest.mark.anyio
async def test_str_annotation_runtime_validation():
"""
Regression test for PR #1113: Test runtime validation with string parameters
"""Regression test for PR #1113: Test runtime validation with string parameters
containing valid JSON to ensure they are passed as strings, not parsed objects.
"""

View file

@ -1,5 +1,4 @@
"""
Integration tests for FastMCP server functionality.
"""Integration tests for FastMCP server functionality.
These tests validate the proper functioning of FastMCP features using focused,
single-feature servers across different transports (SSE and StreamableHTTP).

View file

@ -1,6 +1,4 @@
"""
Tests for completion handler with context functionality.
"""
"""Tests for completion handler with context functionality."""
from typing import Any

View file

@ -1,5 +1,4 @@
"""
Test for race condition fix in initialization flow.
"""Test for race condition fix in initialization flow.
This test verifies that requests can be processed immediately after
responding to InitializeRequest, without waiting for InitializedNotification.
@ -20,8 +19,7 @@ from mcp.types import ServerCapabilities, Tool
@pytest.mark.anyio
async def test_request_immediately_after_initialize_response():
"""
Test that requests are accepted immediately after initialize response.
"""Test that requests are accepted immediately after initialize response.
This reproduces the race condition in stateful HTTP mode where:
1. Client sends InitializeRequest