ITADN

Check for empty `skip_file_prefixes` in `B028`

#510Opendylwil3 创建于 2025-05-12
D
dylwil3commented
As of https://github.com/PyCQA/flake8-bugbear/pull/503 (cf https://github.com/PyCQA/flake8-bugbear/issues/497) the following emits no lint: ```console ❯ cat example.py import warnings warnings.warn("test", skip_file_prefixes=()) ❯ uvx --with git+https://github.com/PyCQA/flake8-bugbear flake8 --select B028 check example.py ❯ echo $? 0 ``` But it probably should: the stacklevel is only set to at least 2 if there is at least one prefix given. Of course, the user may pass in a reference to some unknown tuple, in which case it's probably better to skip the lint - but if they explicitly pass an empty tuple, then it makes sense to still emit the lint. On the other hand I understand if this is overly pedantic and unlikely, so feel free to close the issue as unplanned!
1 条评论