Helper function to read a file and return a set of its includes.
(filepath)
| 7 | |
| 8 | |
| 9 | def extract_includes_from_file(filepath): |
| 10 | """Helper function to read a file and return a set of its includes.""" |
| 11 | includes = set() |
| 12 | if not os.path.exists(filepath): |
| 13 | return includes |
| 14 | |
| 15 | try: |
| 16 | with open(filepath, "r", encoding="utf-8-sig") as f: |
| 17 | for line in f: |
| 18 | match = INCLUDE_REGEX.search(line) |
| 19 | if match: |
| 20 | # Add the exact path inside the quotes/brackets to the set |
| 21 | includes.add(match.group(1)) |
| 22 | except Exception as e: |
| 23 | print(f"Error reading {filepath}: {e}") |
| 24 | |
| 25 | return includes |
| 26 | |
| 27 | |
| 28 | def find_missing_includes(): |
no test coverage detected