Skip to content
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

Add check for empty line between description and parameter list #39

Open
FabianNiehaus opened this issue May 10, 2021 · 3 comments
Open

Comments

@FabianNiehaus
Copy link

Currently, the following code passes validation:

"""
Construct the mappings with file line numbers included.

Overrides 'yaml.constructor.SafeConstructor.construct_mapping()'.
:param node: MappingNode object.
:param deep: Deep flag.
"""

However, once rendered, this is the result:

grafik

As you can see, the parameters were not rendered correctly.

Adding an empty line to the Docstring solves this issue:

"""
Construct the mappings with file line numbers included.

Overrides 'yaml.constructor.SafeConstructor.construct_mapping()'.

:param node: MappingNode object.
:param deep: Deep flag.
"""

Output:

grafik

It would be very helpful if flake8-rst-docstrings implemented a check for this.

@peterjc
Copy link
Owner

peterjc commented May 10, 2021

I can see why this would be nice, but currently this plugin does not invent any checks of its own - everything is done by docutils internally. You could try opening a feature request there for flagging this example with a warning?

https://sourceforge.net/p/docutils/feature-requests/

@FabianNiehaus
Copy link
Author

I was not aware of that, my bad.

I opened a feature request on SourceForge: https://sourceforge.net/p/docutils/feature-requests/80/

@peterjc
Copy link
Owner

peterjc commented Feb 26, 2024

Quoting from the docutils discussion,

... example is valid rST but it is not what you intended. Because of the missing blank line, your docstring does not contain a field-list/param list but a large paragraph, so the rendering is technically correct (but not what you want).

Whether a check for "valid but not intended" input would be more helpful than in the way and at which stage it could be done, is open for discussion.

Closing as there is not going to be an error or warning from docutils for us to report via flake8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants