Skip to content

Commit 4c5cd57

Browse files
authored
Merge pull request #2307 from strictdoc-project/stanislaw/req_prefix
backend/sdoc: alias REQ_PREFIX to PREFIX, adjust the code and tests to PREFIX
2 parents 62c9127 + 460b02c commit 4c5cd57

File tree

32 files changed

+48
-48
lines changed

32 files changed

+48
-48
lines changed

docs/sphinx/source/strictdoc_01_user_guide.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ The following ``DOCUMENT`` fields are allowed:
588588
* - ``CLASSIFICATION``
589589
- Security classification of the document, e.g. Public, Internal, Restricted, Confidential
590590

591-
* - ``REQ_PREFIX``
591+
* - ``PREFIX``
592592
- Requirement prefix that should be used for automatic generation of UIDs. See :ref:`Automatic assignment of requirements UID <SECTION-UG-Automatic-assignment-of-requirements-UID>`.
593593

594594
* - ``ROOT``
@@ -2116,15 +2116,15 @@ A document-level requirement mask:
21162116
21172117
[DOCUMENT]
21182118
TITLE: Hello world doc
2119-
REQ_PREFIX: MYDOC-
2119+
PREFIX: MYDOC-
21202120
21212121
A section-level requirement mask:
21222122

21232123
.. code-block::
21242124
21252125
[SECTION]
21262126
TITLE: Section 2.
2127-
REQ_PREFIX: LEVEL2-REQ-
2127+
PREFIX: LEVEL2-REQ-
21282128
21292129
.. _SECTION-TRACEABILITY-REQS-TO-SOURCE-CODE:
21302130

docs/strictdoc_01_user_guide.sdoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ The following ``DOCUMENT`` fields are allowed:
621621
* - ``CLASSIFICATION``
622622
- Security classification of the document, e.g. Public, Internal, Restricted, Confidential
623623

624-
* - ``REQ_PREFIX``
624+
* - ``PREFIX``
625625
- Requirement prefix that should be used for automatic generation of UIDs. See [LINK: SECTION-UG-Automatic-assignment-of-requirements-UID].
626626

627627
* - ``ROOT``
@@ -2559,15 +2559,15 @@ A document-level requirement mask:
25592559

25602560
[DOCUMENT]
25612561
TITLE: Hello world doc
2562-
REQ_PREFIX: MYDOC-
2562+
PREFIX: MYDOC-
25632563

25642564
A section-level requirement mask:
25652565

25662566
.. code-block::
25672567

25682568
[[SECTION]]
25692569
TITLE: Section 2.
2570-
REQ_PREFIX: LEVEL2-REQ-
2570+
PREFIX: LEVEL2-REQ-
25712571
<<<
25722572

25732573
[[/SECTION]]

docs/strictdoc_02_feature_map.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TITLE: StrictDoc Feature Map
44
UID: SDOC_FEATURE_MAP
55
VERSION: Git commit: @GIT_VERSION, Git branch: @GIT_BRANCH
66
DATE: @GIT_COMMIT_DATETIME
7-
REQ_PREFIX: SDOC-FEAT-
7+
PREFIX: SDOC-FEAT-
88
OPTIONS:
99
ENABLE_MID: True
1010
VIEW_STYLE: Narrative

docs/strictdoc_20_L1_Open_Requirements_Tool.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MID: b7bcca934cd148c3855beb4c85723bc5
33
TITLE: Requirements Tool Specification (L1)
44
VERSION: Git commit: @GIT_VERSION, Git branch: @GIT_BRANCH
55
DATE: @GIT_COMMIT_DATETIME
6-
REQ_PREFIX: SDOC-SSS-
6+
PREFIX: SDOC-SSS-
77
ROOT: True
88
OPTIONS:
99
ENABLE_MID: True

docs/strictdoc_21_L2_StrictDoc_Requirements.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MID: 8a87daf19a7c487f89f396406a974509
33
TITLE: StrictDoc Requirements Specification (L2)
44
VERSION: Git commit: @GIT_VERSION, Git branch: @GIT_BRANCH
55
DATE: @GIT_COMMIT_DATETIME
6-
REQ_PREFIX: SDOC-SRS-
6+
PREFIX: SDOC-SRS-
77
OPTIONS:
88
ENABLE_MID: True
99

docs/strictdoc_28_Backlog.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MID: cabef7629dda4f2fb34255d01fea8d5f
33
TITLE: StrictDoc Backlog
44
VERSION: Git commit: @GIT_VERSION, Git branch: @GIT_BRANCH
55
DATE: @GIT_COMMIT_DATETIME
6-
REQ_PREFIX: SDOC-BACKLOG-
6+
PREFIX: SDOC-BACKLOG-
77
OPTIONS:
88
ENABLE_MID: True
99

docs_extra/DO178_requirements.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ TITLE: Technical Note: DO-178C requirements tool requirements
44
VERSION: Git commit: @GIT_VERSION, Git branch: @GIT_BRANCH
55
DATE: @GIT_COMMIT_DATETIME
66
CLASSIFICATION: Draft
7-
REQ_PREFIX: DO178-
7+
PREFIX: DO178-
88
ROOT: True
99
OPTIONS:
1010
ENABLE_MID: True

docs_extra/Zephyr_requirements.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MID: 2e7deb9808bb42879e7463b1d7ac9bba
33
TITLE: Technical Note: Zephyr requirements tool requirements
44
VERSION: Git commit: @GIT_VERSION, Git branch: @GIT_BRANCH
55
DATE: @GIT_COMMIT_DATETIME
6-
REQ_PREFIX: ZEP-
6+
PREFIX: ZEP-
77
ROOT: True
88
OPTIONS:
99
ENABLE_MID: True

strictdoc/backend/sdoc/grammar/grammar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
('VERSION: ' version = SingleLineString '\n')?
7171
('DATE: ' date = SingleLineString '\n')?
7272
('CLASSIFICATION: ' classification = SingleLineString '\n')?
73-
('REQ_PREFIX: ' requirement_prefix = SingleLineString '\n')?
73+
(/(REQ_)?PREFIX/ ': ' requirement_prefix = SingleLineString '\n')?
7474
('ROOT: ' (root = BooleanChoice) '\n')?
7575
('OPTIONS:' '\n'
7676
(' ENABLE_MID: ' (enable_mid = BooleanChoice) '\n')?
@@ -156,7 +156,7 @@
156156
('UID: ' uid = /{REGEX_UID}/ '\n')?
157157
('LEVEL: ' custom_level = SingleLineString '\n')?
158158
'TITLE: ' title = SingleLineString '\n'
159-
('REQ_PREFIX: ' requirement_prefix = SingleLineString '\n')?
159+
(/(REQ_)?PREFIX/ ': ' requirement_prefix = SingleLineString '\n')?
160160
section_contents *= SectionOrRequirement
161161
'\n'
162162
'[/SECTION]'

strictdoc/backend/sdoc/writer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def write_with_fragments(
113113

114114
requirement_prefix = document_config.requirement_prefix
115115
if requirement_prefix is not None:
116-
output += f"REQ_PREFIX: {requirement_prefix}"
116+
output += f"PREFIX: {requirement_prefix}"
117117
output += "\n"
118118

119119
root = document_config.root
@@ -418,7 +418,7 @@ def _print_section(
418418
output += str(section.title)
419419
output += "\n"
420420
if section.requirement_prefix is not None:
421-
output += "REQ_PREFIX: "
421+
output += "PREFIX: "
422422
output += section.requirement_prefix
423423
output += "\n"
424424

strictdoc/cli/command_parser_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ def add_manage_command(parent_command_parser):
515515
description=(
516516
"This command generates missing requirement UID automatically. "
517517
"The UIDs are generated based on the nearest section "
518-
"REQ_PREFIX (if provided) or the document's "
519-
'REQ_PREFIX (if provided or "REQ-" by default).'
518+
"PREFIX (if provided) or the document's "
519+
'PREFIX (if provided or "REQ-" by default).'
520520
),
521521
formatter_class=formatter,
522522
)

strictdoc/export/html/form_objects/document_config_form_object.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def create_from_request(
128128
)
129129

130130
document_requirement_prefix: str = ""
131-
if "REQ_PREFIX" in config_fields:
132-
document_requirement_prefix = config_fields["REQ_PREFIX"]
131+
if "PREFIX" in config_fields:
132+
document_requirement_prefix = config_fields["PREFIX"]
133133
document_requirement_prefix = sanitize_html_form_field(
134134
document_requirement_prefix, multiline=False
135135
)

strictdoc/export/html/templates/screens/document/document/frame_document_config_edit.jinja.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@
5555

5656
{%- with
5757
field_type="singleline",
58-
field_name="REQ_PREFIX",
59-
field_input_name="document[REQ_PREFIX]",
58+
field_name="PREFIX",
59+
field_input_name="document[PREFIX]",
6060
field_value=form_object.document_requirement_prefix,
61-
errors=form_object.get_errors("REQ_PREFIX")
61+
errors=form_object.get_errors("PREFIX")
6262
-%}
6363
{% include "components/form/field/text/index.jinja" %}
6464
{%- endwith -%}

strictdoc/export/json/json_generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def export_tree(
7474
def _write_document(cls, document: SDocDocument) -> Dict[str, Any]:
7575
document_dict: Dict[str, Any] = {
7676
"TITLE": document.title,
77-
"REQ_PREFIX": None,
77+
"PREFIX": None,
7878
JSONKey.GRAMMAR: {"ELEMENTS": []},
7979
JSONKey.OPTIONS: {},
8080
JSONKey.NODES: [],
@@ -99,7 +99,7 @@ def _write_document(cls, document: SDocDocument) -> Dict[str, Any]:
9999

100100
requirement_prefix = document_config.requirement_prefix
101101
if requirement_prefix is not None:
102-
document_dict["REQ_PREFIX"] = requirement_prefix
102+
document_dict["PREFIX"] = requirement_prefix
103103

104104
root = document_config.root
105105
if root is not None:
@@ -294,7 +294,7 @@ def _write_section(
294294
node_dict["LEVEL"] = section.custom_level
295295

296296
if section.requirement_prefix is not None:
297-
node_dict["REQ_PREFIX"] = section.requirement_prefix
297+
node_dict["PREFIX"] = section.requirement_prefix
298298

299299
return node_dict
300300

tests/end2end/helpers/screens/document/form_edit_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def do_fill_in_document_requirement_prefix(
6262
self, field_value: str, field_order: int = 1
6363
) -> None:
6464
assert isinstance(field_value, str)
65-
super().do_fill_in("document[REQ_PREFIX]", field_value, field_order)
65+
super().do_fill_in("document[PREFIX]", field_value, field_order)
6666

6767
def do_fill_in_document_abstract(
6868
self, field_value: str, field_order: int = 1

tests/end2end/screens/document/create_requirement/_autouid_and_PREFIX/create_requirement_generate_autouid_when_requirement_with_another_prefix_exists/expected_output/document.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Document 1
3-
REQ_PREFIX: ZEP-
3+
PREFIX: ZEP-
44

55
[REQUIREMENT]
66
UID: ZEP-1

tests/end2end/screens/document/create_requirement/_autouid_and_PREFIX/create_requirement_generate_autouid_when_requirement_with_another_prefix_exists/expected_output/document2.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Document 1
3-
REQ_PREFIX: ZEP-
3+
PREFIX: ZEP-
44

55
[REQUIREMENT]
66
UID: ZEP-2

tests/end2end/screens/document/create_requirement/_autouid_and_PREFIX/create_requirement_generate_autouid_when_requirement_with_another_prefix_exists/input/document.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Document 1
3-
REQ_PREFIX: ZEP-
3+
PREFIX: ZEP-
44

55
[REQUIREMENT]
66
UID: ZEP-1

tests/end2end/screens/document/create_requirement/_autouid_and_PREFIX/create_requirement_generate_autouid_when_requirement_with_another_prefix_exists/input/document2.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Document 1
3-
REQ_PREFIX: ZEP-
3+
PREFIX: ZEP-
44

55
[REQUIREMENT]
66
UID: ZEP-2

tests/end2end/screens/document/update_document_config/update_document_config_requirement_prefix/expected_output/document.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Document 1
3-
REQ_PREFIX: PREFIX-
3+
PREFIX: PREFIX-
44

55
[REQUIREMENT]
66
TITLE: Requirement title

tests/integration/features/commands/bypass/03_basic_document_test/input.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ UID: DOC-1
44
VERSION: 1
55
DATE: 2025-01-14
66
CLASSIFICATION: TESTING
7-
REQ_PREFIX: REQ-
7+
PREFIX: REQ-
88
ROOT: True

tests/integration/features/commands/manage/auto-uid/requirement_uids/03_requirement_prefix_document_level/input.expected.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Hello world doc
3-
REQ_PREFIX: DOC-
3+
PREFIX: DOC-
44

55
[REQUIREMENT]
66
UID: DOC-1

tests/integration/features/commands/manage/auto-uid/requirement_uids/03_requirement_prefix_document_level/input.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Hello world doc
3-
REQ_PREFIX: DOC-
3+
PREFIX: DOC-
44

55
[REQUIREMENT]
66
UID: DOC-1

tests/integration/features/commands/manage/auto-uid/requirement_uids/04_requirement_prefix_section_level/input.expected.sdoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[DOCUMENT]
22
TITLE: Hello world doc
3-
REQ_PREFIX: DOC-
3+
PREFIX: DOC-
44

55
[SECTION]
66
TITLE: Section 1
7-
REQ_PREFIX: LEVEL1-REQ-
7+
PREFIX: LEVEL1-REQ-
88

99
[REQUIREMENT]
1010
UID: LEVEL1-REQ-1
@@ -18,7 +18,7 @@ STATEMENT: System shall do L1-1.
1818

1919
[SECTION]
2020
TITLE: Section 2
21-
REQ_PREFIX: LEVEL2-REQ-
21+
PREFIX: LEVEL2-REQ-
2222

2323
[REQUIREMENT]
2424
UID: LEVEL2-REQ-2

tests/integration/features/commands/manage/auto-uid/requirement_uids/04_requirement_prefix_section_level/input.sdoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[DOCUMENT]
22
TITLE: Hello world doc
3-
REQ_PREFIX: DOC-
3+
PREFIX: DOC-
44

55
[SECTION]
66
TITLE: Section 1
7-
REQ_PREFIX: LEVEL1-REQ-
7+
PREFIX: LEVEL1-REQ-
88

99
[REQUIREMENT]
1010
UID: LEVEL1-REQ-1
@@ -17,7 +17,7 @@ STATEMENT: System shall do L1-1.
1717

1818
[SECTION]
1919
TITLE: Section 2
20-
REQ_PREFIX: LEVEL2-REQ-
20+
PREFIX: LEVEL2-REQ-
2121

2222
[REQUIREMENT]
2323
STATEMENT: System shall do L2-1.

tests/integration/features/commands/manage/auto-uid/requirement_uids/05_requirement_prefix_grammar_element_level/input.expected.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Hello world doc
3-
REQ_PREFIX: DOC-
3+
PREFIX: DOC-
44

55
[GRAMMAR]
66
ELEMENTS:

tests/integration/features/commands/manage/auto-uid/requirement_uids/05_requirement_prefix_grammar_element_level/input.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Hello world doc
3-
REQ_PREFIX: DOC-
3+
PREFIX: DOC-
44

55
[GRAMMAR]
66
ELEMENTS:

tests/integration/features/commands/manage/auto-uid/requirement_uids/08_works_across_documents_custom_prefix/input1.expected.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Hello world doc 1
3-
REQ_PREFIX: ZEP-
3+
PREFIX: ZEP-
44

55
[REQUIREMENT]
66
UID: ZEP-1

tests/integration/features/commands/manage/auto-uid/requirement_uids/08_works_across_documents_custom_prefix/input1.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Hello world doc 1
3-
REQ_PREFIX: ZEP-
3+
PREFIX: ZEP-
44

55
[REQUIREMENT]
66
STATEMENT: System 1 shall do 1.

tests/integration/features/commands/manage/auto-uid/requirement_uids/08_works_across_documents_custom_prefix/input2.expected.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Hello world doc 2
3-
REQ_PREFIX: ZEP-
3+
PREFIX: ZEP-
44

55
[REQUIREMENT]
66
UID: ZEP-4

tests/integration/features/commands/manage/auto-uid/requirement_uids/08_works_across_documents_custom_prefix/input2.sdoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DOCUMENT]
22
TITLE: Hello world doc 2
3-
REQ_PREFIX: ZEP-
3+
PREFIX: ZEP-
44

55
[REQUIREMENT]
66
STATEMENT: System 2 shall do 1.

tests/unit/strictdoc/backend/sdoc/test_dsl_passthrough.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def test_073_document_config_requirement_prefix(default_project_config):
534534
TITLE: Test Doc
535535
UID: SDOC-01
536536
VERSION: 0.0.1
537-
REQ_PREFIX: DOC-
537+
PREFIX: DOC-
538538
539539
[REQUIREMENT]
540540
STATEMENT: ...

0 commit comments

Comments
 (0)