Skip to content

[pylint] add fix safety section (PLC0414) - #17802

Merged
dylwil3 merged 6 commits into
astral-sh:mainfrom
yunchipang:docs/fix-safety-useless-import-alias
May 11, 2025
Merged

dylwil3 merged 6 commits into
astral-sh:mainfrom
yunchipang:docs/fix-safety-useless-import-alias

Conversation

@yunchipang

@yunchipang yunchipang commented May 2, 2025 •

Copy link
Copy Markdown
Contributor

This PR adds a fix safety section in comment for rule PLC0414.

parent: #15584
discussion: #6294

@yunchipang

Copy link
Copy Markdown
Contributor Author

@dylwil3 please let me know if this PR summary is what you were looking for (mentioned in #15584 (comment)). thanks!

@AlexWaygood AlexWaygood added the documentation Improvements or additions to public-facing documentation label May 3, 2025
@github-actions

github-actions Bot commented May 3, 2025 •

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@yunchipang yunchipang mentioned this pull request May 3, 2025
21 of 71 tasks
@dylwil3

dylwil3 commented May 6, 2025

Copy link
Copy Markdown
Collaborator

Hi @yunchipang - thanks for looking into this! This is a pretty old rule that has survived many refactors of the code base, and I think the PR you're linking to isn't quite the one that originated the unsafe fix. So I don't think the reason you're giving for fix unsafety is correct - especially because, as you point out, Ruff will detect that situation and warn the user.

I think some hints for the unsafety are in this discussion: #6294

Something like:

This fix is marked as always unsafe because the user may be intentionally re-exporting the import.

@yunchipang

Copy link
Copy Markdown
Contributor Author

@dylwil3 thanks so much for the input! I've looked into the issue and updated the docs, please let me know if it's clearer this time.

@dylwil3 dylwil3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you!

@dylwil3
dylwil3 merged commit 8845a13 into astral-sh:main May 11, 2025
dcreager added a commit that referenced this pull request May 12, 2025
* main:
  disable jemalloc on android (#18033)
  [ty] Fix incorrect type of `src.root` in documentation (#18040)
  [ty] Refine message for why a rule is enabled (#18038)
  [ty] Remove brackets around option names (#18037)
  Update pre-commit dependencies (#18025)
  Update docker/build-push-action action to v6.16.0 (#18030)
  Update docker/login-action action to v3.4.0 (#18031)
  Update taiki-e/install-action digest to 83254c5 (#18022)
  Update cargo-bins/cargo-binstall action to v1.12.4 (#18023)
  Update Rust crate ctrlc to v3.4.7 (#18027)
  Update Rust crate clap to v4.5.38 (#18026)
  Update Rust crate jiff to v0.2.13 (#18029)
  Update Rust crate getrandom to v0.3.3 (#18028)
  Update dependency ruff to v0.11.9 (#18024)
  [`pylint`] add fix safety section (`PLW1514`) (#17932)
  python_stdlib: update for 3.14 (#18014)
  [`ruff`] add fix safety section (`RUF033`) (#17760)
  [`pylint`] add fix safety section (`PLC0414`) (#17802)
Glyphack pushed a commit to Glyphack/ruff that referenced this pull request May 21, 2025
This PR adds a fix safety section in comment for rule `PLC0414`.

parent: astral-sh#15584 
discussion: astral-sh#6294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to public-facing documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants