Docstrings for private classes & methods

Hi.

I recently submitted a bunch of false positives, where DS complains about missing docstrings for classes and methods that start with a leading underscore. From my understanding of the Google Style Guide for python, they are not externally visible and don’t need a docstring.

Now, I could understand if DS decides to continue to mark those missing docstrings. However, it would be neat if I could ignore only the warnings about missing docs for classes/methods with leading underscore. IISC I can currently only ignore everything or nothing. So my suggestion would be to split up the error codes for missing class/method docstrings into 2 error codes.

Let me know what you think :slight_smile:

Hey @Bibo-Joshi,

DeepSource also reports documentation coverage metrics to let users know about their test and application documentation coverage.
Splitting the issue would fix the problem you’ve mentioned here, but then, the Documentation Coverage metrics would become wrong when the issue is ignored (this is because the doc-coverage metric is not coupled with the issues).

We are currently working on an approach to taking care of this and we hope to get this fixed within the next 24 hours.

I’ll keep this thread updated. :raised_hands:

Hi, thanks for the reply :slight_smile: Haven’t had a too close look on the coverage metrics, yet, tbh.

We are currently working on an approach to taking care of this and we hope to get this fixed within the next 24 hours.

Neat! Please don’t do overtime just b/c of me, though :laughing:

2 Likes

Hey @Bibo-Joshi,
We have deployed a fix for this.

We have now added nonpublic to the skip_doc_coverage to the meta-options so that you can configure this.
You can check the docs here.

The latest changes also fix the false positives you reported in the issues PY-D0002 and PY-D0003.

1 Like

Hi, thank a lot! You’re quick :slight_smile: It seems to work well on functions with a leading underscore, but I still get a hit for a nonplubic class. Also there are some hits for nested functions (e.g. here), which are also not public.

We’ll get this checked and update here.

Update - Nested functions are now handled. We somehow missed nonpublic classes in the last release. This is gonna be taken care of soon.

1 Like

This is now handled as well! :star2:

1 Like