Skip to main content

What it flags

A locally opened handle must be closed after reading. The rule checks a direct call to the built-in open followed by returning the file contents with read or readlines. Returning the handle itself conveys ownership to the caller. Handles assigned to a global or nonlocal binding remain reachable outside the function.