Skip to content

Commit 48ae479

Browse files
committed
feat: Satisfy gd_req__arch_linkage_safety
1 parent 25aa9b7 commit 48ae479

3 files changed

Lines changed: 119 additions & 0 deletions

File tree

docs/internals/requirements/requirements.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,17 @@ Architecture Attributes
715715
Docs-as-Code shall enforce that valid safety architectural elements (Safety != QM) can
716716
only be linked against valid safety architectural elements.
717717

718+
.. tool_req:: Check safety architecture view belongs_to a safety parent
719+
:id: tool_req__docs_arch_link_safety_belongs_to
720+
:tags: Architecture
721+
:implemented: YES
722+
:version: 1
723+
:satisfies: gd_req__arch_linkage_safety
724+
:parent_covered: YES
725+
726+
Enforce that valid ASIL architecture views link only
727+
to ASIL architecture elements via ``belongs_to``.
728+
718729
.. tool_req:: Security: Restrict linkage
719730
:id: tool_req__docs_arch_link_security
720731
:tags: Architecture

src/extensions/score_metamodel/metamodel.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,18 @@ graph_checks:
10261026
fulfils: safety != QM
10271027
explanation: An QM architecture element cannot implement ASIL requirements.
10281028

1029+
# req-Id: tool_req__docs_arch_link_safety_belongs_to
1030+
tool_req__docs_arch_link_safety_belongs_to:
1031+
needs:
1032+
include: feat_arc_sta, feat_arc_dyn, comp_arc_sta, comp_arc_dyn
1033+
condition:
1034+
and:
1035+
- safety != QM
1036+
- status == valid
1037+
check:
1038+
belongs_to: safety != QM
1039+
explanation: Safety architecture views must belong to safety architecture elements.
1040+
10291041
# req-Id: tool_req__docs_req_arch_link_safety_to_arch
10301042
tool_req__docs_req_arch_link_safety_to_arch:
10311043
needs:
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
..
2+
# *******************************************************************************
3+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
4+
#
5+
# See the NOTICE file(s) distributed with this work for additional
6+
# information regarding copyright ownership.
7+
#
8+
# This program and the accompanying materials are made available under the
9+
# terms of the Apache License Version 2.0 which is available at
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# SPDX-License-Identifier: Apache-2.0
13+
# *******************************************************************************
14+
15+
#CHECK: check_metamodel_graph
16+
17+
.. feat:: QM Feature Parent
18+
:id: feat__test__qm_parent
19+
:safety: QM
20+
:security: NO
21+
:status: valid
22+
23+
.. feat:: Safety Feature Parent
24+
:id: feat__test__asil_parent
25+
:safety: ASIL_B
26+
:security: NO
27+
:status: valid
28+
29+
.. comp:: QM Component Parent
30+
:id: comp__test__qm_parent
31+
:safety: QM
32+
:security: NO
33+
:status: valid
34+
:belongs_to: feat__test__qm_parent
35+
36+
.. comp:: Safety Component Parent
37+
:id: comp__test__asil_parent
38+
:safety: ASIL_B
39+
:security: NO
40+
:status: valid
41+
:belongs_to: feat__test__asil_parent
42+
43+
44+
.. Negative Test: Safety feat_arc_sta belongs_to a QM feat — should warn.
45+
#EXPECT: feat_arc_sta__test__safety_to_qm: Parent need `feat__test__qm_parent` does not fulfill condition `safety != QM`. Explanation: Safety architecture views must belong to safety architecture elements according to the architecture metamodel.
46+
47+
.. feat_arc_sta:: Safety view with QM parent
48+
:id: feat_arc_sta__test__safety_to_qm
49+
:safety: ASIL_B
50+
:security: NO
51+
:status: valid
52+
:belongs_to: feat__test__qm_parent
53+
54+
55+
.. Positive Test: Safety feat_arc_sta belongs_to a safety feat — should not warn.
56+
#EXPECT-NOT: Safety architecture views must belong to safety architecture elements
57+
58+
.. feat_arc_sta:: Safety view with safety parent
59+
:id: feat_arc_sta__test__safety_to_asil
60+
:safety: ASIL_B
61+
:security: NO
62+
:status: valid
63+
:belongs_to: feat__test__asil_parent
64+
65+
66+
.. Positive Test: QM feat_arc_sta — check does not apply to QM elements.
67+
#EXPECT-NOT: Safety architecture views must belong to safety architecture elements
68+
69+
.. feat_arc_sta:: QM view with QM parent
70+
:id: feat_arc_sta__test__qm_to_qm
71+
:safety: QM
72+
:security: NO
73+
:status: valid
74+
:belongs_to: feat__test__qm_parent
75+
76+
77+
.. Negative Test: Safety comp_arc_sta belongs_to a QM comp — should warn.
78+
#EXPECT: comp_arc_sta__test__safety_to_qm: Parent need `comp__test__qm_parent` does not fulfill condition `safety != QM`. Explanation: Safety architecture views must belong to safety architecture elements according to the architecture metamodel.
79+
80+
.. comp_arc_sta:: Safety component view with QM parent
81+
:id: comp_arc_sta__test__safety_to_qm
82+
:safety: ASIL_B
83+
:security: NO
84+
:status: valid
85+
:belongs_to: comp__test__qm_parent
86+
87+
88+
.. Positive Test: Safety comp_arc_sta belongs_to a safety comp — should not warn.
89+
#EXPECT-NOT: Safety architecture views must belong to safety architecture elements
90+
91+
.. comp_arc_sta:: Safety component view with safety parent
92+
:id: comp_arc_sta__test__safety_to_asil
93+
:safety: ASIL_B
94+
:security: NO
95+
:status: valid
96+
:belongs_to: comp__test__asil_parent

0 commit comments

Comments
 (0)