Skip to content

Add inspection for "with threading.Lock():" #5208

Closed
@nathanielmanistaatgoogle

Description

Current problem

We've had a few instances of

with threading.Lock():
  <statements>

escape detection during review and find their way into our codebase; these are never correct or desired.

Desired solution

Would love for the code to be warned with with something like looks-like-mutual-exclusion-was-wanted-but-this-code-doesn't-achieve-mutual-exclusion or... a shorter, nicer warning name. 🙂

Additional context

For a file with contents

import threading

def not_a_helpful_function(parameter):
    with threading.Lock():
        print(parameter)

pylint-2.11.1 does not detect any logic problem in the code (it complains about the missing doc strings).

Metadata

Metadata

Assignees

No one assigned

    Labels

    CheckersRelated to a checkerEnhancement ✨Improvement to a componentGood first issueFriendly and approachable by new contributorsHelp wanted 🙏Outside help would be appreciated, good for new contributors

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions