From b6691127523f965003dbf877a358c81af5012989 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 8 Mar 2018 14:09:12 +0100 Subject: [PATCH] DOC: require returns section in validation script (#19994) --- scripts/validate_docstrings.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/validate_docstrings.py b/scripts/validate_docstrings.py index ce3814a1314c1..8425882f07be1 100755 --- a/scripts/validate_docstrings.py +++ b/scripts/validate_docstrings.py @@ -235,6 +235,10 @@ def see_also(self): def examples(self): return self.doc['Examples'] + @property + def returns(self): + return self.doc['Returns'] + @property def first_line_ends_in_dot(self): if self.doc: @@ -436,6 +440,9 @@ def validate_one(func_name): for param_err in param_errs: errs.append('\t{}'.format(param_err)) + if not doc.returns: + errs.append('No returns section found') + mentioned_errs = doc.mentioned_private_classes if mentioned_errs: errs.append('Private classes ({}) should not be mentioned in public '