MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / mechanism_flow_warnings

Function mechanism_flow_warnings

scripts/lint_note.py:1451–1474  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

1449
1450
1451def mechanism_flow_warnings(text: str) -> list[str]:
1452 warnings: list[str] = []
1453 if not method_section_requires_mechanism_flow(text):
1454 return warnings
1455 if "### 机制流程" not in text:
1456 warnings.append("mechanism_flow_subsection_missing")
1457 return warnings
1458
1459 body = subsection_body(text, "方法主线", "机制流程")
1460 if not body:
1461 warnings.append("mechanism_flow_subsection_empty")
1462 return warnings
1463
1464 step_lines = [line.strip() for line in body.splitlines() if re.match(r"^\d+\.\s+", line.strip())]
1465 if not 3 <= len(step_lines) <= 4:
1466 warnings.append("mechanism_flow_step_count_unexpected")
1467
1468 step_text = " ".join(step_lines)
1469 has_io_signal = any(token in step_text for token in MECHANISM_IO_TOKENS)
1470 has_action_signal = any(token in step_text for token in MECHANISM_ACTION_TOKENS)
1471 if not (has_io_signal and has_action_signal):
1472 warnings.append("mechanism_flow_too_abstract")
1473
1474 return warnings
1475
1476
1477def strip_frontmatter(text: str) -> str:

Callers 1

mainFunction · 0.85

Calls 2

subsection_bodyFunction · 0.85

Tested by

no test coverage detected