ITADN

False positive for `WPS430` with whitelisted name

#3589Opensobolevn 创建于 2026-01-30
bughelp wantedlevel:startergood first issue
S
sobolevncommented
```python def wrap_handler( method: _MethodSyncHandler | _MethodAsyncHandler, ) -> SyncErrorHandlerT | AsyncErrorHandlerT: if inspect.iscoroutinefunction(method): @wraps(method) async def decorator( endpoint: 'Endpoint', controller: 'Controller[BaseSerializer]', exc: Exception, ) -> HttpResponse: return await method( # type: ignore[no-any-return] controller.active_blueprint, endpoint, controller, exc, ) else: @wraps(method) def decorator( endpoint: 'Endpoint', controller: 'Controller[BaseSerializer]', exc: Exception, ) -> HttpResponse: return method( # type: ignore[return-value] controller.active_blueprint, endpoint, controller, exc, ) return decorator ``` This code falsy raises two `WPS430` violations. ``` 69:9 WPS430 Found nested function: factory async def factory( ^ 84:9 WPS430 Found nested function: factory def factory( ^ ``` But, the name is correct. `decorator` name is in whitelist of names. This is a false positive. We need to fix it and add a test case.
1 条评论