You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1862,93 +1862,6 @@ This section contains an anchor named ``Anchor ABC``.
1862
1862
1863
1863
.. _ANCHOR-EXAMPLE:
1864
1864
1865
-
.. _SECTION-UG-Search-and-filtering:
1866
-
1867
-
Search and filtering
1868
-
====================
1869
-
1870
-
.. list-table::
1871
-
:align: left
1872
-
:header-rows: 0
1873
-
1874
-
* - **MID:**
1875
-
- de584af947a445e5bcc782bab6a93baf
1876
-
1877
-
StrictDoc supports search and filtering of document content. However, this feature has not been extensively tested and is hidden behind a feature flag. To activate it, enable the corresponding setting in the ``strictdoc.toml`` configuration file:
1878
-
1879
-
.. code-block::
1880
-
1881
-
[project]
1882
-
1883
-
features = [
1884
-
"SEARCH"
1885
-
]
1886
-
1887
-
The web interface includes the Search screen, designed for conducting queries against a document tree. The command-line interface supports filtering of requirements and sections through the ``export`` commands.
1888
-
1889
-
Query engine
1890
-
------------
1891
-
1892
-
.. list-table::
1893
-
:align: left
1894
-
:header-rows: 0
1895
-
1896
-
* - **MID:**
1897
-
- 29ffc3e91d8045589b0837f647286128
1898
-
1899
-
The syntax of the search query is inspired by Python, utilizing a fixed grammar that converts search queries into corresponding Python expressions.
1900
-
1901
-
Important rules:
1902
-
1903
-
- Every query component shall start with ``node.``.
1904
-
- ``and`` and ``or`` expressions must be grouped using round brackets.
1905
-
- Only double quotes are accepted for strings.
1906
-
1907
-
.. list-table:: Query examples
1908
-
:widths: 50 50
1909
-
:header-rows: 1
1910
-
1911
-
* - **Query**
1912
-
- **Description**
1913
-
1914
-
* - ``node.is_requirement``
1915
-
- Find all requirements.
1916
-
1917
-
* - ``node.is_section``
1918
-
- Find all sections.
1919
-
1920
-
* - ``node.is_root``
1921
-
- Find all requirements or sections from documents with ``ROOT: True``. See :ref:`Document <SECTION-UG-Document>` for the description of the ``ROOT`` option.
1922
-
1923
-
* - ``(node.is_requirement and "System" in node["TITLE"])``
1924
-
- Find all requirements with a TITLE that equals to "System".
1925
-
1926
-
* - ``(node.is_requirement and node.has_parent_requirements)``
1927
-
- Find all requirements which have parent requirements.
1928
-
1929
-
* - ``(node.is_requirement and node.has_child_requirements)``
1930
-
- Find all requirements which have child requirements.
1931
-
1932
-
Filtering content
1933
-
-----------------
1934
-
1935
-
.. list-table::
1936
-
:align: left
1937
-
:header-rows: 0
1938
-
1939
-
* - **MID:**
1940
-
- d52d86750ad54ce1b3263ebb092451c0
1941
-
1942
-
Both ``export`` command-line interface commands support filtering documentation content with ``--filter-requirements`` and ``--filter-sections`` options.
1943
-
1944
-
Both options are based on the Query Engine, so the same rules that are valid for Search also apply for filtering. When a filter is applied, only the whitelisted requirements/sections will be exported.
1945
-
1946
-
Example:
1947
-
1948
-
.. code-block::
1949
-
1950
-
strictdoc export . --filter-requirements '"System" in node["TITLE"]'
1951
-
1952
1865
Markup
1953
1866
======
1954
1867
@@ -2225,8 +2138,6 @@ Traceability between requirements and source code
2225
2138
* - **MID:**
2226
2139
- 4398b17f61ad4dd290e72d7888597f48
2227
2140
2228
-
**Note:** This feature is experimental, the documentation is incomplete.
2229
-
2230
2141
StrictDoc allows connecting requirements to source code files in two ways:
2231
2142
2232
2143
1. Linking source files to requirements by adding special markers in the source code without modifying the requirements.
@@ -2284,7 +2195,7 @@ To activate language-aware traceability, configure the project with the followin
2284
2195
"SOURCE_FILE_LANGUAGE_PARSERS"
2285
2196
]
2286
2197
2287
-
Currently, only Python and C parsers are implemented. Upcoming implementations include parsers for Rust, C++, Bash, and more.
2198
+
Currently, only Python and C/C++ parsers are implemented. Upcoming implementations include parsers for Rust, Bash, and more.
2288
2199
2289
2200
Linking source code to requirements
2290
2201
-----------------------------------
@@ -2296,7 +2207,7 @@ Linking source code to requirements
2296
2207
* - **MID:**
2297
2208
- c787c538cc0a422fb2898b525ec1006d
2298
2209
2299
-
To connect a source file to a requirement, a dedicated ``@relation`` marker must be added to the source file. Several marker types are supported, depending on the programming language. For example, the ``scope=class`` option is available for Python files but not for C files, as C does not support classes.
2210
+
To connect a source file to a requirement, a dedicated ``@relation`` marker must be added to the source file. Several marker types are supported, depending on the programming language. For example, the ``scope=class`` option is available for Python files but not for C files, as C does not support classes. The marker supports both () and {} for arguments.
2300
2211
2301
2212
.. note::
2302
2213
@@ -2306,6 +2217,8 @@ To connect a source file to a requirement, a dedicated ``@relation`` marker must
2306
2217
2307
2218
The legacy ``@sdoc`` marker is still supported by StrictDoc but is deprecated. ``@relation`` is the new correct marker name.
2308
2219
2220
+
It is also possible to use @relation markers and be compatible with Doxygen. See :ref:`Doxygen <SECTION-UG-Doxygen>`.
2221
+
2309
2222
**1\) Linking a file to a requirement**
2310
2223
2311
2224
The marker must be added to the top comment of a file.
@@ -2329,7 +2242,7 @@ The marker must be added to the top comment of a file.
2329
2242
@relation(REQ-1, scope=class)
2330
2243
"""
2331
2244
2332
-
**3\) Linking a function to a requirement (Pythonand C only)**
2245
+
**3\) Linking a function to a requirement (Python, C, and C++ only)**
2333
2246
2334
2247
.. code:: python
2335
2248
@@ -2354,6 +2267,10 @@ or
2354
2267
print("Hello, World\n");
2355
2268
}
2356
2269
2270
+
.. note::
2271
+
2272
+
For the C and C++ languages, if a ``@relation`` marker is included in a function declaration prototype (which is the most common practice), StrictDoc also creates a link between the requirement and the corresponding C function definition.
2273
+
2357
2274
**4\) Linking a range to a requirement**
2358
2275
2359
2276
.. code:: python
@@ -3061,6 +2978,72 @@ The following is a list of features that are considered less portable when it co
3061
2978
3062
2979
It is easier to extend StrictDoc to produce a format supported by a given tool than it is to make the other tool export a 100%-identical content back to StrictDoc. If there is a need to interface with a tool X and something is missing in StrictDoc, please reach out to the developers (see :ref:`Contact the developers <SDOC_UG_CONTACT>`).
3063
2980
2981
+
Interoperability with other tools
2982
+
=================================
2983
+
2984
+
.. _SECTION-UG-Doxygen:
2985
+
2986
+
Doxygen
2987
+
-------
2988
+
2989
+
.. list-table::
2990
+
:align: left
2991
+
:header-rows: 0
2992
+
2993
+
* - **MID:**
2994
+
- a8664547ac7e41399d7d8d263869abc6
2995
+
2996
+
HTML documentation generated by StrictDoc can be integrated with Doxygen documentation.
2997
+
2998
+
Doxygen includes a ``TAGFILE`` feature that allows linking to external documentation. This tagfile is in XML format and looks like this:
StrictDoc automatically generates a Doxygen tagfile containing the requirements using the export command:
3011
+
3012
+
.. code::
3013
+
3014
+
strictdoc export . --formats=html,doxygen
3015
+
3016
+
When a requirement is referenced in a source code comment block with the command ``\ref REQ-1``, Doxygen includes a link to the corresponding ``<filename/>`` in the output.
3017
+
3018
+
The location of the StrictDoc export can be specified in the TAGFILE field, either as a relative path, e.g., ``TAGFILES = strictdoc.tag=../../strictdoc``, or as an absolute URL, e.g., ``TAGFILES = strictdoc.tag=http://example.com/strictdoc``.
3019
+
3020
+
To make the StrictDoc @relation keyword work with Doxygen, an alias has to be created:
3021
+
3022
+
.. code::
3023
+
3024
+
ALIASES += relation{2}="\ref \1"
3025
+
3026
+
resulting in the following syntax to be recognized by Doxygen: ``@relation{REQ-1, scope=function}``.
3027
+
3028
+
Relevant Doxygen documentation:
3029
+
3030
+
- `Linking to external documentation <https://www.doxygen.nl/manual/external.html>`_
Valispace provides a Python API, including an example script for exporting all project requirements in JSON format. See `Examples: Get a complete project requirements tree <https://github.com/valispace/ValispacePythonAPI/pull/22>`_.
3044
+
3045
+
The ``GetAllProjectRequirementsTree.py`` script can be used to create a converter that generates SDoc text files customized to the specifics of the project.
3046
+
3064
3047
.. _SDOC_UG_EXPERIMENTAL_FEATURES:
3065
3048
3066
3049
Experimental features
@@ -3079,6 +3062,93 @@ A feature is considered stable when all its known edge cases have been covered a
3079
3062
3080
3063
See also :ref:`Selecting features <SDOC_UG_CONFIG_FEATURES>` for general instructions.
3081
3064
3065
+
.. _SECTION-UG-Search-and-filtering:
3066
+
3067
+
Search and filtering
3068
+
--------------------
3069
+
3070
+
.. list-table::
3071
+
:align: left
3072
+
:header-rows: 0
3073
+
3074
+
* - **MID:**
3075
+
- de584af947a445e5bcc782bab6a93baf
3076
+
3077
+
StrictDoc supports search and filtering of document content. However, this feature has not been extensively tested and is hidden behind a feature flag. To activate it, enable the corresponding setting in the ``strictdoc.toml`` configuration file:
3078
+
3079
+
.. code-block::
3080
+
3081
+
[project]
3082
+
3083
+
features = [
3084
+
"SEARCH"
3085
+
]
3086
+
3087
+
The web interface includes the Search screen, designed for conducting queries against a document tree. The command-line interface supports filtering of requirements and sections through the ``export`` commands.
3088
+
3089
+
Query engine
3090
+
~~~~~~~~~~~~
3091
+
3092
+
.. list-table::
3093
+
:align: left
3094
+
:header-rows: 0
3095
+
3096
+
* - **MID:**
3097
+
- 29ffc3e91d8045589b0837f647286128
3098
+
3099
+
The syntax of the search query is inspired by Python, utilizing a fixed grammar that converts search queries into corresponding Python expressions.
3100
+
3101
+
Important rules:
3102
+
3103
+
- Every query component shall start with ``node.``.
3104
+
- ``and`` and ``or`` expressions must be grouped using round brackets.
3105
+
- Only double quotes are accepted for strings.
3106
+
3107
+
.. list-table:: Query examples
3108
+
:widths: 50 50
3109
+
:header-rows: 1
3110
+
3111
+
* - **Query**
3112
+
- **Description**
3113
+
3114
+
* - ``node.is_requirement``
3115
+
- Find all requirements.
3116
+
3117
+
* - ``node.is_section``
3118
+
- Find all sections.
3119
+
3120
+
* - ``node.is_root``
3121
+
- Find all requirements or sections from documents with ``ROOT: True``. See :ref:`Document <SECTION-UG-Document>` for the description of the ``ROOT`` option.
3122
+
3123
+
* - ``(node.is_requirement and "System" in node["TITLE"])``
3124
+
- Find all requirements with a TITLE that equals to "System".
3125
+
3126
+
* - ``(node.is_requirement and node.has_parent_requirements)``
3127
+
- Find all requirements which have parent requirements.
3128
+
3129
+
* - ``(node.is_requirement and node.has_child_requirements)``
3130
+
- Find all requirements which have child requirements.
3131
+
3132
+
Filtering content
3133
+
~~~~~~~~~~~~~~~~~
3134
+
3135
+
.. list-table::
3136
+
:align: left
3137
+
:header-rows: 0
3138
+
3139
+
* - **MID:**
3140
+
- d52d86750ad54ce1b3263ebb092451c0
3141
+
3142
+
Both ``export`` command-line interface commands support filtering documentation content with ``--filter-requirements`` and ``--filter-sections`` options.
3143
+
3144
+
Both options are based on the Query Engine, so the same rules that are valid for Search also apply for filtering. When a filter is applied, only the whitelisted requirements/sections will be exported.
3145
+
3146
+
Example:
3147
+
3148
+
.. code-block::
3149
+
3150
+
strictdoc export . --filter-requirements '"System" in node["TITLE"]'
Copy file name to clipboardExpand all lines: docs/sphinx/source/strictdoc_04_release_notes.rst
+33-1Lines changed: 33 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,39 @@ $$$$$$$$$$$$$
8
8
* - **MID:**
9
9
- 0dd2649ec4784c9480eac6f4aef3158b
10
10
11
-
This document maintains a record of all changes to StrictDoc since November 2023. It serves as a user-friendly version of the changelog, complementing the automatically generated, commit-by-commit changelog available here: `StrictDoc Changelog <https://github.com/strictdoc-project/strictdoc/blob/main/CHANGELOG.md>`_.
11
+
This document maintains a record of all changes to StrictDoc since November 2023. It serves as a user-friendly version of the changelog, complementing the automatically generated, commit-by-commit changelog available as GitHub releases: `StrictDoc Releases <https://github.com/strictdoc-project/strictdoc/releases>`_.
12
+
13
+
Unreleased (2024-11-XX)
14
+
=======================
15
+
16
+
.. list-table::
17
+
:align: left
18
+
:header-rows: 0
19
+
20
+
* - **MID:**
21
+
- f4e63483a11b442993c47b5d0574e89b
22
+
23
+
This release introduces language-aware tracing between requirements and C++ source code.
24
+
25
+
Currently, only C++ functions can be traced using a marker like ``@relation(REQ-1, scope=function)``. The ability to add markers to classes has not yet been implemented.
26
+
27
+
A new export format has been added to generate a Doxygen tagfile for a documentation tree. When the tagfile is registered in the Doxygen configuration, requirements can be referenced using Doxygen keywords. For example: ``\relation{REQ-1, scope=function}``. Special thanks to @johanenglund for contributing the idea and helping to implement the solution.
28
+
29
+
Additionally, a minor HTML2PDF formatting issue has been resolved. Previously, RST admonitions were not rendered correctly when spanning across two pages.
30
+
31
+
0.3.0 (2024-11-21)
32
+
==================
33
+
34
+
.. list-table::
35
+
:align: left
36
+
:header-rows: 0
37
+
38
+
* - **MID:**
39
+
- b39a3b3d9f8640e380dad5a2fdb75d79
40
+
41
+
This release includes an enhancement to the feature for tracing requirements to C source code.
42
+
43
+
From now on, if a ``@relation`` marker is specified in a C function declaration, StrictDoc will perform its "magic" and automatically connect the referenced requirement to the corresponding C function definition. This allows a ``@relation`` marker to be placed in the main documentation block, typically located above C function declarations, while ensuring the requirement is also linked to the function definition.
Copy file name to clipboardExpand all lines: docs/sphinx/source/strictdoc_11_developer_guide.rst
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,16 +143,18 @@ Python code
143
143
raised when it is consistently deprecated by major software platforms like
144
144
Ubuntu or GitHub Actions.
145
145
146
-
- All developer tasks are collected in the ``tasks.py`` which is run by Invoke
147
-
tool. Run the ``invoke --list`` command to see the list of available commands.
146
+
- All developer tasks are collected in the ``tasks.py`` which is run by Invoke tool. Run the ``invoke --list`` command to see the list of available commands.
148
147
149
148
- Formatting is governed by ``black`` which reformats the code automatically
150
149
when the ``invoke check`` command is run.
151
150
152
151
- If a string literal gets too long, it should be split into a multiline
153
152
literal with each line being a meaningful word or a subsentence.
154
153
155
-
- For "element is non-None" checks, a full form shall be used, for example: ``if foo is not None`` instead of ``if foo``. This helps to avoid any confusion with all sorts of strings (empty or non-empty ``str``, ``Optional[str]``) that are used extensively in StrictDoc's codebase. The non-None and non-empty string check shall therefore be as follows: ``if foo is not None and len(foo) > 0``. The explicit check also applies to any other kinds of objects besides strings: ``if foo is not None`` instead of ``if foo``. Rationale: ``if foo`` makes it unclear whether the intention is to check `is not None` or also ``len(foo) > 0``.
154
+
- Avoid shortening variable names unnecessarily. For example, use 'buffer' instead of 'buf', 'document' instead of 'doc', 'function' instead of 'func', 'length' instead of 'len', etc. Note: While some older parts of StrictDoc may not adhere to this guideline, they are planned to be refactored in the future.
155
+
156
+
- For "element is non-None" checks, a full form shall be used, for example: ``if foo is not None`` instead of ``if foo``. This helps to avoid any confusion with all sorts of strings (empty or non-empty ``str``, ``Optional[str]``) that are used extensively in StrictDoc's codebase. The non-None and non-empty string check shall therefore be as follows: ``if foo is not None and len(foo) > 0``. The explicit check also applies to any other kinds of objects besides strings: ``if foo is not None`` instead of ``if foo``. Rationale: ``if foo`` makes it unclear whether the intention is to check ``is not None`` or also ``len(foo) > 0``.
157
+
156
158
- For lambdas and short for loops, the recent convention is to add ``_`` to the variables of a for loop or a lambda to visually highlight their temporary use within the current scope which is done to counter the fact that these variables can leak and be used outside of the scope of the loop. Example:
157
159
158
160
.. code-block:: python
@@ -161,7 +163,9 @@ Python code
161
163
# use a_, b_ within the loop.
162
164
163
165
- The function arguments with the default values shall be avoided. This convention improves the visibility of the function interfaces at the coast of increased verbosity which is the price that StrictDoc development is willing to pay, maintaining the software long-term. The all-explicit function parameters indication is especially useful when the large code refactorings are made.
166
+
164
167
- StrictDoc has been making a gradual shift towards a stronger type system. Although type annotations haven't been added everywhere in the codebase, it is preferred to include them for all new code that is written.
168
+
165
169
- If a contribution includes changes in StrictDoc's code, at least the
166
170
integration-level tests should be added to the ``tests/integration``. If the
167
171
contributed code needs a fine-grained control over the added behavior, adding
0 commit comments