Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Hello World
This is a simple example of a documentation page using the `docs` tool.

.. stkh_req:: TestTitle
:id: stkh_req__test_requirement
:id: stkh_req__docs__test_requirement
:status: valid
:safety: QM
:rationale: A simple requirement we need to enable a documentation build
Expand Down
3 changes: 2 additions & 1 deletion examples/simple/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Hello World
This is a simple example of a documentation page using the `docs` tool.

.. stkh_req:: TestTitle
:id: stkh_req__test_requirement
:id: stkh_req__docs__test_requirement
:status: valid
:safety: QM
:rationale: A simple requirement we need to enable a documentation build
Expand All @@ -26,6 +26,7 @@ This is a simple example of a documentation page using the `docs` tool.
Some content to make sure we also can render this



.. .. std_req:: External Link Test Req
.. :id: std_req__iso26262__testing
.. :status: valid
Expand Down
31 changes: 27 additions & 4 deletions src/extensions/score_metamodel/checks/attributes_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,35 @@ def check_id_format(app: Sphinx, need: NeedsInfoType, log: CheckLogger):
the requirement id or not.
---
"""
# These folders are taken from 'https://github.com/eclipse-score/process_description/tree/main/process'
# This means, any needs within any of these folders (no matter where they are) will not be required to have 3 parts
process_folder_names = [
"general_concepts",
"introduction",
"process_areas",
"roles",
"standards",
"workflows",
"workproducts",
"process",
]
# Split the string by underscores
parts = need["id"].split("__")

if need["id"].startswith(
("gd_", "wf__", "wp__", "rl__", "stkh_req__", "tool_req__", "doc__")
) or ("process/" in str(need.get("docname", ""))):
if need["type"] in [
"std_wp",
"document", # This is used in 'platform_managment' in score.
"gd_guidl",
"workflow",
"gd_chklst",
"std_req",
"role",
"doc_concept",
"gd_temp",
"gd_method",
"gd_req",
"workproduct",
"doc_getstrt",
] or any(prefix in str(need.get("docname", "")) for prefix in process_folder_names):
if len(parts) != 2 and len(parts) != 3:
msg = (
"expected to consisting of one of these 2 formats:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
#CHECK: check_id_format

.. Id does not consists of 3 parts
#EXPECT: std_wp__test__test__abcd.id (std_wp__test__test__abcd): expected to consisting of this format: `<Req Type>__<Abbreviations>__<Architectural Element>`.
#EXPECT: stk_req__test.id (stk_req__test): expected to consisting of this format: `<Req Type>__<Abbreviations>__<Architectural Element>`.

.. std_wp:: This is a test
:id: std_wp__test__test__abcd
.. stkh_req:: This is a test
:id: stk_req__test

.. Id follows pattern
#EXPECT-NOT: expected to consisting of this format: `<Req Type>__<Abbreviations>__<Architectural Element>`.

.. std_wp:: This is a test
:id: std_wp__test__abce
:id: std_wp__test__test__abcd

.. Id starts with wp and number of parth is neither 2 nor 3
#EXPECT: wp__test__test__abcd.id (wp__test__test__abcd): expected to consisting of one of these 2 formats:`<Req Type>__<Abbreviations>` or `<Req Type>__<Abbreviations>__<Architectural Element>`.
Expand Down