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

Ignore nested classes (and subnested functions) #65

Closed
amin-nejad opened this issue Nov 25, 2020 · 3 comments
Closed

Ignore nested classes (and subnested functions) #65

amin-nejad opened this issue Nov 25, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request needs triage Issue needs triaging

Comments

@amin-nejad
Copy link

Describe the feature you'd like

In the same vein as --ignore-nested-functions, It would be nice if we could have an --ignore-nested-classes (or additionally capture nested classes with --ignore-nested-functions).

Is your feature request related to a problem?

For instance, a lot of my classes in one of my projects have a nested Schema class which follows an almost identical structure and really doesn't need docstrings (or so I think) so it would be great if we could ignore them.

Your Environment

  • interrogate version(s) (interrogate --version: 1.3.2
  • Operating System(s): Ubuntu 18.04
  • Python version(s): 3.7.9

Additional context

I know this can be done with regex in this particular case since they all have the same name but I think it could be a handy feature nonetheless.

@amin-nejad amin-nejad added enhancement New feature or request needs triage Issue needs triaging labels Nov 25, 2020
@DrGFreeman
Copy link

Another case where this would be useful is when a class is defined inside a pytest fixture which yields an instance of the class for use in a test (here a dummy Scikit-Learn estimator class):

@pytest.fixture()
def my_fixture():
    """Fixture docstring."""
    class DummyEstimator:
        def __init__(self):
            pass

        def predict(X):
            return some_operation_on_X

    yield DummyEstimator()

@econchick
Copy link
Owner

Hey there @DrGFreeman & @amin-nejad ! I'm so sorry this took me so long to get to. I just merged in #73 and should be released in the next day or so as 1.4.0. Thanks for the suggestion!

@DrGFreeman
Copy link

Hey @econchick, thanks for the new feature! I'll update my CI pipelines to use 1.4.0 from now on.

And no worries for the delay. The efforts you invest in this project are a gift to the community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage Issue needs triaging
Projects
None yet
Development

No branches or pull requests

3 participants