False positive for `WPS430` with whitelisted name
bughelp wantedlevel:startergood first issue
```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 条评论