From eb58cd162a3b5a171e645cadfc65739fdcf93040 Mon Sep 17 00:00:00 2001 From: Thomas Bean <47thomasj@gmail.com> Date: Fri, 12 Sep 2025 13:06:28 -0600 Subject: [PATCH] Fix missing 'Returns:' section check for functions with None return type --- checkers/common_nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkers/common_nodes.py b/checkers/common_nodes.py index b77bf36..4416386 100644 --- a/checkers/common_nodes.py +++ b/checkers/common_nodes.py @@ -338,7 +338,7 @@ def _check_missing_returns_section(node: ast.FunctionDef | ast.AsyncFunctionDef, list containing a style error if the Returns section is missing, or empty list otherwise """ errors = [] - if not _has_return_or_yield_section(docstring): + if not _has_return_or_yield_section(docstring) and not (isinstance(node.returns, ast.Constant) and node.returns.value is None): error = error_creation_module.create_error(node, 'D307', f"Function '{node.name}' missing 'Returns:' or 'Yields:' section in docstring", file_path, ignore_codes) if error: errors.append(error)