From 2ca0bf6968d3f00ee0f6dbc93f48fff21a6811f7 Mon Sep 17 00:00:00 2001 From: Jeremy Goh <30731072+thatlittleboy@users.noreply.github.com> Date: Mon, 18 Jul 2022 09:17:02 +0800 Subject: [PATCH 1/3] docs: fix validation include line numbers --- doc/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/validation.rst b/doc/validation.rst index 8235559e..134cad2d 100644 --- a/doc/validation.rst +++ b/doc/validation.rst @@ -64,4 +64,4 @@ a more detailed message. For example:: The full mapping of validation checks is given below. .. literalinclude:: ../numpydoc/validate.py - :lines: 36-90 + :lines: 37-93 From c5f4f0f889f2f62cba86f53a31fab3f642967a75 Mon Sep 17 00:00:00 2001 From: Jeremy Goh Date: Mon, 18 Jul 2022 19:00:14 +0800 Subject: [PATCH 2/3] use start/end markers instead of hardcoding lineno --- doc/validation.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/validation.rst b/doc/validation.rst index 134cad2d..629d27f1 100644 --- a/doc/validation.rst +++ b/doc/validation.rst @@ -64,4 +64,5 @@ a more detailed message. For example:: The full mapping of validation checks is given below. .. literalinclude:: ../numpydoc/validate.py - :lines: 37-93 + :start-after: [validate-docs] + :end-before: [validate-docs] From 2f7c67be257638cb56862f6a6dc350d157e3d064 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Mon, 18 Jul 2022 14:40:35 +0300 Subject: [PATCH 3/3] Add missing sentinel + explanatory comment. --- doc/validation.rst | 4 ++-- numpydoc/validate.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/validation.rst b/doc/validation.rst index 629d27f1..ee6e08d2 100644 --- a/doc/validation.rst +++ b/doc/validation.rst @@ -64,5 +64,5 @@ a more detailed message. For example:: The full mapping of validation checks is given below. .. literalinclude:: ../numpydoc/validate.py - :start-after: [validate-docs] - :end-before: [validate-docs] + :start-after: start-err-msg + :end-before: end-err-msg diff --git a/numpydoc/validate.py b/numpydoc/validate.py index 780d8952..4a323b92 100644 --- a/numpydoc/validate.py +++ b/numpydoc/validate.py @@ -34,6 +34,9 @@ "References", "Examples", ] +# NOTE: The following comment is a sentinel for embedding in the docs - do not +# modify/remove +# start-err-msg ERROR_MSGS = { "GL01": "Docstring text (summary) should start in the line immediately " "after the opening quotes (not in the same line, or leaving a " @@ -91,6 +94,9 @@ "SA04": 'Missing description for See Also "{reference_name}" reference', "EX01": "No examples section found", } +# end-err-msg +# NOTE: The above comment is a sentinel for embedding in the docs - do not +# modify/remove # Ignore these when evaluating end-of-line-"." checks IGNORE_STARTS = (" ", "* ", "- ")