Summary
Setting skip_file_prefixes serves the same purpose as stacklevel, making sure the warning fires in a more informative place. It also actually implicitly sets stack level to at least 2.
When prefixes are supplied, stacklevel is implicitly overridden to be max(2, stacklevel).
This change was already made upstream PyCQA/flake8-bugbear#497
Sample code:
import os
import warnings
warnings.warn("test", skip_file_prefixes=(os.path.dirname(__file__),))
- No explicit
stacklevel keyword argument found (B028) [Ln 4, Col 1]
https://play.ruff.rs/f3bb6bb2-4d66-4eea-b86e-fa1c54c98f6b