Skip to content

fix: warn about missing descriptions and return "" not None #138

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

Merged
merged 4 commits into from
Mar 7, 2022
Merged

fix: warn about missing descriptions and return "" not None #138

merged 4 commits into from
Mar 7, 2022

Conversation

JoeHCQ1
Copy link
Contributor

@JoeHCQ1 JoeHCQ1 commented Mar 4, 2022

This should fix mkdocstrings/mkdocstrings#397 and #137 .

The problem was that empty descriptions were being returned as None in Parameters and Exceptions blocks instead of "".

That None eventually made it to this: https://github.com/mkdocstrings/mkdocstrings/blob/master/src/mkdocstrings/handlers/base.py#L219

And that passed it here: https://github.com/Python-Markdown/markdown/blob/master/markdown/core.py#L225

And later in that function we get a Nonetype error: https://github.com/Python-Markdown/markdown/blob/master/markdown/core.py#L248

Because we also were not recording empty descriptions as errors (which I believe mkdocstrings interprets and reports as warnings) there was nothing to tell the user why python -m mkdocs build had thrown a Nonetype error.

So I:

  • Recorded missing descriptions as errors.
  • Changed the code to return all missing descriptions as "" instead of None.
  • Added test to verify capability.

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect investigation!

Thanks a lot for taking the time to find and fix the root cause of the issue 🙂

I've made a few suggestions and comments.

@JoeHCQ1
Copy link
Contributor Author

JoeHCQ1 commented Mar 7, 2022

@pawamoy I am ready for re-review.

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pawamoy pawamoy merged commit 50b9597 into mkdocstrings:master Mar 7, 2022
@pawamoy
Copy link
Member

pawamoy commented Mar 7, 2022

Thanks a lot! Will release it now.

@pawamoy
Copy link
Member

pawamoy commented Mar 7, 2022

Released in 0.16.1

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