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-functions should work with coroutines #105

Open
amin-nejad opened this issue Mar 20, 2022 · 1 comment
Open

ignore-nested-functions should work with coroutines #105

amin-nejad opened this issue Mar 20, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request needs triage Issue needs triaging

Comments

@amin-nejad
Copy link

Describe the feature you'd like

I'd like ignore-nested-functions to work with coroutines (i.e. async def). However if either function is actually a coroutine, it does not work

Is your feature request related to a problem?

I'm frustrated when I have to add docstrings to unimportant functions and I can't avoid it just because of how they are defined i.e. there is nothing materially different between a function and coroutine when it comes to docstrings and their necessity (or lack thereof)

Your Environment

  • interrogate version(s) (interrogate --version: 1.5.0
  • Operating System(s): MacOS Big Sur
  • Python version(s): 3.9.7
@amin-nejad amin-nejad added enhancement New feature or request needs triage Issue needs triaging labels Mar 20, 2022
@dagardner-nv
Copy link

Ran into this myself src/interrogate/visit.py should be updated to look like:

@@ -114,7 +114,7 @@ class CoverageVisitor(ast.NodeVisitor):
         if parent is None:
             return False
         # is it a nested function?
-        if parent.node_type == "FunctionDef" and node_type == "FunctionDef":
+        if parent.node_type in ("FunctionDef", "AsyncFunctionDef") and node_type in ("FunctionDef", "AsyncFunctionDef"):
             return True
         return False

dagardner-nv added a commit to dagardner-nv/Morpheus that referenced this issue Jan 24, 2023
… for that, add an ignore for nested async methods as a work-around for econchick/interrogate#105
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