Resource leak
Allocated resources are not released properly. This can slow down or crash your system. They must be closed along all paths to prevent a resource leak.
def read_file_noncompliant(filename):
    file = open(filename, 'r')
    # Noncompliant: method returns without properly closing the file.
    return file.readlines()
def read_file_compliant(filename):
    # Compliant: file is declared using a `with` statement.
    with open(filename, 'r') as file:
        return file.readlines()