()
| 1480 | |
| 1481 | |
| 1482 | def main() -> None: |
| 1483 | from common import emit |
| 1484 | |
| 1485 | args = parser().parse_args() |
| 1486 | path = Path(args.input).expanduser().resolve() |
| 1487 | text = path.read_text(encoding="utf-8") |
| 1488 | body_text = strip_frontmatter(text) |
| 1489 | headers = extract_headers(text) |
| 1490 | missing_sections = find_missing_sections(text) |
| 1491 | warnings: list[str] = [] |
| 1492 | mixed_issues = mixed_language_issues(text) |
| 1493 | mechanical_artifact_issues = mechanical_translation_artifact_issues(text) |
| 1494 | linebreak_issues = suspicious_mid_sentence_linebreaks(body_text) |
| 1495 | code_math_issues = suspicious_code_formatted_math(text) |
| 1496 | math_issues = math_render_issues(text) |
| 1497 | figure_issues = figure_structure_issues(text) |
| 1498 | core_info_issues = core_info_structure_issues(text) |
| 1499 | substantive_issues = inspect_substantive_content(text) |
| 1500 | planning_artifact_found, planning_artifact_issues = inspect_note_plan( |
| 1501 | resolve_note_plan_path(path, args.plan_file) |
| 1502 | ) |
| 1503 | warnings.extend(inspect_figure_callouts(text)) |
| 1504 | for issue in figure_issues: |
| 1505 | reason = str(issue.get("reason", "")) |
| 1506 | if reason and reason not in warnings: |
| 1507 | warnings.append(reason) |
| 1508 | for issue in core_info_issues: |
| 1509 | reason = str(issue.get("reason", "")) |
| 1510 | if reason and reason not in warnings: |
| 1511 | warnings.append(reason) |
| 1512 | for issue in planning_artifact_issues: |
| 1513 | if issue not in warnings: |
| 1514 | warnings.append(issue) |
| 1515 | for issue in substantive_issues: |
| 1516 | reason = str(issue.get("reason", "")) |
| 1517 | if reason and reason not in warnings: |
| 1518 | warnings.append(reason) |
| 1519 | warnings.extend(front_matter_order_warnings(text)) |
| 1520 | warnings.extend(mechanism_flow_warnings(text)) |
| 1521 | if not body_text.lstrip().startswith("# "): |
| 1522 | warnings.append("title_heading_missing") |
| 1523 | if "## " not in text: |
| 1524 | warnings.append("no_level2_sections") |
| 1525 | if "### " not in text: |
| 1526 | warnings.append("no_level3_headings") |
| 1527 | if len(headers) < 5: |
| 1528 | warnings.append("too_few_headings") |
| 1529 | if not has_figure_marker(text): |
| 1530 | warnings.append("no_figure_markers") |
| 1531 | if len(text.splitlines()) < 20: |
| 1532 | warnings.append("note_too_short") |
| 1533 | if mixed_issues: |
| 1534 | warnings.append("mixed_language_lines_present") |
| 1535 | if mechanical_artifact_issues: |
| 1536 | warnings.append("mechanical_translation_artifacts_present") |
| 1537 | if linebreak_issues: |
| 1538 | warnings.append("suspicious_mid_sentence_linebreaks") |
| 1539 | if code_math_issues: |
no test coverage detected