Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ module(name = "score_docs_as_code")
# Python version
#
###############################################################################
bazel_dep(name = "rules_python", version = "1.8.3")
bazel_dep(name = "rules_python", version = "2.0.2")

# sphinxdocs was extracted into a separate BCR module starting with rules_python 2.0.0
bazel_dep(name = "sphinxdocs", version = "2.0.2")
Comment on lines +22 to +25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not update bazel dependencies if not absolutely needed for your PR.


PYTHON_VERSION = "3.12"

Expand Down
2,258 changes: 2,018 additions & 240 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Easy streamlined way for S-CORE docs-as-code.

load("@aspect_rules_py//py:defs.bzl", "py_binary", "py_venv")
load("@docs_as_code_hub_env//:requirements.bzl", "all_requirements")
load("@rules_python//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs")
load("@sphinxdocs//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs")

def _rewrite_needs_json_to_docs_sources(labels):
"""Replace '@repo//:needs_json' -> '@repo//:docs_sources' for every item."""
Expand Down
47 changes: 31 additions & 16 deletions src/extensions/score_metamodel/metamodel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,15 @@ needs_types:
status: ^(valid|invalid)$
# req-Id: tool_req__docs_common_attr_description
content: ^[\s\S]+$
mandatory_links:
optional_links:
Comment thread
RolandJentschETAS marked this conversation as resolved.
# req-Id: tool_req__docs_req_link_satisfies_allowed
satisfies: stkh_req
# TODO: make derived_from mandatory once downstream repos migrate from satisfies
derived_from: stkh_req
satisfies: stkh_req # for backward compatibility
belongs_to: feat # for evaluation
satisfied_by: feat # new preferred name for belongs_to
# req-Id: tool_req__docs_req_link_covers_aou
covers: aou_req
optional_options:
codelink: ^.*$
testlink: ^.*$
Expand All @@ -306,10 +312,6 @@ needs_types:
# req-Id: tool_req__docs_req_attr_validity_correctness
valid_from: ^v(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?$
valid_until: ^v(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?$
optional_links:
belongs_to: feat # for evaluation
# req-Id: tool_req__docs_req_link_covers_aou
covers: aou_req
Comment thread
MaximilianSoerenPollak marked this conversation as resolved.
tags:
- requirement
- requirement_excl_process
Expand All @@ -329,10 +331,16 @@ needs_types:
status: ^(valid|invalid)$
# req-Id: tool_req__docs_common_attr_description
content: ^[\s\S]+$
mandatory_links:
optional_links:
Comment thread
MaximilianSoerenPollak marked this conversation as resolved.
# req-Id: tool_req__docs_req_link_satisfies_allowed
satisfies: feat_req
belongs_to: comp
# TODO: make derived_from mandatory once downstream repos migrate from satisfies
derived_from: feat_req
satisfies: feat_req # for backward compatibility
belongs_to: comp # for backward compatibility
satisfied_by: comp # new preferred name for belongs_to
# TODO: make satisfied_by mandatory once downstream repos migrate from belongs_to
# req-Id: tool_req__docs_req_link_covers_aou
covers: aou_req
optional_options:
codelink: ^.*$
testlink: ^.*$
Expand All @@ -341,9 +349,6 @@ needs_types:
# req-Id: tool_req__docs_req_attr_testcov
testcovered: ^(YES|NO)$
hash: ^.*$
optional_links:
# req-Id: tool_req__docs_req_link_covers_aou
covers: aou_req
tags:
- requirement
- requirement_excl_process
Expand Down Expand Up @@ -986,9 +991,9 @@ needs_extra_links:
# S-CORE Metamodel
##############################################################
# Requirements
satisfies:
incoming: satisfied by
outgoing: satisfies
derived_from:
incoming: derives
outgoing: derived from

# req-Id: tool_req__docs_req_link_covers_aou
covers:
Expand All @@ -1004,6 +1009,15 @@ needs_extra_links:
incoming: has
outgoing: belongs to

satisfied_by:
incoming: satisfies
outgoing: satisfied by

satisfies:
incoming: satisfied by
outgoing: satisfies
Comment on lines +1016 to +1018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be deprecated in a new PR after this one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed β€” tracked in follow-up issue #594


# kept for backward compatibility - old name for satisfies
fulfils:
incoming: fulfilled by
outgoing: fulfils
Expand Down Expand Up @@ -1067,8 +1081,9 @@ graph_checks:
include: stkh_req, feat_req, comp_req, aou_req, gd_req, tool_req
condition: safety == QM
check:
derived_from: safety == QM
satisfies: safety == QM
explanation: QM requirements cannot satisfy ASIL requirements.
explanation: QM requirements cannot be derived from ASIL requirements.
Comment thread
MaximilianSoerenPollak marked this conversation as resolved.

# req-Id: tool_req__docs_arch_link_qm_to_safety_req
tool_req__docs_arch_link_qm_to_safety_req:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
:reqtype: Process
:security: YES
:safety: ASIL_B
:satisfies: stkh_req__test_stakeholder_requirement_1__basic_stkh_req
:derived_from: stkh_req__test_stakeholder_requirement_1__basic_stkh_req
:status: invalid

Test Feature Requirement 1
Expand Down Expand Up @@ -99,7 +99,7 @@ Component 1
:reqtype: Process
:security: YES
:safety: ASIL_B
:satisfies: feat_req__test_feature_1__test_req_1
:derived_from: feat_req__test_feature_1__test_req_1
:status: invalid

Test Component 1 Requirement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
.. feat_req:: Child requirement 1
:id: feat_req__child__1
:safety: QM
:satisfies: feat_req__parent__QM
:derived_from: feat_req__parent__QM
:status: valid


Expand All @@ -46,22 +46,33 @@
.. feat_req:: Child requirement 2
:id: feat_req__child__2
:safety: ASIL_B
:satisfies: feat_req__parent__ASIL_B
:derived_from: feat_req__parent__ASIL_B
:status: valid



.. Negative Test: Child requirement QM. Parent requirement is `ASIL_B`. Child cant fulfill the safety level of the parent.
#EXPECT[+2]: QM requirements cannot satisfy ASIL requirements.
#EXPECT[+2]: QM requirements cannot be derived from ASIL requirements.

.. comp_req:: Child requirement 3
:id: feat_req__qm_child_with_asil_parent
:safety: QM
:satisfies: feat_req__parent__ASIL_B
:derived_from: feat_req__parent__ASIL_B
:status: valid



.. Parent requirement does not exist
#EXPECT[+2]: unknown outgoing link

.. feat_req:: Child requirement 4
:id: feat_req__linking_to_unknown_parent
:safety: ASIL_B
:status: valid
:derived_from: feat_req__parent0__abcd



.. Mitigation of Safety Analysis (FMEA and DFA) shall be checked. Mitigation shall have the same or higher safety level than the analysed item.
.. Negative Test: Linked to a mitigation that is lower than the safety level of the analysed item.
#EXPECT[+2]: feat_saf_dfa__child__5: Parent need `feat_req__parent__QM` does not fulfill condition `safety != QM`. Explanation: An ASIL_B safety requirement must link to a ASIL_B requirement. Please ensure that the linked requirements safety level is not QM and it's status is valid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

.. feat_req:: Child requirement
:id: feat_req__abcg
:satisfies: stkh_req__abcd
:derived_from: stkh_req__abcd

.. stkh_req:: Parent requirement
:id: stkh_req__abcd
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _strip_score_docs_overrides(content: str) -> str:
# ^bazel_dep\(name = ["']score_docs_as_code["'] β€” literal call with either quote style
# (?:, version = ["'][^"']+["'])? β€” optional version argument, any value
# \) β€” closing paren
_BAZEL_DEP_PATTERN = r"""^bazel_dep\(name = ["']score_docs_as_code["'](?:, version = ["'][^"']+["'])?\)"""
_BAZEL_DEP_PATTERN = r"""^bazel_dep\(name = ["']score_docs_as_code["'][^)]*\)"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this suddenly changed?



def _write_module_bazel(
Expand Down
Loading