From 0163da94d5c6e0e967b44cae1e6a5f78f91cf0fb Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Wed, 10 Jun 2026 11:39:30 +0200 Subject: [PATCH 1/2] Feat: Delete id_contains_feature check & tests Id_contains_feature check is no longer valid due to changes in the Process that have folder structure rearrangements. The check would now fail in every single repo that will follow the new template of the folder structure. Therefore deleting it. --- docs/internals/requirements/requirements.rst | 1 - src/extensions/score_metamodel/BUILD | 11 --- .../checks/id_contains_feature.py | 76 ------------------- .../test_id_contains_feature.rst | 36 --------- 4 files changed, 124 deletions(-) delete mode 100644 src/extensions/score_metamodel/checks/id_contains_feature.py delete mode 100644 src/extensions/score_metamodel/tests/rst/id_contains_feature/test_id_contains_feature.rst diff --git a/docs/internals/requirements/requirements.rst b/docs/internals/requirements/requirements.rst index 220d94dae..68596e53a 100644 --- a/docs/internals/requirements/requirements.rst +++ b/docs/internals/requirements/requirements.rst @@ -102,7 +102,6 @@ This section provides an overview of current process requirements and their clar * A prefix indicating the need type (e.g. `feature__`) * A middle part matching the hierarchical structure of the need: - * For requirements: a portion of the feature tree or a component acronym * For architecture elements: the structural element (e.g. a part of the feature tree, component acronym) * For safety analysis (FMEA, DFA): name of analyzed structural element (e.g. Persistency, FEO, etc.) * Additional descriptive text to ensure human readability diff --git a/src/extensions/score_metamodel/BUILD b/src/extensions/score_metamodel/BUILD index 9fdb011e2..6fbf3c362 100644 --- a/src/extensions/score_metamodel/BUILD +++ b/src/extensions/score_metamodel/BUILD @@ -108,17 +108,6 @@ score_pytest( deps = [":score_metamodel"], ) -score_pytest( - name = "file_based_tests_id_contains_feature", - srcs = ["tests/test_rules_file_based.py"], - data = glob(["tests/rst/id_contains_feature/*.rst"]) + [ - "tests/rst/conf.py", - "tests/rst/needs.json", - ], - pytest_config = "//:pyproject.toml", - deps = [":score_metamodel"], -) - score_pytest( name = "file_based_tests_options", srcs = ["tests/test_rules_file_based.py"], diff --git a/src/extensions/score_metamodel/checks/id_contains_feature.py b/src/extensions/score_metamodel/checks/id_contains_feature.py deleted file mode 100644 index 035cf18a9..000000000 --- a/src/extensions/score_metamodel/checks/id_contains_feature.py +++ /dev/null @@ -1,76 +0,0 @@ -# ******************************************************************************* -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* -import os -import re - -from score_metamodel import ( - CheckLogger, - local_check, -) -from sphinx.application import Sphinx -from sphinx_needs.need_item import NeedItem - - -@local_check -def id_contains_feature(app: Sphinx, need: NeedItem, log: CheckLogger): - """ - The ID is expected to be in the format '____'. - Most of this is ensured via regex in the metamodel. - However the feature part is checked here. - """ - - parts = need["id"].split("__") - - if len(parts) != 3 or need["id"].startswith("stkh_req__"): - # No warning needed here, as this is already checked in the metamodel. - return - - if parts[0] == "dec_rec": - # Decision records are intentionally not located within their components - return - - # Get the part of the string after the first two underscores: the path - feature = parts[1] - if feature == "example_feature": - return - featureparts = re.split(r"[_-]", feature) - - dir_docname = os.path.dirname(str(need.get("docname", ""))) - - # If the 'rst' file is not in a directory, the above expression will be "". - # Even if the need itself has a docname. That's why we have this logic here. - # NOTE: This does not match the process requirements - docname = dir_docname if dir_docname else need.get("docname", "") - - # allow if any feature part is contained in UID - foundfeatpart = any( - featurepart.lower() in docname.lower() - for featurepart in featureparts - if featureparts and featurepart and docname - ) - - # allow abbreviation of the feature - initials = ( - "".join(fp[0].lower() for fp in featureparts) if len(featureparts) > 1 else "" - ) - foundinitials = bool(initials) and docname and initials in docname.lower() - - if not (foundfeatpart or foundinitials): - log.warning_for_option( - need, - "id", - ( - f"Featurepart '{featureparts}' not in path '{docname}' " - f"or abbreviation not ok, expected: '{initials}'." - ), - ) diff --git a/src/extensions/score_metamodel/tests/rst/id_contains_feature/test_id_contains_feature.rst b/src/extensions/score_metamodel/tests/rst/id_contains_feature/test_id_contains_feature.rst deleted file mode 100644 index 50b07c966..000000000 --- a/src/extensions/score_metamodel/tests/rst/id_contains_feature/test_id_contains_feature.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. - # ******************************************************************************* - # Copyright (c) 2025 Contributors to the Eclipse Foundation - # - # See the NOTICE file(s) distributed with this work for additional - # information regarding copyright ownership. - # - # This program and the accompanying materials are made available under the - # terms of the Apache License Version 2.0 which is available at - # https://www.apache.org/licenses/LICENSE-2.0 - # - # SPDX-License-Identifier: Apache-2.0 - # ******************************************************************************* -#CHECK: id_contains_feature - -.. Feature is in the path of the RST file -#EXPECT-NOT[+2]: Feature 'id_contains_feature' not in path - -.. std_wp:: This is a test - :id: std_wp__id_contains_feature__abce - - -.. Check if the feature is in the path of the RST file is skipped, - because the id contains 4 parts -#EXPECT-NOT[+2]: not in path - -.. std_wp:: This is a test - :id: std_wp__test1__test2__abce - - -.. Check if the feature is in the path of the RST file is skipped, - because the requirement type is stkh_req -#EXPECT-NOT[+2]: Feature 'test' not in path - -.. stkh_req:: This is a test - :id: stkh_req__test__abce From 6006403e09ce29b7bbd5de9859d2593fce841e17 Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak <maximilian.pollak@qorix.com> Date: Wed, 10 Jun 2026 11:43:02 +0200 Subject: [PATCH 2/2] Fix: Delete 'id_contains_feature' from documentation --- docs/internals/extensions/metamodel.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/internals/extensions/metamodel.md b/docs/internals/extensions/metamodel.md index d846779a8..e266d0866 100644 --- a/docs/internals/extensions/metamodel.md +++ b/docs/internals/extensions/metamodel.md @@ -208,7 +208,6 @@ score_metamodel/ │ ├── attributes_format.py │ ├── check_options.py │ ├── graph_checks.py -│ ├── id_contains_feature.py │ └── standards.py ├── external_needs.py ├── log.py @@ -222,8 +221,6 @@ score_metamodel/ │ ├── conf.py │ ├── graph │ │ └── test_metamodel_graph.rst - │ ├── id_contains_feature - │ │ └── test_id_contains_feature.rst │ └── options │ └── test_options_options.rst └── ...