Skip to content

Rule to check for an open without a close #758

Open

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 👍.

Activity

  1. added
    enhancement
    on May 8, 2025
  2. added
    new rule
    and removed
    enhancement
    on May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    new rule

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions