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

pyproject.toml: Fix ruff rules in tool.ruff.ignore #190

Closed
cclauss opened this issue Sep 4, 2023 · 0 comments · Fixed by #193
Closed

pyproject.toml: Fix ruff rules in tool.ruff.ignore #190

cclauss opened this issue Sep 4, 2023 · 0 comments · Fixed by #193
Labels
maintenance Improvements to project health

Comments

@cclauss
Copy link
Contributor

cclauss commented Sep 4, 2023

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.

I an always frustrated when our code quality could be improved.

Describe the solution you'd like
A clear and concise description of what you want to happen.

As discussed at #189 (comment), once #189 has been merged there should be an effort to remove some ruff rules from the tool.ruff.ignore of pyproject.toml.

For instance, ruff rule B028 (no-explicit-stacklevel) is currently on the list so a new pull request could be created to remove it from the list and fix all instances so that this project's nox tests pass.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

% pipx install ruff
% ruff rule B028

no-explicit-stacklevel (B028)

Derived from the flake8-bugbear linter.

What it does

Checks for warnings.warn calls without an explicit stacklevel keyword
argument.

Why is this bad?

The warnings.warn method uses a stacklevel of 1 by default, which
limits the rendered stack trace to that of the line on which the
warn method is called.

It's recommended to use a stacklevel of 2 or higher, give the caller
more context about the warning.

Example

warnings.warn("This is a warning")

Use instead:

warnings.warn("This is a warning", stacklevel=2)
@cclauss cclauss added the enhancement New feature or request label Sep 4, 2023
@goodmami goodmami added maintenance Improvements to project health and removed enhancement New feature or request labels Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Improvements to project health
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants