Skip to content

DOC: Improve error message when the docstring sections are in the wrong order #23644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
datapythonista opened this issue Nov 12, 2018 · 1 comment · Fixed by #23652
Closed
Labels
CI Continuous Integration Docs Error Reporting Incorrect or improved errors from pandas good first issue
Milestone

Comments

@datapythonista
Copy link
Member

When checking for errors with scripts/validate_docstrings.py, one of the checks is to make sure that the sections are in the right order. But so far we didn't find a great way to report the error, so the user quickly knows what needs to be changed (see discussion in #23607 (comment)).

For example, if the sections in the docstring are:

See Also
Returns
Examples

The reported error is:

pandas.Series.infer_objects: Wrong order of sections. "Returns" should be located before "Yields", the right order is: Parameters > Attributes > Methods > Returns > Yields > Other Parameters > Raises > Warns > See Also > Notes > References > Examples

A better option is probably to simply return the sections in the docstring in the right order:

pandas.Series.infer_objects: Sections are in the wrong order. Correct order is: Returns, See Also, Examples

CC: @TomAugspurger

@datapythonista datapythonista added Docs Error Reporting Incorrect or improved errors from pandas CI Continuous Integration Effort Low good first issue labels Nov 12, 2018
@dat-boris
Copy link
Contributor

👋 working on this one as Pycon CA sprint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Docs Error Reporting Incorrect or improved errors from pandas good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants