Skip to content

Rule to check for an open without a close #758

@ericwb

Description

@ericwb

Is your feature request related to a problem? Please describe.
A user could accidentally open files via os.open or open and forget to call close if not within a with statement.

Not calling close can result in leaked file descriptors.

Describe the solution you'd like
Create a new rule to check for open without a subsequent close if not within a with statement.

Describe alternatives you've considered
n/a

Additional context
https://docs.python.org/3/library/functions.html#open

Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.

Metadata

Metadata

Assignees

No one assigned

    Labels

    new ruleEnhancement request for a new rule

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions