import re def detect_hardcoded_list(code): regex = r"\[([^,\]\[]+,){2,}([^,\]\[]+)\]" result = re.search(regex, code) if result: return True return False