Skip to content

[pyupgrade] Add fix safety section to UP004#18853

Merged
dylwil3 merged 1 commit intoastral-sh:mainfrom
MeGaGiGaGon:patch-5
Jun 23, 2025
Merged

[pyupgrade] Add fix safety section to UP004#18853
dylwil3 merged 1 commit intoastral-sh:mainfrom
MeGaGiGaGon:patch-5

Conversation

@MeGaGiGaGon
Copy link
Copy Markdown
Contributor

Summary

Part of #15584

This adds a Fix safety section to useless-object-inheritance (UP004)

I could not track down the original PR as this rule is so old it has gone through several large ruff refactors.
No reasoning is given on the unsafety in the PR/code.
The unsafety is determined here:

let applicability = if checker.comment_ranges().intersects(range) {
Applicability::Unsafe
} else {
Applicability::Safe
};

Unsafe fix demonstration:
playground

class A(  # will be deleted
    object
):
    ...

Test Plan

N/A, no tests/functionality affected

@MeGaGiGaGon MeGaGiGaGon mentioned this pull request Jun 21, 2025
71 tasks
@github-actions
Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser requested a review from dylwil3 June 22, 2025 07:51
@dylwil3 dylwil3 added the documentation Improvements or additions to documentation label Jun 23, 2025
Copy link
Copy Markdown
Collaborator

@dylwil3 dylwil3 left a comment

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 bbc26b2 into astral-sh:main Jun 23, 2025
36 checks passed
@MeGaGiGaGon MeGaGiGaGon deleted the patch-5 branch June 23, 2025 16:58
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 this pull request may close these issues.

2 participants