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

Fix for Issue #384: typehints_defaults = "braces-after" fails for a multiline :param: entry #464

Merged
merged 6 commits into from
Jun 22, 2024

Conversation

tikuma-lsuhsc
Copy link
Contributor

Here is another quick fix.

The fix advances the line to the last line of the last :param: paragraph by detecting either that the next line is empty or has no indentation and placing the default at the end of the last nonempty line.

I've read somewhere else that rst docstring spec does not explicitly mention anything about multiline argument descriptions, but I understand it is widely accepted to use hanging indentation.

@gaborbernat & @hoodmane - One thing I'm not sure of is the handling of a multi-paragraph :param: description. It is likely rare to document in such a way. But when it does, should the default be placed at the end of the first or the last paragraph?

I've gone with the latter for now, but I can see myself preferring the default to appear on the first paragraph when it happens. (2nd+ paragraphs for in-depth descriptions.) Ultimately, we can add a new option for it, but a default behavior must be set regardless. The current on-the-last-paragraph implementation is simply the last one I thought of, and I can go either way. Let me know what you guys think, and I'd be happy to modify to suit your preference.

@gaborbernat
Copy link
Member

CI broken 😎

@tikuma-lsuhsc
Copy link
Contributor Author

@gaborbernat - Working on it... too many nesting? y'all are picky!/s

@tikuma-lsuhsc tikuma-lsuhsc changed the title Fix for Issue #384: typehints_defaults = "braces-after" fails for a multiple :param: entry Fix for Issue #384: typehints_defaults = "braces-after" fails for a multiline :param: entry Jun 22, 2024
@gaborbernat gaborbernat merged commit ea99f28 into tox-dev:main Jun 22, 2024
9 checks passed
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

Successfully merging this pull request may close these issues.

2 participants