File tree Expand file tree Collapse file tree
wemake_python_styleguide/visitors/ast Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ class WrongLoopVisitor(base.BaseNodeVisitor):
114114 ast .Raise ,
115115 # We only check for `try/except`, not `try/finally`:
116116 ast .ExceptHandler ,
117+ ast .Await ,
117118 )
118119
119120 _containers : ClassVar [_ContainerSpec ] = {
@@ -175,14 +176,8 @@ def _check_infinite_while_loop(self, node: AnyLoop) -> None:
175176
176177 with suppress (ValueError ):
177178 evaled = ast .literal_eval (node .test )
178- if isinstance (evaled , ast .Name ) or not bool (evaled ):
179- return
180-
181- has_await = any (walk .get_subnodes_by_type (node , ast .Await ))
182- if has_await :
183- return
184-
185- self .add_violation (InfiniteWhileLoopViolation (node ))
179+ if not isinstance (evaled , ast .Name ) and bool (evaled ):
180+ self .add_violation (InfiniteWhileLoopViolation (node ))
186181
187182
188183@final
You can’t perform that action at this time.
0 commit comments