Skip to content

if-with-same-arms (SIM114) false-negative with comments #23080

@Avasam

Description

@Avasam

Summary

if-with-same-arms (SIM114) does not trigger for a branch where the only difference is a comment:

while True:
    rc = win32event.MsgWaitForMultipleObjects(
        (StopEvent,), 0, TIMEOUT, win32event.QS_ALLEVENTS
    )

    if rc == win32event.WAIT_OBJECT_0:
        break
    elif rc == win32event.WAIT_OBJECT_0 + 1 and pythoncom.PumpWaitingMessages():
        break  # wm_quit

(remove vm_quit and it'll trigger)

This should of course count as an unsafe-fix (#19576), but should still trigger the rule.

Version

0.11 (but I also tried with uvx ruff@0.15 check --select=SIM114

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions