Add stacklevel=2
to all warnings and add linter rule preventing regressions in future warning calls.
#1896
Labels
bug
Something isn't working
Describe the bug
A lot of the warnings only show the code emitting the warning, which is not really helpful.
It should show the code that is responsible for calling the
pandera
code, that should be shown in the warning by using thestacklevel
argument.A clear and concise description of what the bug is.
There are a couple of instances in 4 files, where this is correctly used: see here.
But there are about 18 files, where it is not used correctly: see her.
I have not found a lint rule for
pylint
, which would enforce correct usage. Inruff
there is rule B028, which would enforce this. This would have to wait for a siwtch to ruff as linter (#1293).Additional context
Some more background on the problems of usage without stacklevel can be found here.
The text was updated successfully, but these errors were encountered: