From e5bab778dfb1a9994f881bdd2be1feaf49eaf50a Mon Sep 17 00:00:00 2001 From: Irv Lustig Date: Mon, 30 Jun 2025 12:52:17 -0400 Subject: [PATCH] CI: if no docstring, create error GL08 and don't validate - fix for numpydoc 1.9 (#61744) * if no docstring, create error GL08 and don't validate * add file and file_line as None if no docstring (cherry picked from commit 30a2e7fb239e63beab44c7c459517eb4d2908a0d) --- scripts/validate_docstrings.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/validate_docstrings.py b/scripts/validate_docstrings.py index 76d64d27b221c..cad5e83a03cfa 100755 --- a/scripts/validate_docstrings.py +++ b/scripts/validate_docstrings.py @@ -269,8 +269,15 @@ def pandas_validate(func_name: str): # Some objects are instances, e.g. IndexSlice, which numpydoc can't validate doc_obj = get_doc_object(func_obj, doc=func_obj.__doc__) doc = PandasDocstring(func_name, doc_obj) - result = validate(doc_obj) - + if func_obj.__doc__ is not None: + result = validate(doc_obj) + else: + result = { + "docstring": "", + "file": None, + "file_line": None, + "errors": [("GL08", "The object does not have a docstring")], + } mentioned_errs = doc.mentioned_private_classes if mentioned_errs: result["errors"].append(