reqmd Package: parser

Package: parser

approved 109Leaf

109 requirements · 1 items

X Reqmd.source File
X Reqmd.source Line
X Reqmd.symbol Kind

This file is auto-generated by reqmd-code. Do not edit by hand.

IMP-parser-errUnsupported-5dd0116 errUnsupported

#

missing coverage

errUnsupported is returned by the scanner for input outside the subset itcan parse exactly: nested maps, multi-line scalars, duplicate keys, andscalars yaml.v3 would type differently (floats, timestamps, hex, bigintegers). decodeAttrs then re-parses the whole block with yaml.v3, so theresult never depends on which path produced it.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan.go
X Reqmd.source Line
16
X Reqmd.symbol Kind
var
Status
approved

IMP-parser-decodeAttrs-639cc16 decodeAttrs

#

missing coverage

decodeAttrs parses the contents of an ```attr block into a map. It runs thefast line scanner first and falls back to yaml.v3 for anything the scannercannot reproduce byte-for-byte (see errUnsupported).

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan.go
X Reqmd.source Line
21
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-decodeAttrYAML-b0e14ba decodeAttrYAML

#

missing coverage

decodeAttrYAML is the fast path: it parses a small flat YAML map (thecontents of an ```attr block) into map[string]any without building theintermediate YAML document AST that yaml.v3 allocates.

Supported syntax (covers all real-world attr blocks)🔑 value (scalar: string, int, bool)key: "quoted value" (quoted string — quotes stripped)key: (list — following lines are " - item")item1item2comment (ignored)blank lines (ignored)

Values are typed as yaml.v3 would type them:unquoted → string (unless it's an int or bool literal)"true"/"false" → boolinteger → intquoted → string (always, even if contents look like a number)list items → []any of strings

Anything it cannot reproduce exactly — malformed input, nested maps, flowmappings, duplicate keys, or a scalar yaml.v3 would retype (float,timestamp, hex, big integer) — returns errUnsupported so decodeAttrsre-parses the block with yaml.v3. Callers should use decodeAttrs, not thisfunction directly.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan.go
X Reqmd.source Line
63
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_Scalars-c181e5c TestDecodeAttrYAML_Scalars

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
11
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_QuotedStrings-552fc27 TestDecodeAttrYAML_QuotedStrings

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
31
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_BlockList-691e48c TestDecodeAttrYAML_BlockList

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
47
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_FlowSeq-e8e0bbe TestDecodeAttrYAML_FlowSeq

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
68
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_EmptyValue-6e824d9 TestDecodeAttrYAML_EmptyValue

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
89
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_Comments-b820f3d TestDecodeAttrYAML_Comments

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
100
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_BlankLines-e425642 TestDecodeAttrYAML_BlankLines

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
117
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_EmptyKey-279d177 TestDecodeAttrYAML_EmptyKey

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
128
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_BadYAML-92dd0bd TestDecodeAttrYAML_BadYAML

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
135
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_MixedTypes-54633eb TestDecodeAttrYAML_MixedTypes

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
142
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_ParityWithYAMLv3-fe54232 TestDecodeAttrYAML_ParityWithYAMLv3

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
163
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrs_DuplicateKey-ac3785f TestDecodeAttrs_DuplicateKey

#

missing coverage

TestDecodeAttrs_DuplicateKey rejects a repeated key instead of silentlykeeping the last value (yaml.v3 rejects it too, with a line number).

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
201
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestDecodeAttrYAML_UnsupportedScalarIsReported-6da2475 TestDecodeAttrYAML_UnsupportedScalarIsReported

#

missing coverage

TestDecodeAttrYAML_UnsupportedScalarIsReported guards the fast path: ascalar it cannot type must be reported as errUnsupported so decodeAttrsfalls back, never silently stringified.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
210
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseScalar-c3f7acf TestParseScalar

#

missing coverage

TestParseScalar covers the plain-scalar typing the scanner must reproduceexactly; anything it cannot type is rejected so the block re-parses withyaml.v3 instead of silently becoming a string.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
219
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestIsPlainStringStart-e9d2853 TestIsPlainStringStart

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
259
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestIsIntegerString-0ff5297 TestIsIntegerString

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
279
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestUnquoteYAML-6bee43a TestUnquoteYAML

#

missing coverage

TestUnquoteYAML covers both quote styles: doubled single quotes are aliteral quote, double quotes carry YAML escapes, and an unterminated quoteis an error (which send the block to yaml.v3).

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
302
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestUnescapeYAMLDouble-ba46c0a TestUnescapeYAMLDouble

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
333
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestLeadingSpaces-662b141 TestLeadingSpaces

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
342
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseFlowSeq-ee2b166 TestParseFlowSeq

#

missing coverage

TestParseFlowSeq covers flow sequences, including quoted items with commas(which a naive string split would break) and invalid input.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
357
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestSplitFlowItems-f1aac68 TestSplitFlowItems

#

missing coverage

TestSplitFlowItems covers the quote- and bracket-aware comma split.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrscan_test.go
X Reqmd.source Line
389
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-parseScalar-0fec6c3 parseScalar

#

missing coverage

parseScalar converts an unquoted YAML plain scalar to the Go type yaml.v3would produce: true/false → bool, null/~ → nil, integer → int, anythingelse → string. Scalars yaml.v3 would retype as something this functioncannot produce (float, timestamp, hex, big integer) report errUnsupportedso decodeAttrs re-parses the block with yaml.v3 instead of silentlyturning them into strings.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrvalue.go
X Reqmd.source Line
15
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-isPlainStringStart-c2e4d67 isPlainStringStart

#

missing coverage

isPlainStringStart reports whether c can begin a plain YAML scalar thatyaml.v3 resolves as a string.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrvalue.go
X Reqmd.source Line
48
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-isIntegerString-264690b isIntegerString

#

missing coverage

isIntegerString reports whether s is a plain integer literal (optionalsign followed by digits). Used as the gate before strconv.Atoi.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrvalue.go
X Reqmd.source Line
54
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-unquoteYAML-4ed7ece unquoteYAML

#

missing coverage

unquoteYAML strips single or double quotes from a YAML scalar.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrvalue.go
X Reqmd.source Line
74
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-unescapeYAMLDouble-9b443ee unescapeYAMLDouble

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrvalue.go
X Reqmd.source Line
94
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-leadingSpaces-223b365 leadingSpaces

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrvalue.go
X Reqmd.source Line
124
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-parseFlowSeq-f6009f2 parseFlowSeq

#

missing coverage

parseFlowSeq parses a YAML flow sequence [item1, item2, item3] into []any.Items are parsed as scalars (same rules as parseScalar). Quoted itemsare supported.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrvalue.go
X Reqmd.source Line
135
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-splitFlowItems-277c16c splitFlowItems

#

missing coverage

splitFlowItems splits a flow sequence body on commas, respecting quotes.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/attrvalue.go
X Reqmd.source Line
169
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-benchAttr-94dfd1d benchAttr

#

missing coverage

benchAttr is a representative minimal attr block: two scalars, one int, onelist with pins. Both benchmarks decode it so the scanner's advantage staysmeasurable — it is ~15x faster than yaml.v3 (1784 vs 27608 ns/op, 14 vs 140allocs) and that is why the fast path exists at all. If the gap ever closes,delete the scanner and keep yaml.v3.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/bench_test.go
X Reqmd.source Line
14
X Reqmd.symbol Kind
const
Status
approved

IMP-parser-BenchmarkDecodeAttrs-26d49bf BenchmarkDecodeAttrs

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/bench_test.go
X Reqmd.source Line
16
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-BenchmarkDecodeAttrsYAMLv3-a71c0c3 BenchmarkDecodeAttrsYAMLv3

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/bench_test.go
X Reqmd.source Line
25
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-BenchmarkParseMD-2a9f1cb BenchmarkParseMD

#

missing coverage

BenchmarkParseMD measures the whole file→content-tree path, which is whatreqmd check/ls spend nearly all their time in.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/bench_test.go
X Reqmd.source Line
38
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-syntheticDoc-ccb009f syntheticDoc

#

missing coverage

syntheticDoc builds a document of roughly n bytes made of root-levelrequirements with attr blocks — the shape that exercises both theroot-split pre-scan (above parseParallelThreshold) and the chunkedparallel parse.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/bench_test.go
X Reqmd.source Line
63
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-DiscoverAtTagWithSchemas-5d84f4e DiscoverAtTagWithSchemas

#

missing coverage

DiscoverAtTagWithSchemas extracts the repo at the given git tag into a tempdirectory, runs the standard Discover pipeline, and returns the parseddocuments plus the raw schema.yaml content for each document directory.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/git.go
X Reqmd.source Line
19
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-discoverAtTag-a32da82 discoverAtTag

#

missing coverage

discoverAtTag extracts the repo at the given git tag and returns both theparsed documents and the raw schema maps per document path.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/git.go
X Reqmd.source Line
25
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-rewriteNodeSources-3e563ee rewriteNodeSources

#

missing coverage

rewriteNodeSources applies fn to the Source of every node in the tree.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/git.go
X Reqmd.source Line
98
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-relToTmpDir-abe620e relToTmpDir

#

missing coverage

relToTmpDir returns path relative to the temp extraction directory.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/git.go
X Reqmd.source Line
106
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-ListSubmodulesAtTag-f8e2142 ListSubmodulesAtTag

#

missing coverage

ListSubmodulesAtTag returns a map of submodule path → pinned commit SHAat the given git tag. Uses git ls-tree -t <tag> and filters forsubmodule entries (mode 160000, type commit). Returns an empty mapif the tag has no submodules. Returns an error if the tag is invalidor the git command fails.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/git.go
X Reqmd.source Line
122
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-parseLsTreeOutput-ac82723 parseLsTreeOutput

#

missing coverage

parseLsTreeOutput parses the output of git ls-tree -t <tag> andreturns only submodule entries (mode 160000, type commit) aspath → SHA. Exposed as a separate function for unit testability.

git ls-tree -t output format (one entry per line): \t

Example:160000 commit abc123def456...\tvendor/spec-a 100644 blob 789ghi012jkl...\tREADME.md

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/git.go
X Reqmd.source Line
153
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-attrFenceInfo-2495c08 attrFenceInfo

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
34
X Reqmd.symbol Kind
const
Status
approved

IMP-parser-mdParser-069e9b6 mdParser

#

missing coverage

mdParser is the shared goldmark instance used by parseMD.Constructed once at package init to avoid re-running extension Init for every .md file.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
45
X Reqmd.symbol Kind
var
Status
approved

IMP-parser-Discover-cc87d2f Discover

#

missing coverage

Discover walks root recursively, locating schema.yaml files.Every directory containing schema.yaml is a document directory.Returns one Document per document directory.Document directories are loaded in parallel for performance.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
63
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-findDocDirs-d29d277 findDocDirs

#

missing coverage

findDocDirs walks root and collects all directories containing schema.yaml.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
88
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-LoadSchema-cb5dcb7 LoadSchema

#

missing coverage

LoadSchema reads and parses the schema.yaml file from a document directory.It returns the raw schema map before any x-reqmd extraction.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
110
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-loadDocument-aad11cd loadDocument

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
122
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-parseFiles-1d993d6 parseFiles

#

missing coverage

parseFiles parses all .md files in a document directory and returns theconcatenated content tree roots in mdFiles order (deterministic), thedocument title (the first file's h1 heading, if any), mergedfrontmatter, and any per-file errors. Files are parsed in parallel;results are collected by file index so the returned order never dependson goroutine completion order.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
163
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-result-426f339 result

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
168
X Reqmd.symbol Kind
type
Status
approved

IMP-parser-parseParallelThreshold-93b90ab parseParallelThreshold

#

missing coverage

parseParallelThreshold is the minimum file size (in bytes) for which theroot-split pre-scan + intra-file chunk parallelism is worth it. Belowthis size the file is parsed serially: the pre-scan is an extra fullline scan plus a frontmatter YAML parse, and a small file parses inwell under a millisecond so chunking cannot help. Cross-file parallelism(the worker pool in parseFiles) still applies.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
228
X Reqmd.symbol Kind
const
Status
approved

IMP-parser-parseMD-626e5e6 parseMD

#

missing coverage

parseMD parses a single .md file and returns the assembled content treeroots, the file title (the first h1 heading, when present), and any YAMLfrontmatter as a map.

Level-1 headings are document titles, not content: they are never nodesand can never be requirements (only h2+ can). The first h1 in the file iscaptured as the file title; the tree assembled from the remaining nodesstarts at the content heading level.

For large files with multiple root-level requirements (parent=nil), thefile is split at root requirement boundaries and chunks are parsed inparallel. Each chunk yields a flat node stream in source order; thestreams are concatenated and assembled into the tree afterwards sonesting across chunk boundaries (e.g. a container in chunk 0 with arequirement in chunk 1) is preserved. The pre-scan to find splitpoints is a cheap line scan that replicates the stack logic withoutbuilding a goldmark AST.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
247
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-chunkResult-928de6c chunkResult

#

missing coverage

Compute chunk boundaries: which split indices start/end each chunk.Chunk 0 additionally covers the file preamble [0, splits[0]) soleading containers and prose (including the h1 title) are neverdropped.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
283
X Reqmd.symbol Kind
type
Status
approved

IMP-parser-parseMDChunk-5dc2f33 parseMDChunk

#

missing coverage

parseMDChunk parses a single chunk of markdown (possibly the whole file)using goldmark and returns the flat node stream in source order, the filetitle (first h1 heading), and any YAML frontmatter. Every heading excepta level-1 document title becomes a node; prose and other blocks attach tothe most recently opened node's Body. Nodes are NOT assembled into a treehere — callers must assemble the concatenated streams so nesting acrosschunk boundaries is preserved.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
334
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-assembleTree-d304ba8 assembleTree

#

missing coverage

assembleTree builds the document content tree from a flat, ordered nodestream. A node's parent is the nearest preceding heading with ashallower level; requirements additionally get ParentID pointing at thenearest preceding requirement heading. Info nodes with children arepromoted to KindContainer.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
475
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-popByLevel-b6b3780 popByLevel

#

missing coverage

popByLevel removes stack entries whose level is >= target, mirroringthe heading-nesting rule: a heading at level L closes everything atlevel L or deeper.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
504
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-promoteContainers-4b9cb68 promoteContainers

#

missing coverage

promoteContainers upgrades info nodes that have children to containers.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
512
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-reqStackEntry-c41a8b4 reqStackEntry

#

missing coverage

reqStackEntry tracks an open requirement at a heading level during theroot-split pre-scan.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
523
X Reqmd.symbol Kind
type
Status
approved

IMP-parser-popStackToLevel-0f8087e popStackToLevel

#

missing coverage

popStackToLevel removes entries whose level is >= targetLevel.Used by the root-split pre-scan to replicate requirement nesting.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
529
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-findRootSplits-2059702 findRootSplits

#

missing coverage

findRootSplits scans src line-by-line to find byte offsets where root-levelrequirements begin. A root requirement is one where the requirement stackis empty when the requirement heading is encountered. The scan replicatesthe same stack logic as the assembly step but without building a goldmarkAST.

Returns the byte offsets of root requirement starts (including the headingline) and any YAML frontmatter parsed from the file header.

If only 0 or 1 roots are found, the caller parses the whole file serially.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
546
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-nextLine-3ad066b nextLine

#

missing coverage

nextLine returns the line at byte offset pos (without the trailing \n)and whether there was a newline. The returned slice references src —no allocation.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
602
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-headingLevelBytes-c6b847f headingLevelBytes

#

missing coverage

headingLevelBytes returns the heading level (1-6) and true if the lineis a markdown heading (e.g. "## Title"). Returns 0, false otherwise.Works on []byte to avoid string allocation.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
613
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-nextNonBlankIsAttrBytes-b179628 nextNonBlankIsAttrBytes

#

missing coverage

nextNonBlankIsAttrBytes checks if the next non-blank line after byteoffset pos is a ```attr fence. Scans src directly — no allocation.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
629
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-isNextAttrBlock-2901c53 isNextAttrBlock

#

missing coverage

isNextAttrBlock returns true if n's next sibling is a ```attr fence.Blank lines between heading and fence are consumed by goldmark and don'tcreate AST nodes, so they don't affect this check.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
648
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-splitHeadingID-bf6d963 splitHeadingID

#

missing coverage

splitHeadingID splits a heading like "REQ-001: This is a title"into ("REQ-001", "This is a title"). If there's no colon+space,returns (heading, "").

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
663
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-collectInlineText-88fd5e8 collectInlineText

#

missing coverage

--- text extraction helpers ---

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
672
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-fenceInfo-3dd44e1 fenceInfo

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
686
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-fenceLines-1497970 fenceLines

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
694
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-paragraphText-2c38d4d paragraphText

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
703
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-renderFence-4f29349 renderFence

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
714
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-renderBlock-1867761 renderBlock

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
724
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-ParseSingleFile-250a119 ParseSingleFile

#

missing coverage

ParseSingleFile is used by reqmd check <file> --schema <schema>.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser.go
X Reqmd.source Line
746
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-parseReqTree-07a3a65 parseReqTree

#

missing coverage

parseReqTree is a test helper: parses src and returns the assembledcontent tree roots.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
14
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-reqsOf-4fb7484 reqsOf

#

missing coverage

reqsOf returns the flat requirement list of an assembled tree.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
24
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_Full-9d1bcca TestParseMD_Full

#

missing coverage

TestParseMD_Full verifies a normal requirement with heading, attr block,prose body, and *Rationale: line.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
30
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_NoRationale-a066ea1 TestParseMD_NoRationale

#

missing coverage

TestParseMD_NoRationale verifies that a requirement without *Rationale:*has an empty Rational field.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
60
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_MultipleRequirements-af22eff TestParseMD_MultipleRequirements

#

missing coverage

TestParseMD_MultipleRequirements verifies that multiple requirementsin one document are each parsed correctly.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
73
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_HeadingWithoutAttrIsInfo-c482966 TestParseMD_HeadingWithoutAttrIsInfo

#

missing coverage

TestParseMD_HeadingWithoutAttrIsInfo verifies that a heading without anattr block produces an info item instead of a requirement.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
96
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_BadYAML-b6e68d1 TestParseMD_BadYAML

#

missing coverage

TestParseMD_BadYAML verifies that invalid YAML inside an attr blockreturns an error.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
119
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_NonAttrCodeBlock-81dc505 TestParseMD_NonAttrCodeBlock

#

missing coverage

TestParseMD_NonAttrCodeBlock verifies that a fenced code block with anon-attr info string (e.g. ```json) inside a requirement body is preserved.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
132
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_EmptyFile-1ed701a TestParseMD_EmptyFile

#

missing coverage

TestParseMD_EmptyFile verifies that parsing an empty source returnsno nodes and no error.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
146
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_ThematicBreak-858144f TestParseMD_ThematicBreak

#

missing coverage

TestParseMD_ThematicBreak verifies that thematic breaks (---) insidea requirement body are preserved and don't disrupt body accumulation.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
158
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_ArrayAttr-3b2533f TestParseMD_ArrayAttr

#

missing coverage

TestParseMD_ArrayAttr verifies that an attribute with a YAML array valueis parsed into []interface{} with the correct elements.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
172
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_SubReqUnderParent-8cbf9e9 TestParseMD_SubReqUnderParent

#

missing coverage

TestParseMD_SubReqUnderParent verifies that a ### heading with an attr blockimmediately following a ## heading creates a sub-requirement with ParentID set.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
195
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_MultipleSubReqs-1879aa2 TestParseMD_MultipleSubReqs

#

missing coverage

TestParseMD_MultipleSubReqs verifies that multiple ### sub-requirementsunder the same ## parent all get the correct ParentID.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
226
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_SubReqDynamicLevel-0a560b0 TestParseMD_SubReqDynamicLevel

#

missing coverage

TestParseMD_SubReqDynamicLevel verifies that a ### heading with attr blockas the FIRST requirement is a top-level requirement, not an orphan child.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
245
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_SubHeadingBecomesInfo-345b983 TestParseMD_SubHeadingBecomesInfo

#

missing coverage

TestParseMD_SubHeadingBecomesInfo verifies that a ### heading without anattr block under a requirement becomes an info item child, not body text.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
261
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_DynamicReqLevel-7f422c2 TestParseMD_DynamicReqLevel

#

missing coverage

TestParseMD_DynamicReqLevel verifies that requirements chain by headinglevel when the content tree starts at level 2 (h1 is reserved for thedocument title).

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
292
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_H1IsDocumentTitle-9cbe059 TestParseMD_H1IsDocumentTitle

#

missing coverage

TestParseMD_H1IsDocumentTitle verifies that a level-1 heading is treatedas the document title: an h1 with an attr block is rejected (requirementsmust be level 2+), and a plain h1 is captured as the title and neverbecomes a content node.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
316
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseSingleFile-541ac55 TestParseSingleFile

#

missing coverage

TestParseSingleFile verifies ParseSingleFile reads a real file from diskand produces the correct results. Uses t.TempDir() for the temp file.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
348
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_Title-adb89a7 TestParseMD_Title

#

missing coverage

TestParseMD_Title verifies that a heading with "ID: Title" formatsplits the ID and Title correctly.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
387
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_NoTitle-57898c2 TestParseMD_NoTitle

#

missing coverage

TestParseMD_NoTitle verifies that a heading without ": " has empty Title.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
402
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_TitleWithColonInTitle-a90e081 TestParseMD_TitleWithColonInTitle

#

missing coverage

TestParseMD_TitleWithColonInTitle verifies that only the first ": " splits(IDs can't contain colons per the ID pattern, but titles may).

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
418
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_ContainerHoldsRequirements-c119338 TestParseMD_ContainerHoldsRequirements

#

missing coverage

TestParseMD_ContainerHoldsRequirements verifies that a container heading(no attr block) becomes a KindContainer node that holds the requirementsnested under it, which stay top-level (no requirement parent).

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
435
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_UserExample1-4fe01b9 TestParseMD_UserExample1

#

missing coverage

TestParseMD_UserExample1 reproduces the scenario the user described:a container at the same level breaks the requirement chain; requirementsnest under containers and stay top-level.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
469
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_DeepNesting-264a679 TestParseMD_DeepNesting

#

missing coverage

TestParseMD_DeepNesting verifies requirements at arbitrary depth(3+ levels) chain correctly when no containers intervene.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
513
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_ContainerDoesNotBreakDeeperChain-8ed979f TestParseMD_ContainerDoesNotBreakDeeperChain

#

missing coverage

TestParseMD_ContainerDoesNotBreakDeeperChain verifies that a containerheading deeper than the current requirement does NOT break the chain:requirements after it still link to the nearest shallower requirement.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
533
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_LevelGapNoContainer-efe3d45 TestParseMD_LevelGapNoContainer

#

missing coverage

TestParseMD_LevelGapNoContainer verifies that a heading gap without acontainer still links children to the nearest shallower requirement.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
579
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_SiblingContainersBreakChain-c8e8243 TestParseMD_SiblingContainersBreakChain

#

missing coverage

TestParseMD_SiblingContainersBreakChain verifies that multiple containersat successive levels produce only top-level requirements.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
595
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_Preamble-342cd93 TestParseMD_Preamble

#

missing coverage

TestParseMD_Preamble verifies that leading prose before the first headingis captured as an info node and not dropped, and that an h1 title does notbecome a wrapping container.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
612
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_RequirementlessFile-04022cd TestParseMD_RequirementlessFile

#

missing coverage

TestParseMD_RequirementlessFile verifies that a file with no requirementheadings at all is captured entirely as info nodes, with the h1 title keptout of the content tree.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
649
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_ChunkedPreamble-5ad1399 TestParseMD_ChunkedPreamble

#

missing coverage

TestParseMD_ChunkedPreamble verifies that the parallel chunked path(multiple root requirements) still captures the file preamble and title.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
676
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseMD_LevelGapUnderContainer-8b98274 TestParseMD_LevelGapUnderContainer

#

missing coverage

TestParseMD_LevelGapUnderContainer verifies that a requirement inside acontainer under another requirement gets the right ParentID (nearestshallower requirement) and container nesting.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
703
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseLsTreeOutput_Empty-77f5401 TestParseLsTreeOutput_Empty

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
717
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseLsTreeOutput_NoSubmodules-4532e94 TestParseLsTreeOutput_NoSubmodules

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
724
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseLsTreeOutput_OneSubmodule-b8eea82 TestParseLsTreeOutput_OneSubmodule

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
733
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseLsTreeOutput_MultipleSubmodules-1076783 TestParseLsTreeOutput_MultipleSubmodules

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
746
X Reqmd.symbol Kind
function
Status
approved

IMP-parser-TestParseLsTreeOutput_Malformed-52b1abd TestParseLsTreeOutput_Malformed

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/parser/parser_test.go
X Reqmd.source Line
766
X Reqmd.symbol Kind
function
Status
approved