econchick / econchick/interrogate
`ignore-semiprivate` does not ignore semiprivate modules
- Dominant language
- Python
- Stars
- 676
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the feature you'd like
In [`sigstore-python`](https://github.com/sigstore/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
```py
# semiprivate class
class _Foo():
# public member
def bar():
pass
# public class
class Foo():
"""Foo class."""
# public member
def bar():
pass
```
When running `python -m interrogate --ignore-semiprivate -vv _test.py`, we get the following coverage report:
```
======================= 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
- `interrogate` version(s) (`interrogate --version`: `1.5.0`
- Python version(s): Python 3.7.13
Contributor guide
Assessment
This issue has not been assessed yet.