@@ -63,22 +63,21 @@ def collect_specification_linked_resources(specification, specification_heading,
63
63
def collect_linked_resources_in_section (
64
64
section , linked_resources_list , specifications_list , include_acceptance_tests , frid = Optional [str ]
65
65
):
66
- # When should we collect resources in the current section (should_collect_resources_in_current_section) :
66
+ # When should we collect specification headings in the current section. Either when one of the following holds true :
67
67
# - frid wasn't specified
68
- # - section has no ID <==> it's the root section
68
+ # - section has no ID (and that's exactly when it's the root section)
69
69
# - section has ID, frid was specified and the specified frid inside the current section tree
70
- should_collect_resources_in_current_section = frid is None or "ID" not in section or frid .startswith (section ["ID" ])
71
- if not should_collect_resources_in_current_section :
72
- return False
73
-
74
- specifications_to_collect = list (set ([DEFINITIONS , NON_FUNCTIONAL_REQUIREMENTS , TEST_REQUIREMENTS ]))
75
- if specifications_list :
76
- specifications_to_collect = list (set (specifications_to_collect ) & set (specifications_list ))
77
-
78
- for specification_heading in specifications_to_collect :
79
- if specification_heading in section :
80
- for requirement in section [specification_heading ]:
81
- collect_specification_linked_resources (requirement , specification_heading , linked_resources_list )
70
+ should_collect_specification_headings_in_current_section = (
71
+ frid is None or "ID" not in section or frid .startswith (section ["ID" ])
72
+ )
73
+ if should_collect_specification_headings_in_current_section :
74
+ specifications_to_collect = list (set ([DEFINITIONS , NON_FUNCTIONAL_REQUIREMENTS , TEST_REQUIREMENTS ]))
75
+ if specifications_list :
76
+ specifications_to_collect = list (set (specifications_to_collect ) & set (specifications_list ))
77
+ for specification_heading in specifications_to_collect :
78
+ if specification_heading in section :
79
+ for requirement in section [specification_heading ]:
80
+ collect_specification_linked_resources (requirement , specification_heading , linked_resources_list )
82
81
83
82
if FUNCTIONAL_REQUIREMENTS in section and (
84
83
not specifications_list or FUNCTIONAL_REQUIREMENTS in specifications_list
@@ -97,7 +96,9 @@ def collect_linked_resources_in_section(
97
96
acceptance_test , FUNCTIONAL_REQUIREMENTS , linked_resources_list
98
97
)
99
98
100
- if current_frid == frid :
99
+ if frid is not None and current_frid == frid :
100
+ # here, we rely on the fact that FRIDs are incrementing. And if we have reached the current FRID, we should
101
+ # not collect any FRIDs after the current one.
101
102
return True
102
103
103
104
if "sections" in section :
0 commit comments