Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stacklevel=2 to all warnings and add linter rule preventing regressions in future warning calls. #1896

Open
3 tasks done
MG-MW opened this issue Jan 13, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@MG-MW
Copy link

MG-MW commented Jan 13, 2025

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 the stacklevel argument.

A clear and concise description of what the bug is.

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pandera.
  • (optional) I have confirmed this bug exists on the main branch of pandera.

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. In ruff 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.

@MG-MW MG-MW added the bug Something isn't working label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant