fix(vocabulary): skip fenced code blocks when harvesting headings (#2142) - #2150
fix(vocabulary): skip fenced code blocks when harvesting headings (#2142)#2150akshatmalik-bruh wants to merge 2 commits into
Conversation
|
@RaghavChamadiya check the PR once ! |
|
Thanks @akshatmalik-bruh. Two things you got right that I want to name before the problem: covering There is one blocker, in the offsets. entries = [
(m.group(1), _definition_after_heading(text, m.end()))
for m in _HEADING.finditer(prose)
]
It lands mid-code-block. So the patch trades mining code comments as terms for reading definitions out of code blocks, on any README with a fence above a heading, which is most of them. The existing tests do not catch it because they all assert on the term list and never on the definition attached to a term after a fence. The fix is small, either way round:
I would take the first. Worth a test that asserts the definition, not just the term, for a heading below a fence. Non-blocking: once you pick one, the docstring and the inline comment both need to stop claiming byte-length preservation if it is not what the code does. Ping me when it is pushed and I will merge it. |
|
@RaghavChamadiya check it out now and let me know any changes ! |
Summary
vocabulary.pyso that shell/script comments (`# Install dependencies`) inside code examples are not mined as project terminology._definition_after_headingremains accurate._is_release_notes()to prevent docs containing code examples with version comments (e.g.# v1.0.0) from being misclassified as release notes.Related Issues
Fixes #2142
Test Plan
uv run pytest tests/unit/generation/test_vocabulary_house_terms.py -v)test_extract_terms_output_is_byte_identicalpassesChecklist