reqmd Package: filter

Package: filter

approved 49Leaf

49 requirements · 7 nested · 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-filter-builtInVars-7de697e builtInVars

#

missing coverage

builtInVars are always available in the filter scope regardless ofschema declarations. id and title live on model.Node, not inAttrs; the rest are the RFC §2.3 built-in attributes (status,disposition, trace, version). They are always accepted by the typocheck even when no schema in the tree declares them; at evaluation timea requirement lacking the attribute sees nil (see AllowUndefinedVariables).

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

IMP-filter-exprBuiltins-d2b10a6 exprBuiltins

#

missing coverage

exprBuiltins is the set of expr built-in function names that are NOTvariable references. We exclude them from attribute validation so thatid startsWith "SYS-" or len(variant) > 0 don't trip the typo check.

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

IMP-filter-Filter-fe786ff Filter

#

Filter is a compiled attribute filter expression. It is safe forconcurrent use after construction — the underlying vm.Program isread-only.

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

IMP-filter-Expr-2023150 Expr

#

Expr returns the original expression string.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter.go
X Reqmd.source Line
174
X Reqmd.symbol Kind
method
Status
approved

IMP-filter-Refs-477c375 Refs

#

Refs returns the sorted, deduplicated list of variable namesreferenced in the expression (excluding expr built-in functions).

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter.go
X Reqmd.source Line
178
X Reqmd.symbol Kind
method
Status
approved

IMP-filter-Match-57b6e5c Match

#

Match evaluates the compiled expression against a single requirement.Returns (true, nil) if the requirement matches, (false, nil) if not,and (false, err) if evaluation fails (e.g. type mismatch).

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter.go
X Reqmd.source Line
183
X Reqmd.symbol Kind
method
Status
approved

IMP-filter-FilterDocs-2f82f12 FilterDocs

#

FilterDocs returns a new []model.Document containing only matchingrequirements per document. Non-requirement nodes (containers and infoitems) are always kept, so document structure and content survivefiltering. Documents with all requirements filtered out are kept (withonly items) so document-level structure is preserved for list/stats/export output.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter.go
X Reqmd.source Line
202
X Reqmd.symbol Kind
method
Status
approved

IMP-filter-MatchingIDs-7e11246 MatchingIDs

#

MatchingIDs returns a set of requirement IDs that match the filter.Used by check/serve for filter-aware graph checks — the graph isbuilt from the full tree, but only matching reqs are checked/reported.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter.go
X Reqmd.source Line
219
X Reqmd.symbol Kind
method
Status
approved

IMP-filter-pruneNodes-5c73a8e pruneNodes

#

pruneNodes returns the subset of a node list to keep: all non-requirement nodes are kept; requirement nodes are kept only when theymatch the filter. Children of a pruned requirement are re-attached tothe pruned node's position so no matching requirement is lost. Keptnodes are shallow copies — the input tree is never mutated, somultiple filtered views of the same documents stay independent.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter.go
X Reqmd.source Line
241
X Reqmd.symbol Kind
method
Status
approved

IMP-filter-Compile-a260df6 Compile

#

missing coverage

Compile parses, validates, and compiles a filter expression (strictmode).

validAttrs is the union of all schema property names (plus built-invariable names) across every document in the tree. Referencing a namenot in this set is a compile-time ERROR — this catches typos andreferences to attributes that no document declares.

The expression is compiled with AllowUndefinedVariables so that arequirement whose document does not declare a referenced attributeevaluates that variable to nil (the req is excluded unless theexpression handles absence, e.g. variant == null).

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

IMP-filter-CompileRelaxed-1eadd2d CompileRelaxed

#

missing coverage

CompileRelaxed compiles a filter expression without hard-failing onattribute names that are not declared in any schema.yaml. validAttrs isthe expanded allowed set (schema-declared names plus every attributeactually found on a requirement); declaredAttrs is the schema-declaredset plus built-ins and drives which references produce a warning. Everyreferenced name outside declaredAttrs yields a warning instead of anerror, so undeclared-but-present attributes become filterable while truetypos no longer abort the run.

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

IMP-filter-compile-d149656 compile

#

missing coverage

compile is the shared implementation for strict and relaxed modes.strict=true returns an error for any referenced name outside validAttrs(the global typo check). strict=false never errors on unknown names;instead every name outside declaredAttrs is collected as a warning.

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

IMP-filter-buildEnv-76a4b5e buildEnv

#

missing coverage

buildEnv constructs the expr evaluation environment for a requirement:the req's Attrs map plus id and title injected as top-level vars.We copy into a new map to avoid mutating the original Attrs.

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

IMP-filter-BuildValidAttrs-4f190c9 BuildValidAttrs

#

missing coverage

BuildValidAttrs computes the union of all schema property names acrossevery document plus the built-in variable names. The result is used byCompile for strict attribute validation.

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

IMP-filter-BuildFoundAttrs-157302b BuildFoundAttrs

#

missing coverage

BuildFoundAttrs computes the union of every attribute key actuallypresent on some requirement in the tree, whether or not it is declaredin a schema.yaml. Relaxed filtering unions this with BuildValidAttrs soundeclared-but-present attributes can be filtered.

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

IMP-filter-WriteWarnings-d60a791 WriteWarnings

#

missing coverage

WriteWarnings writes relaxed-mode filter warnings to w, one per line,prefixed with "reqmd: warning: ". It is a no-op when warnings is emptyso callers can invoke it unconditionally.

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

IMP-filter-CompileForDocs-787afca CompileForDocs

#

missing coverage

CompileForDocs compiles an expression against the attribute union of thegiven documents. It is the shared entry point for every CLI command thataccepts a --filter flag: Compile + BuildValidAttrs in one call.

When allowUndeclared is false the strict typo check applies and anyreference to an attribute not declared in a schema.yaml is an error.When true, references to attributes found on any requirement are allowed(undeclared-but-present) and every out-of-schema reference is returned asa warning instead of an error. Returns (nil, nil, nil) when expr is empty.

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

IMP-filter-refCollector-b8d7be1 refCollector

#

refCollector implements ast.Visitor and collects all IdentifierNodevalues from the expression AST. These are cross-referenced againstvalidAttrs to catch typos.

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

IMP-filter-Visit-a17ddac Visit

#
Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter.go
X Reqmd.source Line
349
X Reqmd.symbol Kind
method
Status
approved

IMP-filter-testReq-328520b testReq

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
10
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-testDocs-202d8ea testDocs

#

missing coverage

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

IMP-filter-validAttrsFor-d5cca1a validAttrsFor

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
56
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileAndMatch_Equality-8fffca1 TestCompileAndMatch_Equality

#

missing coverage

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

IMP-filter-TestCompileAndMatch_ArrayIn-1c93a59 TestCompileAndMatch_ArrayIn

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
84
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileAndMatch_NilAttribute-6d118bc TestCompileAndMatch_NilAttribute

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
108
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileAndMatch_NilCoalescing-1f25f20 TestCompileAndMatch_NilCoalescing

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
125
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileAndMatch_NumericComparison-12893e9 TestCompileAndMatch_NumericComparison

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
161
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileAndMatch_BuiltInIDAndTitle-d27bc68 TestCompileAndMatch_BuiltInIDAndTitle

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
185
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileAndMatch_BooleanComposition-3fe2287 TestCompileAndMatch_BooleanComposition

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
209
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompile_SyntaxError-8019356 TestCompile_SyntaxError

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
233
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompile_UnknownAttribute-407e2d1 TestCompile_UnknownAttribute

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
241
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompile_EmptyExpression-1ae7b0a TestCompile_EmptyExpression

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
249
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompile_AllowsExprBuiltins-71f36c6 TestCompile_AllowsExprBuiltins

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
256
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompile_AllowsCrossSchemaAttribute-185a5b4 TestCompile_AllowsCrossSchemaAttribute

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
266
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestFilterDocs-d2134a8 TestFilterDocs

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
276
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestFilterDocs_PreservesDocStructure-0485295 TestFilterDocs_PreservesDocStructure

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
306
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestFilterDocs_DoesNotMutateOriginal-6641d5c TestFilterDocs_DoesNotMutateOriginal

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
332
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestFilterDocs_KeepsItems-6d8925b TestFilterDocs_KeepsItems

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
351
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestFilterDocs_ReattachesChildrenOfPrunedReq-c822721 TestFilterDocs_ReattachesChildrenOfPrunedReq

#

missing coverage

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

IMP-filter-TestMatchingIDs-1de58f4 TestMatchingIDs

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
411
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestExprAndRefs-3707609 TestExprAndRefs

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
438
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestBuildValidAttrs-d411a09 TestBuildValidAttrs

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
459
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-undeclaredDocs-e3bdc27 undeclaredDocs

#

missing coverage

undeclaredDocs is testDocs plus a requirement carrying an attribute thatno schema declares (owner), the relaxed-filtering scenario.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
479
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestBuildFoundAttrs-57b7a6b TestBuildFoundAttrs

#

missing coverage

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
488
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileForDocs_StrictRejectsUndeclared-ae86a23 TestCompileForDocs_StrictRejectsUndeclared

#

missing coverage

TestCompileForDocs_StrictRejectsUndeclared pins the default behavior: theglobal typo check rejects attributes that no schema declares.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
500
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileForDocs_RelaxedAllowsFoundAttr-6e25897 TestCompileForDocs_RelaxedAllowsFoundAttr

#

missing coverage

TestCompileForDocs_RelaxedAllowsFoundAttr is the relaxed-filter contract:an attribute present on a requirement becomes filterable even though noschema.yaml declares it, and the deviation is reported as a warning.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
510
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileForDocs_RelaxedWarnsOnTrulyUnknown-d916b6a TestCompileForDocs_RelaxedWarnsOnTrulyUnknown

#

missing coverage

TestCompileForDocs_RelaxedWarnsOnTrulyUnknown verifies relaxed mode turnsa genuine typo into a warning instead of aborting the run.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
537
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileForDocs_RelaxedDeclaredAttrNoWarning-256c7a0 TestCompileForDocs_RelaxedDeclaredAttrNoWarning

#

missing coverage

TestCompileForDocs_RelaxedDeclaredAttrNoWarning keeps relaxed mode quietfor expressions that only use declared attributes.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
558
X Reqmd.symbol Kind
function
Status
approved

IMP-filter-TestCompileForDocs_EmptyExpression-61baade TestCompileForDocs_EmptyExpression

#

missing coverage

TestCompileForDocs_EmptyExpression asserts the no-filter fast path.

Details
X Reqmd.imported
true
X Reqmd.source File
internal/filter/filter_test.go
X Reqmd.source Line
569
X Reqmd.symbol Kind
function
Status
approved