Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 833cd52

Browse files
committed
check case of async func def
1 parent 6c5abe7 commit 833cd52

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

flake8_idom_hooks/rules_of_hooks.py

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
4949
):
5050
self.generic_visit(node)
5151

52+
def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> None:
53+
with set_current(
54+
self,
55+
function=node,
56+
early_return=None,
57+
):
58+
self.generic_visit(node)
59+
5260
def visit_Call(self, node: ast.Call) -> None:
5361
with set_current(self, call=node):
5462
self.visit(node.func)

tests/cases/hook_usage.py

+5
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,8 @@ def regression_check():
219219
def effect():
220220
# this return caused false passitive early return error in use_effect usage
221221
return cleanup
222+
223+
@use_effect
224+
async def effect():
225+
# this return caused false passitive early return error in use_effect usage
226+
return cleanup

0 commit comments

Comments
 (0)