Skip to content

refactor(refurb): mark MetaClassABCMeta fix as unsafe if comments would be deleted#22824

Closed
LouisLau-art wants to merge 1 commit intoastral-sh:mainfrom
LouisLau-art:fix-furb180-comment-deletion
Closed

refactor(refurb): mark MetaClassABCMeta fix as unsafe if comments would be deleted#22824
LouisLau-art wants to merge 1 commit intoastral-sh:mainfrom
LouisLau-art:fix-furb180-comment-deletion

Conversation

@LouisLau-art
Copy link

Fixes #22631.

The fix for FURB180 (metaclass=abc.ABCMeta) currently involves a range deletion (when not the first argument) or replacement. If this range contains comments, they are silently deleted.

This PR ensures the fix is marked as Unsafe whenever comments are detected in the affected range, preventing accidental loss of code documentation.

Regression tests added in FURB180.py.

…ld be deleted

The fix for FURB180 involves a range deletion or replacement. If the range contains comments, it is now correctly marked as Unsafe to prevent accidental loss of code comments. Added a regression test case to verify this behavior.
@ntBre
Copy link
Contributor

ntBre commented Jan 23, 2026

Thanks for looking into this, but the linked issue already has a PR fixing it (#22234).

@ntBre ntBre closed this Jan 23, 2026
@LouisLau-art
Copy link
Author

Thanks for pointing that out! Sorry for the duplicate effort — I’ll close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Safe fix for FURB180 can delete comments

2 participants