Reads class names from a source file using a regex that captures class definitions. Optionally exclude classes based on a list of conditions (functions that take class name and return bool).
(src_path, class_regex, exclude_conditions=None)
| 37 | |
| 38 | |
| 39 | def read_source_classes(src_path, class_regex, exclude_conditions=None): |
| 40 | """ |
| 41 | Reads class names from a source file using a regex that captures class definitions. |
| 42 | Optionally exclude classes based on a list of conditions (functions that take class name and return bool). |
| 43 | """ |
| 44 | if exclude_conditions is None: |
| 45 | exclude_conditions = [] |
| 46 | with open(os.path.join(REPO_PATH, src_path), "r") as f: |
| 47 | doctext = f.read() |
| 48 | classes = re.findall(class_regex, doctext) |
| 49 | # Filter out classes that meet any of the exclude conditions |
| 50 | filtered_classes = [c for c in classes if not any(cond(c) for cond in exclude_conditions)] |
| 51 | return filtered_classes |
| 52 | |
| 53 | |
| 54 | def check_documentation(doc_path, src_path, doc_regex, src_regex, exclude_conditions=None): |
no outgoing calls
no test coverage detected
searching dependent graphs…