Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: List of DOCUMENT grammar elements does not specify where REQ_PREFIX belongs #1670

Closed
KlfJoat opened this issue Feb 27, 2024 · 1 comment · Fixed by #1672
Closed

Comments

@KlfJoat
Copy link

KlfJoat commented Feb 27, 2024

The StrictDoc grammar is positional. While that is kind of limiting, it's generally okay because the documentation makes it clear what elements go in which order.

But that's not the case for REQ_PREFIX, as I found out when I tried using it at the DOCUMENT level.

In the list of DOCUMENT grammar elements, REQ_PREFIX is not listed. So it's unclear where it goes in the order.

The following ``DOCUMENT`` fields are allowed:
.. list-table:: SDoc grammar ``DOCUMENT`` fields
:widths: 20 80
:header-rows: 1
* - **Field**
- **Description**
* - ``TITLE``
- Title of the document (mandatory)
* - ``UID``
- Unique identifier of the document
* - ``VERSION``
- Current version of the document
* - ``CLASSIFICATION``
- Security classification of the document, e.g. Public, Internal,
Restricted, Confidential
* - ``ROOT``
- Defines whether a document is a root object in a traceability graph. A root document is assumed to not have any parent requirements. The project statistics calculation will skip all root document's requirements when calculating the metric ``Non-root-level requirements not connected to any parent requirement``.
* - ``OPTIONS``
- Document configuration options

In the only 2 mentions of REQ_PREFIX in the documentation, it is shown as ordered immediately after the TITLE element of both the DOCUMENT section and SECTION... section.

.. code-block::
[DOCUMENT]
TITLE: Hello world doc
REQ_PREFIX: MYDOC-
A section-level requirement mask:
.. code-block::
[SECTION]
TITLE: Section 2.
REQ_PREFIX: LEVEL2-REQ-

So I placed it after TITLE for SECTION headings, and it worked. But I got an error when I put it after TITLE for the DOCUMENT heading. The grammar.py file shows that for DOCUMENT headings, it belongs between CLASSIFICATION and ROOT.

DocumentConfig[noskipws]:
('UID: ' uid = /{REGEX_UID}/ '\n')?
('VERSION: ' version = SingleLineString '\n')?
('CLASSIFICATION: ' classification = SingleLineString '\n')?
('REQ_PREFIX: ' requirement_prefix = SingleLineString '\n')?
('ROOT: ' (root = BooleanChoice) '\n')?
('OPTIONS:' '\n'

Sure enough, that solved my problem.

Please update the documentation to match the grammar definition for usability purposes... or don't be quite so strict with element placement and order. (I know, unlikely, but it IS an acceptable resolution to my issue 😄 )

@stanislaw
Copy link
Collaborator

Hi @KlfJoat, thanks for reporting this. There are several issues here:

  • I proposed a nice addition to Arpeggio parser that would guide you to find the fields order much quickly but unfortunately the patch was not accepted due to this case being too specific to StrictDoc: WIP: Optional feature: More verbose failed expression reporting textX/Arpeggio#114. (Arpeggio is a PEG parser behind textX.). If this was implemented, the error message for an incorrectly placed grammar field would show you which options you actually have when doing something incorrectly with the grammar.
  • The requirements order is fixed due to the grammar which fixes the elements order and then the UI writes them in the order as configured.
  • I think there is nothing serious that prevents us from relaxing the order for the document options. It is something that you could do relatively soon. I will give this some more thought and decide whether I do it, right now it seems reasonable.

The documentation fix is on the way: #1672 which should resolve the main topic of your report.

@stanislaw stanislaw added this to the 2024-Q1 milestone Feb 28, 2024
@stanislaw stanislaw added Documentation Improvements or additions to documentation Second roadmap and removed Documentation Improvements or additions to documentation labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants