-
-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Describe the feature you'd like
In sigstore-python, we mark modules as internal / semiprivate by prefixing them with _. I'd like interrogate to consider members of these modules as implicitly semiprivate, just like how interrogate already ignores public members of semiprivate classes.
Here's a minimal example:
_test.py
# semiprivate class
class _Foo():
# public member
def bar():
pass
# public class
class Foo():
"""Foo class."""
# public member
def bar():
passWhen running python -m interrogate --ignore-semiprivate -vv _test.py, we get the following coverage report:
Details
======================= Coverage for /Users/tnytown/Documents/sw/sigstore-python/test/ ========================
---------------------------------------------- Detailed Coverage ----------------------------------------------
| Name | Status |
|-----------------------------------------------------------|-------------------------------------------------|
| _test.py (module) | MISSED |
| Foo (L9) | COVERED |
| Foo.bar (L13) | MISSED |
|-----------------------------------------------------------|-------------------------------------------------|
--------------------------------------------------- Summary ---------------------------------------------------
| Name | Total | Miss | Cover | Cover% |
|-------------------------|--------------------|-------------------|--------------------|---------------------|
| _test.py | 3 | 2 | 1 | 33% |
|-------------------------|--------------------|-------------------|--------------------|---------------------|
| TOTAL | 3 | 2 | 1 | 33.3% |
------------------------------- RESULT: FAILED (minimum: 100.0%, actual: 33.3%) -------------------------------
interrogate skips the semiprivate class and its member, lints the undocumented member of the public class, and also lints the missing module-level docstring. l However, in this situation, I would like interrogate to skip the whole module, as it is semiprivate.
Alternatively, if this isn't something you're comfortable with supporting, maybe the documentation can make it more clear that semiprivateness doesn't affect modules?
I'd be happy to submit a patch for either the behavioral change or the documentation :)
Your Environment
interrogateversion(s) (interrogate --version:1.5.0- Python version(s): Python 3.7.13