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

Improve relative-imports (TID252) message #9363

Closed
tjkuson opened this issue Jan 2, 2024 · 1 comment · Fixed by #9365
Closed

Improve relative-imports (TID252) message #9363

tjkuson opened this issue Jan 2, 2024 · 1 comment · Fixed by #9365
Labels
documentation Improvements or additions to documentation

Comments

@tjkuson
Copy link
Contributor

tjkuson commented Jan 2, 2024

Running ruff check --select TID252 /tmp/example.py using version 0.1.9 on

from .. import foo

outputs

/tmp/example.py:1:1: TID252 Relative imports from parent modules are banned

I don't think this is a helpful message as it implies such imports don't work and doesn't suggest an improvement. It also doesn't match the style of other Ruff rule messages.

How about Prefer absolute imports to relative imports from parent modules?

@charliermarsh
Copy link
Member

Makes sense to me!

@charliermarsh charliermarsh added the documentation Improvements or additions to documentation label Jan 2, 2024
charliermarsh pushed a commit that referenced this issue Jan 2, 2024
## Summary

Changes message from `"Relative imports are banned"` to `"Prefer
absolute imports over relative imports from parent modules"`.

Closes #9363.

## Test Plan

`cargo test`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants