diff --git a/docs/index.rst b/docs/index.rst index b23acaa27..9193ffaa7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 diff --git a/examples/simple/index.rst b/examples/simple/index.rst index e3c472088..7856e574a 100644 --- a/examples/simple/index.rst +++ b/examples/simple/index.rst @@ -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 @@ -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 diff --git a/src/extensions/score_metamodel/checks/attributes_format.py b/src/extensions/score_metamodel/checks/attributes_format.py index d5d75efe5..a0017406a 100644 --- a/src/extensions/score_metamodel/checks/attributes_format.py +++ b/src/extensions/score_metamodel/checks/attributes_format.py @@ -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:" diff --git a/src/extensions/score_metamodel/tests/rst/attributes/test_attributes_format_id_format.rst b/src/extensions/score_metamodel/tests/rst/attributes/test_attributes_format_id_format.rst index 07648c852..3c8025c5a 100644 --- a/src/extensions/score_metamodel/tests/rst/attributes/test_attributes_format_id_format.rst +++ b/src/extensions/score_metamodel/tests/rst/attributes/test_attributes_format_id_format.rst @@ -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: `____`. +#EXPECT: stk_req__test.id (stk_req__test): expected to consisting of this format: `____`. -.. 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: `____`. .. 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:`__` or `____`.