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
- The documentation files are stored as human-readable text files.
14
14
- A simple domain-specific language DSL is used for writing the documents. The
15
15
text format for encoding this language is called SDoc (strict-doc).
16
-
- StrictDoc reads ``*.sdoc`` files and builds an in-memory representation of a
16
+
- StrictDoc reads \*.sdoc files and builds an in-memory representation of a
17
17
document tree.
18
18
- From this in-memory representation, StrictDoc can generate the documentation
19
19
into a number of formats including HTML, RST, ReqIF, PDF, JSON, Excel.
@@ -28,9 +28,9 @@ Summary of StrictDoc features:
28
28
- Requirements to source files traceability (experimental). See
29
29
:ref:`Traceability between requirements and source code <SECTION-TRACEABILITY-REQS-TO-SOURCE-CODE>`.
30
30
- Custom grammar and custom fields support. The StrictDoc's grammar can be
31
-
extended to support arbitrary special fields, such as ``PRIORITY``, ``OWNER``,
31
+
extended to support arbitrary special fields, such as "PRIORITY", "OWNER",
32
32
or even more specialized fields, such as
33
-
``Automotive Safety Integrity Level (ASIL)`` or ``Verification method``.
33
+
"Automotive Safety Integrity Level (ASIL)" or "Verification method".
34
34
See :ref:`Custom grammars <SECTION-CUSTOM-GRAMMARS>`.
35
35
- Good performance of the `textX <https://github.com/textX/textX>`_
36
36
parser and parallelized incremental generation of documents: generation of
@@ -1722,10 +1722,142 @@ Traceability between requirements and source code
1722
1722
1723
1723
**Note:** This feature is experimental, the documentation is incomplete.
1724
1724
1725
-
StrictDoc allows connecting requirements to source code files. Two types of
1726
-
links are supported:
1725
+
StrictDoc allows connecting requirements to source code files in two ways:
1727
1726
1728
-
1\) A basic link where a requirement links to a whole file.
1727
+
1. Linking source files to requirements by adding special markers in the source code without modifying the requirements.
1728
+
2. Linking requirements to source files by adding relations in the requirements without altering the source code.
1729
+
1730
+
The advantage of the first approach is that requirements remain agnostic to the source code and implementation details. Special markers are added solely to the source files, creating traceability back to the requirements.
1731
+
1732
+
The benefit of the second approach is that traceability to source files is established without any modification to the source code. This can be useful in projects where adding markers to the source code is undesirable or not feasible.
1733
+
1734
+
Both options can be used independently or in combination, depending on the project setup and allocation of software components.
1735
+
1736
+
To activate the traceability to source files, configure the project config with a dedicated feature:
1737
+
1738
+
.. code-block:: yaml
1739
+
1740
+
[project]
1741
+
1742
+
features = [
1743
+
"REQUIREMENT_TO_SOURCE_TRACEABILITY"
1744
+
]
1745
+
1746
+
By default, StrictDoc looks for source files in a directory from which the ``strictdoc`` command is run. This can be changed by using the ``source_root_path`` project-level option.
1747
+
1748
+
See :ref:`Project-level options <SDOC_UG_OPTIONS_PROJECT_LEVEL>` for more details about the project-level options.
For parsing source code and calculating traceability to requirements, StrictDoc uses a general parser that is agnostic of specific programming languages and their constructs, such as classes or functions. However, for languages with these constructs, establishing traceability to them can simplify the tracing process.
1761
+
1762
+
As an experimental option, StrictDoc supports parsing source files of selected programming languages (currently Python and C) to recognize language syntax, primarily enabling traceability of functions (in Python, C, and others) and classes (in Python, C++, and others) to requirements.
1763
+
1764
+
To activate language-aware traceability, configure the project with the following features:
1765
+
1766
+
.. code:: toml
1767
+
1768
+
[project]
1769
+
1770
+
features = [
1771
+
"REQUIREMENT_TO_SOURCE_TRACEABILITY",
1772
+
"SOURCE_FILE_LANGUAGE_PARSERS"
1773
+
]
1774
+
1775
+
Currently, only Python and C parsers are implemented. Upcoming implementations include parsers for Rust, C++, Bash, and more.
1776
+
1777
+
Linking source code to requirements
1778
+
-----------------------------------
1779
+
1780
+
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.
1781
+
1782
+
.. note::
1783
+
1784
+
For language-specific parsing of source code, e.g., Python and C, make sure to enable the corresponding option, see :ref:`Language-aware parsing of source code <SECTION-UG-Language-aware-parsing-of-source-code>`.
1785
+
1786
+
**1\) Linking a file to a requirement**
1787
+
1788
+
The marker must be added to the top comment of a file. Currently supported only in Python.
1789
+
1790
+
.. code:: python
1791
+
1792
+
"""
1793
+
This file implements ...
1794
+
1795
+
@relation(REQ-1, scope=file)
1796
+
"""
1797
+
1798
+
**2\) Linking a class to a requirement (Python only)**
1799
+
1800
+
.. code:: python
1801
+
1802
+
classFoo:
1803
+
"""
1804
+
This class implements ...
1805
+
1806
+
@relation(REQ-1, scope=file)
1807
+
"""
1808
+
1809
+
**3\) Linking a function to a requirement (Python and C only)**
1810
+
1811
+
.. code:: python
1812
+
1813
+
classFoo:
1814
+
defbar(self):
1815
+
"""
1816
+
This function implements ...
1817
+
1818
+
@relation(REQ-1, scope=function)
1819
+
"""
1820
+
1821
+
or
1822
+
1823
+
.. code:: c
1824
+
1825
+
/**
1826
+
* Some text.
1827
+
*
1828
+
* @relation(REQ-1, scope=function)
1829
+
*/
1830
+
void hello_world(void) {
1831
+
print("Hello, World\n");
1832
+
}
1833
+
1834
+
**4\) Linking a range to a requirement**
1835
+
1836
+
.. code:: python
1837
+
1838
+
deffoo():
1839
+
# @relation(REQ-1, scope=range_start)
1840
+
print("Hello, World!")
1841
+
# @relation(REQ-1, scope=range_end)
1842
+
1843
+
**5\) Linking a single line to a requirement**
1844
+
1845
+
.. code:: python
1846
+
1847
+
deffoo():
1848
+
# @relation(REQ-1, scope=line)
1849
+
print("Hello, World!")
1850
+
1851
+
Linking requirements to source code
1852
+
-----------------------------------
1853
+
1854
+
The linking of requirements to source files is arranged with a special RELATION type ``File``.
1855
+
1856
+
.. note::
1857
+
1858
+
For language-specific parsing of source code, e.g., Python and C, make sure to enable the corresponding option, see :ref:`Language-aware parsing of source code <SECTION-UG-Language-aware-parsing-of-source-code>`.
1859
+
1860
+
**1\) Linking a requirement to a whole source file**
1729
1861
1730
1862
.. code-block:: text
1731
1863
@@ -1737,53 +1869,51 @@ links are supported:
1737
1869
TITLE: File reference
1738
1870
STATEMENT: This requirement references the file.
1739
1871
1740
-
2\) A range-based link where a requirement links to a file and
1741
-
additionally in the file, there is a reverse link that connects a source range
1742
-
back to the requirement:
1743
-
1744
-
The requirement declaration contains a reference of the type ``File``:
1872
+
**2\) Linking a requirement to range in a source file**
1745
1873
1746
1874
.. code-block:: text
1747
1875
1748
1876
[REQUIREMENT]
1749
1877
UID: REQ-002
1878
+
TITLE: Range file reference
1879
+
STATEMENT: This requirement references the file.py file.
1750
1880
RELATIONS:
1751
1881
- TYPE: File
1752
1882
VALUE: file.py
1753
-
TITLE: Range file reference
1754
-
STATEMENT: This requirement references the file.py file.
1755
-
COMMENT: >>>
1756
-
If the file.py contains a source range that is connected back to this
1757
-
requirement (REQ-002), the link becomes a link to the source range.
1758
-
<<<
1759
-
1760
-
The source file:
1761
-
1762
-
.. code-block:: py
1883
+
LINE_RANGE: 2, 4
1763
1884
1764
-
# @sdoc[REQ-002]
1765
-
defhello_world():
1766
-
print("hello world")
1767
-
# @sdoc[/REQ-002]
1885
+
**3\) Linking a requirement to a function in a source file**
1768
1886
1769
-
To activate the traceability to source files, configure the project config with a dedicated feature:
1887
+
.. code-block:: text
1770
1888
1771
-
.. code-block:: yaml
1889
+
[REQUIREMENT]
1890
+
UID: REQ-002
1891
+
TITLE: Function reference
1892
+
STATEMENT: This requirement references a function in a file.
1893
+
RELATIONS:
1894
+
- TYPE: File
1895
+
VALUE: file.py
1896
+
FUNCTION: hello_world
1897
+
- TYPE: File
1898
+
VALUE: file.c
1899
+
FUNCTION: Foo.hello_world_2
1772
1900
1773
-
[project]
1901
+
.. note::
1774
1902
1775
-
features = [
1776
-
"REQUIREMENT_TO_SOURCE_TRACEABILITY"
1777
-
]
1903
+
For linking to functions in classes, a class name has to be added in a format: ``<class name>.<function name>``. This is currently only supported for Python source files.
1778
1904
1779
-
By default, StrictDoc looks for source files in a directory from which the ``strictdoc`` command is run. This can be changed by using the ``source_root_path`` project-level option.
1905
+
**4\) Linking a requirement to a class in a source file (Python only)**
1780
1906
1781
-
See :ref:`Project-level options <SDOC_UG_OPTIONS_PROJECT_LEVEL>` for more details about the project-level options.
Copy file name to clipboardExpand all lines: docs/sphinx/source/strictdoc_02_faq.rst
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -296,8 +296,6 @@ FRET has an impressive list of
296
296
297
297
FRET's user interface is built with Electron.
298
298
299
-
The detailed comparison is coming.
300
-
301
299
How long has the StrictDoc project been around?
302
300
===============================================
303
301
@@ -330,6 +328,8 @@ The custom RST parser was replaced with a TextX-based DSL. Since then, StrictDoc
330
328
331
329
The FastAPI/Turbo/Stimulus-based Web interface prototype was created to complement the text-based interface with a graphical user interface (GUI). When the Web-based GUI is stable, StrictDoc may become useable by non-programmers too.
332
330
331
+
See also: :ref:`Project milestones <SECTION-DP-Project-milestones>`.
Copy file name to clipboardExpand all lines: docs/sphinx/source/strictdoc_03_development_plan.rst
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ An important feature of StrictDoc is its focus on open data, ensuring ease of da
29
29
30
30
StrictDoc shall be compatible with other software and engineering tools. This includes at least the compatibility with the Python ecosystem, the model-based systems engineering tools, such as Capella, and the formats providing Software Bill of Materials, such as SPDX.
31
31
32
+
.. _SECTION-DP-Project-milestones:
33
+
32
34
Project milestones
33
35
==================
34
36
@@ -84,7 +86,7 @@ As an open-source project, StrictDoc is developed without strict deadlines, howe
84
86
* - 2024-Q3
85
87
- HTML2PDF improvements. ReqIF roundtrip for RELATION/ROLE. Consistent automatic escaping of Jinja templates. Passthrough->export command migration.
86
88
* - 2024-Q4
87
-
- TBD
89
+
- Connecting requirements to functions (C, Python) and classes (Python) in source code. Support the linking in both directions independently: from requirements to source using RELATION/File and from source to requirements using @relation markers.
Copy file name to clipboardExpand all lines: docs/sphinx/source/strictdoc_04_release_notes.rst
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,17 @@ $$$$$$$$$$$$$
3
3
4
4
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>`_.
5
5
6
+
Unreleased 0.1.0 (2024-11-01)
7
+
=============================
8
+
9
+
This backward-compatible release introduces several new features for tracing requirements to source files:
10
+
11
+
- StrictDoc now integrates with `Tree-sitter <https://tree-sitter.github.io/tree-sitter/>`_, enabling it to parse multiple programming languages. Using AST information, it achieves more precise tracing of requirements to source code.
12
+
- Language-specific parsers for Python and C have been added, allowing functions (in C and Python) or classes (in Python) to be linked to requirements.
13
+
- Both forward linking of requirements to source files and backward linking of source files to requirements are supported. These features can be used independently or together within the same project.
14
+
15
+
With this release, we are also transitioning to a more `semantic versioning <https://semver.org>`_-oriented release scheme. From now on, the MAJOR.MINOR.PATCH version components will be maintained according to the recommendations of the semantic versioning specification.
Copy file name to clipboardExpand all lines: docs/sphinx/source/strictdoc_10_contributing.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ following steps:
22
22
single contribution.
23
23
4. If the contribution is not trivial, read through the complete development
24
24
guide.
25
+
5. If the contribution is not trivial, please update the Release Notes with a high-level summary of your contribution. Refer to the release notes from previous releases for guidance on what information is desirable.
0 commit comments