trlcdoc Configuration Reference
This document explains the trlcdoc project configuration file trlcdoc.yaml
section by section: what every key means, which step uses it, and what changes
in the generated documentation when you set it.
The formal definition is the JSON schema trlcdoc/schema/trlcdoc.schema.json. This document adds the behavior behind the keys.
1. Overview
1.1 Where the file lives
trlcdoc reads the file given with -c/--config. Without this option it
searches trlcdoc.yaml in the current folder and then in each parent folder,
so you can run trlcdoc from any sub folder of the project.
The folder of the configuration file is the project root. Every relative path in the file is resolved against it, independent of the folder you start trlcdoc from. Tests, converters and trace tools also run with the project root as working directory.
Put this line at the top of the file to get completion and validation in editors with YAML language support (e.g. VS Code with the Red Hat YAML extension). The path is relative to the configuration file:
# yaml-language-server: $schema=tools/trlc-doc/trlcdoc/schema/trlcdoc.schema.json
A project without the submodule can reference the published schema instead.
Each release tag Vx.y.z has its own copy, so pick the one that matches the
trlcdoc version you use (the configuration may change incompatibly before 1.0):
# yaml-language-server: $schema=https://nhjschulz.github.io/trlc-doc/schema/V0.7.0/trlcdoc.schema.json
The schema of the current main branch is available without a version:
https://nhjschulz.github.io/trlc-doc/schema/trlcdoc.schema.json.
1.2 Top level anatomy
project: # required - name, author, copyright, repository, logo, favicon
paths: # required - TRLC model folder and output folder
documents: # required - the pages of the site, in table of contents order
tests: # optional - test execution and the link of test results to TRLC test cases
trace: # optional - LOBSTER trace levels and their relations
plantuml: # optional - PlantUML jar or version to download
html: # optional - Sphinx theme, extensions and site customization
No other top level keys are allowed. Unknown keys are reported as errors, which
catches typos like document: instead of documents:.
1.3 Steps and the sections they use
trlcdoc works in steps. They always run in this order, no matter in which order you name them on the command line:
Step |
Uses |
Produces |
|---|---|---|
|
|
Removes the output folder |
|
the whole file |
Nothing, validates the configuration and the table of contents of |
|
|
PlantUML jar, |
|
|
JUnit XML, coverage report, TRLC test results |
|
|
Converted reStructuredText (or Markdown) |
|
|
LOBSTER files and the HTML tracing report |
|
|
The HTML site |
|
|
Nothing, opens |
trlcdoc without arguments runs all: every step except clean and show. It leaves
out tests if there is no tests section and trace if there is no trace
section. convert and html always run plantuml first.
show opens the start page of the built site. Under WSL it uses the Windows
default browser (wslview or explorer.exe), otherwise Python’s webbrowser
module, which the BROWSER environment variable can override. Without a built
site or without a web browser it stops with exit code 2.
Exit codes: 0 success, 1 content findings (failed tests, missing trace
links, a wrong table of contents in html.index), 2 build or configuration
error, 130 interrupted (Ctrl+C).
1.4 Validation
The configuration is checked in two stages before any step runs, including the
check step:
Schema validation: types, required keys, allowed keys per document type, id patterns.
Reference checks that the schema cannot express:
document ids and trace level names are unique,
includeandtrace.levels[].documentrefer to documents of typetrlcortest_results,trace_toandrequiresrefer to defined levels,the converter, translation and render configuration files of the
pytrlcconverteroptions exist,project.logo,project.favicon,html.conf,html.indexandhtml.page_headerfiles exist,the
{page:<id>}placeholders (8.5) name documents,a
test_resultsdocument or atests:coveragesource has atestssection,a
trace_reportdocument has atracesection,paths.outputis neither inside the trlcdoc package nor the project root or one of its parents.
All problems are reported at once, each with the file and line of its entry:
trlcdoc error: trlcdoc.yaml has invalid settings:
trlcdoc.yaml:15: project.logo: file 'doc/images/logo-trlcdoc.pngx' not found.
trlcdoc.yaml:37: documents[sw_architecture].include: 'unknown' is no document of type trlc or test_results.
Editors like Visual Studio Code open the file at this line from the terminal.
An error about a missing key, e.g. 'author' is a required property, points to
the line of the enclosing entry. A repeated document id or level name points to
its second occurrence. A value taken from a YAML alias points to the line of the
alias. A file that is no valid YAML is reported with the line and column of the
syntax error.
Run trlcdoc check after every change of the configuration.
With a project start page (html.index), the check step also compares its
table of contents with the page names of the documents, see
8.3. These are content findings: they are
reported with exit code 1, and the other steps still run.
1.5 A minimal configuration
The smallest useful configuration converts one folder of TRLC requirements into an HTML site:
project:
name: example
author: Jane Doe
copyright: "2026, Jane Doe"
paths:
trlc_model: trlc/model
documents:
- id: sw_requirements
title: SW Requirements
type: trlc
source: trlc/swe-req
pytrlcconverter:
converter:
rst: builtin:req2rst.py
trlcdoc runs check, plantuml, convert and html and writes the site
to build/trlcdoc/html. The following chapters add tests, tracing and site
customization step by step.
2. project
Project metadata for the HTML site and the online tracing report.
project:
name: pyTRLCConverter
version: "3.0.0"
author: NewTec GmbH
copyright: 2024 - 2026, NewTec GmbH
repository: https://github.com/NewTec-GmbH/pyTRLCConverter
logo: doc/images/NewTec_Logo.png
favicon: doc/images/favicon.ico
Key |
Required |
Default |
Meaning and impact |
|---|---|---|---|
|
yes |
Sphinx |
|
|
no |
none |
Sphinx |
|
yes |
Sphinx |
|
|
yes |
Sphinx |
|
|
no |
|
Repository URL. Used by |
|
no |
none |
Image file shown by the theme as site logo (Sphinx |
|
no |
none |
Browser tab icon (Sphinx |
Each page footer also shows the date of the build and, if the project is a git
repository, the output of git describe --tags --always --dirty and the branch,
e.g. Last updated on Nov 23, 2026 from V0.7.0-13-g6e9ca73-dirty on branch develop:
the nearest tag, the number of commits since it, the short commit hash and -dirty
for uncommitted changes of tracked files. Without a tag it shows the short commit
hash, with a detached HEAD (e.g. a tag checkout in CI) no branch. This needs no
configuration.
3. paths
paths:
trlc_model: trlc/model
output: build/trlcdoc
Key |
Required |
Default |
Meaning and impact |
|---|---|---|---|
|
yes |
Folder with the TRLC model files ( |
|
|
no |
|
Folder for everything trlcdoc generates. trlcdoc never writes anywhere else, except for files your own test or document commands write. |
Impact of output: trlcdoc clean deletes this folder completely,
including the downloaded PlantUML jar. Therefore it must not be the project
root or one of its parents, and it must not be inside the trlcdoc package.
Add it to .gitignore. Chapter 9 shows its content.
Command line option -o/--output: replaces paths.output for one run,
without changing the configuration, e.g. for several builds from one checkout
or a CI job that writes outside the repository:
trlcdoc --output build/markdown convert --format markdown
trlcdoc --output "$RUNNER_TEMP/site"
A relative folder is relative to the current folder, not to the project root like the paths in the configuration file.
The same location rules apply, a
paths.outputin the configuration is not used and not checked in this run.Everything listed in chapter 9 moves along, including the downloaded PlantUML jar. A CI cache of the jar must use the new folder.
Files your own test or document commands write (
type: commanddocuments, test result files ofrunner: command) stay where their commands put them.
4. documents
documents is a list of the pages of the HTML site. The list order is the
table of contents order of the generated start page and the order of the
previous/next links.
Each document has a type. The type decides where the content comes from,
which other keys are allowed, and which steps work on it:
|
Content |
Required keys |
Optional keys |
|---|---|---|---|
|
TRLC records converted by pyTRLCConverter |
|
|
|
TRLC records generated from the test results |
|
|
|
The LOBSTER tracing report |
|
|
|
An existing HTML folder, e.g. a coverage report |
|
|
|
An HTML folder generated by an external tool |
|
|
|
A project owned reStructuredText page |
|
|
|
A project owned Markdown page |
|
|
|
A plain text file shown literally |
|
Every document also requires id and type. Keys not listed for a type are
rejected.
4.1 Common keys
Key |
Meaning and impact |
|---|---|
|
Unique key of the document. Lower case letters, digits and |
|
Page heading and table of contents entry. trlcdoc writes it as top level heading above the content, except for |
|
One of the types above. |
Page names: a document is a single page or a folder of pages:
Document |
Page name |
HTML file |
|---|---|---|
|
|
|
|
|
|
|
|
|
all others |
|
|
The folder per TRLC document keeps the converted pages and their diagram images
together, so relative image paths work. This matters when you write your own
start page (8.3) or link to pages from outside.
In project pages, write {page:<id>} instead of the page name
(8.5): trlcdoc inserts the right name, also after a change
of trace.report.
4.2 type: trlc
A folder of .trlc files, converted with a pyTRLCConverter project converter
in the convert step and included into one HTML page in the html step.
- id: sw_architecture
title: SW-Architecture
type: trlc
source: trlc/swe-arch
include: [sw_requirements]
pytrlcconverter:
converter:
rst: builtin:req2rst.py
markdown: builtin:req2markdown.py
translation: builtin:translation.json
render_cfg: tools/converter/renderCfg.json
Key |
Meaning and impact |
|---|---|
|
Folder with the |
|
Ids of other |
|
The options of the pyTRLCConverter run: converter, translation and render configuration, see 4.9. |
|
Optional for this type. Without |
PlantUML diagrams referenced by the records are rendered by the converter
during convert, so this step needs the PlantUML jar (it is provided
automatically).
4.3 type: test_results
The test results of the tests step, converted like a trlc document. It has
no source: the records come from <output>/tests/results, which the tests
step generates (see 5.4).
- id: sw_test_results
title: SW-Test Results
type: test_results
include: [sw_test]
pytrlcconverter:
converter:
rst: builtin:create_test_report_in_rst.py
markdown: builtin:create_test_report_in_markdown.py
Requires a
testssection.includemust name the document with the TRLC test cases, because every result record references its test case.Run the
testsstep beforeconvert.alldoes this;trlcdoc convertalone fails with No test results … run the tests step first on a fresh output folder.Without
title, the heading written by the converter is the page title, as fortrlc.
4.4 type: trace_report
Embeds the LOBSTER HTML tracing report generated by the trace step.
- id: sw_tracing_report
title: Software Tracing Report
type: trace_report
Requires a trace section. Only id, title and type are allowed. Run
trace before html.
By default the report is included as raw HTML into the page, so it gets the
site navigation around it. With trace.report: rst (6) it becomes
a folder of site pages instead: <id>/index with the configured title, the
coverage summary and the tracing policy diagram, and one subpage per trace
level.
4.5 type: html
An existing HTML folder with an index.html. The folder is copied into the
site as <id>/, and the page shows its index.html in an iframe.
- id: coverage_report
title: Coverage Report
type: html
source: tests:coverage
Key |
Meaning and impact |
|---|---|
|
HTML folder, relative to the project root. The special value |
The folder must exist when the html step runs, otherwise it fails with
… index.html not found, generate it first.
4.6 type: command
Like html, but the folder is generated by an external tool, e.g. an API
documentation generator. The command runs at the start of the html step.
- id: api
title: API Reference
type: command
command: [doxygen, doc/Doxyfile]
output: build/doxygen/html
Key |
Meaning and impact |
|---|---|
|
The program and its arguments as a list, without a shell. It runs in the project root. A non-zero exit code stops the build. To use shell features, call the shell explicitly: |
|
The HTML folder the command writes, relative to the project root. It must contain |
4.7 type: rst and type: markdown
A page you write yourself, for content that is not TRLC: a user manual, a detailed design, release notes.
- id: sw_detail_design
type: rst
source: doc/sphinx/sw_detail_design.rst
- id: notes
type: markdown
source: doc/release_notes.md
sourceis the.rstor.mdfile. It is copied into the Sphinx source folder as<id>.rstor<id>.md; Markdown is rendered with MyST.The file is used as is: trlcdoc adds no heading and no page header (8.4), the page shows the first heading of the file.
A configured
titleis the page title in the table of contents, the navigation links and the browser title, e.g.READMEfor aREADME.mdwhose first heading is the project name. Withouttitle, the first heading of the file is used there as well.The file is copied, so relative paths in it would point into the output folder. In Markdown files, relative links and images are resolved against the location of the Markdown file in the project, so a file that renders in the repository renders in the site as well:
Relative target
Becomes
An image
The image, copied into the site.
The
sourceof a document of typetrlc,rst,markdownortextA link to that page. An anchor (
file.md#section) is kept.Any other project file or folder
A link to it in the repository at the commit the site is built from (
<repository>/blob/<commit>/<path>,treefor folders), seeproject.repository. In a project in a subfolder of the repository,<path>starts with the subfolder.Any other project file or folder, without git repository or repository URL
Plain text, with a warning.
A target that does not exist, or lies outside the project
Left to MyST, which warns about it.
In reStructuredText files, use the
{project_root}placeholder for images and includes from the project:.. image:: {project_root}/doc/images/context.svg.placeholders: falsecopies the file without replacing the placeholders, for a page that explains them, like this configuration reference.
4.8 type: text
A plain text file shown literally, e.g. the license.
- id: license
title: License information
type: text
source: LICENSE
4.9 pytrlcconverter: the pyTRLCConverter options
Documents of type trlc and test_results are converted with
pyTRLCConverter. The pytrlcconverter block holds the options of this run.
They apply only to these two types; the other document types do not accept the
block.
pytrlcconverter:
converter:
rst: builtin:req2rst.py
markdown: builtin:req2markdown.py
translation: builtin:translation.json
render_cfg: tools/converter/renderCfg.json
Key |
Required |
pyTRLCConverter option |
Meaning and impact |
|---|---|---|---|
|
yes |
|
Project converter per output format. |
|
no |
|
JSON file mapping attribute names to the names shown in the output, e.g. |
|
no |
|
JSON file declaring the format of attribute values ( |
A render configuration looks like this (see the pyTRLCConverter documentation for all options):
{
"renderCfg": [
{"package": "SwRequirements", "type": "SwReq", "attribute": "description", "format": "md"}
]
}
The values of converter, translation and render_cfg are file references
in one of two forms:
builtin:<file>: a file shipped with trlcdoc in trlcdoc/converters.any other value: a path relative to the project root, for project owned converters.
The built-in files are the project converters of pyTRLCConverter
(tools/converter) for its 3.x API:
File |
Use for |
|---|---|
|
Requirements, constraints and architecture records |
|
Test case records |
|
Test result records ( |
|
Display names of the attributes used by these converters |
|
Renders the |
They expect the record types of the NewTec TRLC model (SwReq,
SwConstraint, SwArchSpec, SwTestCase, SwTestCaseResult, and
Generic.PlantUML for diagrams). If your model differs, copy the converters
into your project, adapt them and reference them by path.
Each converter run looks like this, which helps when a conversion fails:
pyTRLCConverter --source=<source> --include=<trlc_model>
--include=<included source> --exclude=<included source> ...
--out=<output>/convert/<format>/<id> --project=<converter>
[--translation=<file>] [--renderCfg=<file>] <format>
5. tests
Runs the tests, keeps the JUnit XML and coverage report, and converts the results into TRLC records, so they can be shown as a document and traced to the test cases.
tests:
runner: pytest
args: [tests, -v, --cov=src]
link:
property: lobster-trace
from: "test_{name}"
to: "SwTests.tc_{name}"
Key |
Required |
Meaning and impact |
|---|---|---|
|
yes |
|
|
no |
pytest arguments (runner |
|
runner |
The test command (runner |
|
runner |
JUnit XML file the command writes. |
|
no |
HTML coverage folder, if not the default. |
|
yes |
How test results are linked to TRLC test cases. |
A failed test is a content finding: the build continues, the result is shown
as FAILED, and trlcdoc exits with 1.
5.1 runner: pytest
trlcdoc runs pytest with the Python interpreter trlcdoc itself runs in, so install trlcdoc and your project into the same virtual environment:
python -m pytest <args> -o junit_family=xunit1 --junitxml=<output>/tests/junit.xml
[--cov-report=term --cov-report=html:<coverage folder>]
argstypically name the test folder and options like-v.An argument starting with
--covenables the HTML coverage report (pytest-cov must be installed). It is written totests.coverageif set, otherwise to<output>/tests/coverage. Refer to it with a document of typehtmlandsource: tests:coverage.The coverage data file
.coverageis kept in<output>/tests, not in the project root.pytest exit codes 0 (passed) and 1 (tests failed) are accepted; any other code (e.g. usage error, no tests collected) is a build error.
5.2 runner: command
For tests that are not run by pytest, e.g. C unit tests built with CMake. The command must write a JUnit XML file.
tests:
runner: command
command: [bash, tools/run_unit_tests.sh, build/junit.xml]
junit: build/junit.xml
coverage: build/coverage/html
link:
from: "test_{name}"
to: "SwTests.tc_{name}"
commandruns in the project root, without a shell. Its exit code is ignored, because test tools usually report failed tests with a non-zero code; the results are taken from the JUnit file.junitis the JUnit XML file, relative to the project root. trlcdoc deletes it before the command runs. If it is missing after the command, the step fails, so the results of a previous run are never reported as current ones.coverageis the HTML coverage folder the command writes, if any. Itsindex.htmlmust be written by the command, otherwise the step fails.
5.3 link: from test results to test cases
Every executed test must be linked to at least one TRLC test case. trlcdoc tries three ways for each JUnit test case, in this order, and uses the first one that finds a test case:
Property: the JUnit test case has properties named
link.property(defaultlobster-trace). Their values are the qualified test case ids. In pytest a test records them with therecord_propertyfixture:def test_parse_header(record_property): # lobster-trace: SwTests.tc_parse_header record_property("lobster-trace", "SwTests.tc_parse_header") ...
Output: the test writes the test case ids to its output, and
link.outputis the pattern to find them, with an{id}placeholder for the qualified test case id. Every matching output line links one test case; an id written several times is linked once. trlcdoc reads the JUnit<system-out>of the test case and of its test suite:The
<system-out>of a test case (e.g. pytest) belongs to that test.The
<system-out>of a test suite (e.g. Ceedling) holds the output of all its tests. Only lines in the Unity format<file>:<line>:<test>:<level>: <message>are used, the<test>field names the test the line belongs to.
This is the way for C unit tests with Unity and Ceedling, which have no test properties. A macro writes the test case ids with
TEST_MESSAGE:#define LOBSTER_TRACE(_id) TEST_MESSAGE("lobster-trace: " _id) void test_Greeter_morningGreeting(void) { LOBSTER_TRACE("SwTests.tc_greet_morning_time_greeting"); LOBSTER_TRACE("SwTests.tc_greet_user_name"); ... }
Ceedling’s built-in
junitreport writes these lines into the suite output:test/test_Greeter.c:42:test_Greeter_morningGreeting:INFO: lobster-trace: SwTests.tc_greet_user_name
Enable the report in
project.ymland pointtests.junitto it:# project.yml (Ceedling) :plugins: :enabled: - report_tests_log_factory :report_tests_log_factory: :reports: - junit
# trlcdoc.yaml tests: runner: command command: [ceedling, test:all] junit: build/artifacts/test/junit_tests_report.xml link: output: "lobster-trace: {id}" array: true
Write the trace messages at the start of the test: a test that aborts before them has no link.
Name pattern: if the test has neither, its name is matched against
link.from, and the{name}part is inserted intolink.to. Withfrom: "test_{name}"andto: "SwTests.tc_{name}", the testtest_parse_headeris linked toSwTests.tc_parse_header. pytest parametrization is removed first:test_parse_header[v2]is matched astest_parse_header.
Key |
Default |
Meaning and impact |
|---|---|---|
|
|
Name of the JUnit property holding the test case id. |
|
Pattern searched in the test output, must contain |
|
|
Test function name pattern, must contain |
|
|
Qualified test case id pattern |
|
|
|
Write the linked test cases as a list. Needed as soon as one test records more than one test case. |
link needs at least one of property, output, or from and to. The
property is always tried first, with its default name if property is not
set. A link with property only links every test by its property, e.g. for
googletest (see 5.5).
Tests that cannot be linked are a build error that lists them all. Fix them by recording the property, writing the test case id to the output or renaming the test. Skipped tests are left out.
array: a test recording several test cases is an error unless array: true is set. With array, every result record gets a list
(relates = [SwTests.a, SwTests.b]), even for one test case, so the TRLC
model must declare the component as array:
type SwTestCaseResult {
name String
result SwTestResult
relates SwTestCase [1 .. *]
}
Without array, the model uses a single reference: relates SwTestCase.
5.4 The generated test result records
The tests step writes <output>/tests/results/sw_test_result_report.trlc:
package SwTests
section "SW Test Results" {
SwTestCaseResult test_parse_header_result {
name = "test_parse_header"
result = SwTestResult.PASSED
relates = SwTests.tc_parse_header
}
}
The records are written into the package of the linked test cases, here
SwTests. All linked test cases must belong to one package, and every id must
be qualified with its package; otherwise the tests step fails and lists the
tests. Your TRLC model must therefore define, in the package of the test
cases:
enum SwTestResult {
FAILED
PASSED
}
type SwTestCaseResult {
name String
result SwTestResult
relates SwTestCase // or SwTestCase [1 .. *] with link.array
}
The record names are the test names with _result appended (with a number
appended for duplicates). These records are the input of the test_results
document and of a trace level with document: <test_results id>.
5.5 googletest
googletest tests record their TRLC test case with the LOBSTER_TRACE() macro
of LOBSTER’s
lobster_gtest.h.
It stores the id as test property lobster-tracing:
#include "lobster_gtest.h"
TEST(TSGreet, MorningTimeGreeting)
{
LOBSTER_TRACE("SwTests.tc_greet_morning_time_greeting");
...
}
googletest writes the properties into its XML report
(--gtest_output=xml:<file>), which is a JUnit XML file. Use this report, not
the JUnit report of ctest --output-junit: ctest knows only its own tests and
drops the properties.
tests:
runner: command
command: [cmake, -P, tools/run_tests.cmake] # builds and runs the tests
junit: build/test/greet_test.xml
coverage: build/test/coverage
link:
property: lobster-tracing
The C++ example examples/cpp-doxygen-gtest builds and runs its tests with
CMake, traces the test code with lobster-doxygen and creates the coverage
report with gcovr.
6. trace
Defines the LOBSTER trace levels. The trace step extracts the items of each
level, writes the LOBSTER policy from the relations, and creates the HTML
tracing report <output>/trace/tracing_report.html.
trace:
namespace: req
markdown: true
report: html
levels:
- name: SW Requirement
document: sw_requirements
record_type: SwRequirements.SwReq
requires: [SW Test Case, SW Architecture]
- name: SW Architecture
document: sw_architecture
record_type: SwArch.SwArchSpec
tags: [satisfies]
trace_to: [SW Requirement]
Key |
Default |
Meaning and impact |
|---|---|---|
|
|
LOBSTER namespace of all TRLC items. An item is identified as |
|
|
Render the item descriptions of the tracing report as Markdown ( |
|
|
Format of the tracing report in the site. |
|
The levels, see below. Their order is the order in the report. |
After the report, trlcdoc prints every item that is not traced as required:
Tracing:
SW Requirement: 19 items, 1 not traced
req SwRequirements.sw_req_cli
SW Architecture: 9 items, 0 not traced
Untraced items are content findings: the report is still created, and trlcdoc
exits with 1.
Items that LOBSTER reports as justified, e.g. Python functions with a
# lobster-exclude: <reason> comment, count as traced, like in the coverage
of the report. Their number is shown per level, so exemptions stay visible:
SW Test Code: 100 items, 0 not traced, 17 justified
6.1 Requirement levels
The default kind: requirements takes the records of one record type from a
TRLC document (extracted with lobster-trlc).
- name: SW Test Result
document: sw_test_results
record_type: SwTests.SwTestCaseResult
tags: [relates]
description_fields: [name]
trace_to: [SW Test Case]
Key |
Default |
Meaning and impact |
|---|---|---|
|
Level name, shown in the report and used in |
|
|
|
Omit for TRLC levels. |
|
Id of a |
|
|
|
|
|
|
Record components holding the references to the items of the levels in |
|
|
Record components shown as item text in the report. Test result records have no |
|
|
Levels this level links to, see 6.3. |
|
|
Levels that must link to this level, see 6.3. |
6.2 Implementation levels
kind: implementation takes the items from source code. The extractor decides
the language:
lobster-python: every Python function and method is an item, linked by# lobster-trace:comments.lobster-doxygen: every C/C++ function, method, class, struct and union is an item, linked by doxygen@implements{...}tags. See 6.2.1.
- name: SW Code
kind: implementation
extractor: lobster-python
sources: [src/pyTRLCConverter]
trace_to: [SW Requirement]
def convert_section(self, section, level):
# lobster-trace: SwRequirements.sw_req_rst_section
...
Key |
Meaning and impact |
|---|---|
|
|
|
|
|
|
document, record_type are not allowed here; extractor, sources and
doxyfile are not allowed for requirement levels. tags and
description_fields have no effect.
Use a second implementation level for test code (sources: [tests],
trace_to: [SW Test Case]) to check that every test function traces to a test
case.
6.2.1 C/C++ code with lobster-doxygen
C projects differ a lot in where their sources live and which preprocessor defines they need, so the project provides its own Doxyfile per level:
- name: SW Code
kind: implementation
extractor: lobster-doxygen
doxyfile: tools/doxygen/Doxyfile
trace_to: [SW Requirement]
- name: SW Test Code
kind: implementation
extractor: lobster-doxygen
doxyfile: tools/doxygen/Doxyfile_test # e.g. other INPUT, EXCLUDE, PREDEFINED
trace_to: [SW Test Case]
/**
* @file greeter.c
*/
/**
* @brief Print the greeting.
* @implements{SwRequirements.sw_req_greet}
*/
void Greeter_greet(void);
The trace step runs doxygen - in the folder of the Doxyfile, so its relative
paths (INPUT, EXCLUDE, @INCLUDE) keep working. It includes the Doxyfile
unchanged and overrides only the output settings: XML goes to
<output>/trace/<level>-doxygen/xml, all other formats are off. Then
lobster-doxygen turns the XML into the level’s items. Settings like
WARN_LOGFILE still apply as written in the Doxyfile.
The Doxyfile must
define the aliases that lobster-doxygen reads:
ALIASES = "implements{1}=@xrefitem implements \"Implements\" \"Requirement Traceability\" Requirement: \1" \ "justification{1}=@xrefitem justified \"Justified\" \"Justification Overview\" Justification: \1"select the sources with
INPUT(andEXCLUDE,FILE_PATTERNS, …).set
PREDEFINEDwithMACRO_EXPANSION = YESif functions are declared by macros, e.g. Unity’sTEST(...).
Every source file needs a @file comment, otherwise doxygen drops the tags of
its functions. @justification{reason} marks an item as intentionally
untraced.
lobster-doxygen is installed with trlcdoc. Doxygen itself must be on the
PATH, but only when a level uses lobster-doxygen.
6.3 trace_to and requires
These two keys become the LOBSTER policy and decide which items are reported as not traced:
trace_to: [X]means the items of this level link to items of levelX(up). Every item of this level then needs at least one such link, otherwise it is reported with missing up reference. The links come from thetagscomponents (TRLC) or thelobster-tracecomments (code).requires: [X, Y]means every item of this level must be linked from levelXand from levelY(down). The listed levels must have this level in theirtrace_to, otherwise LOBSTER reports an error.Without
requires, LOBSTER requires a link from every level that has this level in itstrace_to. Withrequires, only the listed levels are required. List them explicitly anyway, it documents the expectation and keeps the result stable when you add a level.
Example: the levels of 11 give this chain:
SW Requirement <-- satisfies -- SW Architecture
SW Requirement <-- verifies -- SW Test Case <-- relates -- SW Test Result
SW Requirement <-- lobster-trace -- SW Code
A requirement with requires: [SW Code, SW Test Case, SW Architecture] is
only fully traced when an architecture item satisfies it, a test case
verifies it, and a function references it. A test case with requires: [SW Test Result] must have been executed.
Generated files in <output>/trace help with debugging: one
<level>.yaml/<level>.lobster per level and the policy
lobster-report.conf.
6.4 Online tracing report
By default the report links each item to its local file. trlcdoc trace --online (or trlcdoc --online) links to the files in the repository at the
current commit instead, which is what you want for a published site. This
uses project.repository and needs a git repository with the commit pushed.
The project may be a subfolder of the repository, e.g. one of several example
projects: the links contain the path of the project in the repository.
Test results are an exception, online and offline: their records are generated
into the output folder, which neither the repository nor the site contains. The
items of a level whose document is a test_results document link to their
row on the site page of that document instead, e.g.
sw_test_results/index.html#sw_test_result_report.rst-test_cli_result. The link
shows the record name, e.g. test_cli_result. The anchor of the row comes from
the built-in converter builtin:create_test_report_in_rst.py; with a project
converter without these anchors, the link opens the top of the page.
7. plantuml
PlantUML renders the diagrams in TRLC records (during convert) and in
.. uml:: directives of the site (during html). Java and Graphviz are
required unless you use a PlantUML server. The plantuml step checks that both
are on the PATH and stops otherwise.
plantuml:
version: "1.2026.1"
Key |
Default |
Meaning and impact |
|---|---|---|
|
|
PlantUML release downloaded from GitHub into |
|
none |
Use this |
|
|
Start the jar once as local PlantUML server for all diagrams, see 7.1. |
The jar is selected in this order:
the
PLANTUMLenvironment variable, if it is an existing jar file or ahttp(s)://PlantUML server URL,plantuml.jar,the download of
plantuml.version.
trlcdoc sets PLANTUML for the converters and Sphinx. Set it yourself to use a
company wide jar or server without changing the configuration, e.g. in CI:
PLANTUML=https://www.plantuml.com/plantuml.
7.1 Local PlantUML server
Starting Java takes seconds, rendering a diagram milliseconds. With a jar, the
plantuml step therefore starts the jar once as PlantUML server (-picoweb) and
sets PLANTUML to its URL, e.g. http://127.0.0.1:50549/plantuml:
The server listens on a free port of
127.0.0.1only, it cannot be reached from the network.127.0.0.1is added toNO_PROXY, so a configured proxy is not used for it.The server stops when trlcdoc ends, also after an error, Ctrl+C or a termination (
SIGTERM). Its output is in<output>/plantuml/picoweb.log.If the server doesn’t render a first diagram within 30 seconds, trlcdoc stops it, prints a warning and starts the jar for each diagram instead. The build continues.
The server gets the diagram text, not its file. A relative
!includepath is therefore relative to the project root, not to the diagram file. Usepicoweb: falseif your diagrams need includes relative to their file.
A server URL in PLANTUML is used as it is, no local server is started.
8. html
Settings of the Sphinx site. All keys are optional.
html:
theme: sphinx_rtd_theme
extensions:
- sphinx_rtd_theme
- sphinx.ext.autodoc
extra_conf:
html_theme_options:
navigation_depth: 3
conf: doc/sphinx/sphinx_conf.py
index: doc/sphinx/index.rst
page_header: doc/sphinx/page_header.rst
8.1 theme, extensions and extra_conf
Key |
Default |
Meaning and impact |
|---|---|---|
|
|
Sphinx |
|
|
Sphinx extensions added to the ones trlcdoc always loads ( |
|
|
Sphinx configuration values, set as variables in trlcdoc’s |
extra_conf is the simplest way to set Sphinx options:
html:
extra_conf:
html_title: "Example Project"
html_show_sourcelink: false
html_theme_options:
collapse_navigation: false
Use conf instead when a value needs Python, e.g. a computed path or a
setup() hook.
8.2 conf: project Sphinx configuration
The html step copies
trlcdoc/sphinx/conf.py unchanged from the trlcdoc
package into <output>/sphinx/, next to a trlcdoc_settings.json with the
project values from trlcdoc.yaml. The conf.py reads this JSON file, sets
the Sphinx configuration and, at its very end, executes the conf file in its
own namespace with exec(). Read that conf.py to see what your file can
use.
The conf file runs after extra_conf, so it can read and change every value
trlcdoc sets. Everything defined in conf.py before it is available without
an import:
Name |
Content |
|---|---|
|
|
|
Dict with |
|
From the |
|
trlcdoc’s extensions plus |
|
Site settings. |
|
Source and diagram settings. |
|
Modules and names imported by |
Names starting with _ (e.g. _SETTINGS) are internal and may change.
Code checkers do not know about this namespace and report these names as
undefined; # pylint: skip-file silences pylint.
# doc/sphinx/sphinx_conf.py
# pylint: skip-file
autoapi_dirs = [str(PROJECT_ROOT / "src")]
html_static_path.append(str(PROJECT_ROOT / "doc" / "sphinx" / "_static"))
html_css_files = ["custom.css"]
def setup(app):
app.connect("builder-inited", lambda app: print("project hook"))
The file runs in the Sphinx folder
<output>/sphinx/, so build paths fromPROJECT_ROOT, not relative to the file.Functions defined in the file become Sphinx configuration values too, e.g.
linkcode_resolve()forsphinx.ext.linkcode. They can use the names above, e.g.trlcdoc_links["repository"],trlcdoc_links["repository_path"]andtrlcdoc_links["commit"]to link the API sources to the repository.A
setup(app)function is called after trlcdoc’s own setup.Do not reassign
html_static_path, append to it: trlcdoc’s_staticfolder holds the stylesheet and thes5defs.txtroles included in every page.
8.3 index: project start page
Without index, trlcdoc generates the start page: the heading
<project name> documentation and a table of contents with all documents. With
index, your reStructuredText file is the start page, e.g. for an
introduction, a logo or several table of contents sections.
pyTRLCConverter
===============
.. image:: {project_root}/doc/images/context.svg
.. toctree::
:maxdepth: 1
:caption: Contents:
{page:sw_requirements}
{page:sw_architecture}
{page:sw_detail_design}
{page:sw_tracing_report}
.. toctree::
:caption: License:
{page:license_include}
Your page owns the table of contents: trlcdoc adds nothing to it, so list
every document. Use {page:<id>} (8.5): trlcdoc replaces
it with the page name of the document, which depends on its type and on
trace.report (4.1). Writing the page names yourself works
as well. With {documents} alone in a toctree, the documents are listed in
configuration order:
.. toctree::
:caption: Contents:
{documents}
License
-------
.. toctree::
{page:license_include}
{documents} leaves out the documents that a toctree lists explicitly, by
{page:<id>} or by page name, so the license above is listed only once. It
reads the same toctrees as the check step (below).
The documents order then only determines the build, not the navigation
(except for {documents}).
The check step compares the toctrees with the documents. It reads the
toctrees of the start page and of the rst and markdown documents, so a
document may also be listed in the toctree of another page, and reports
an entry that is no page, with the page name of a matching document:
html.index: toctree entry 'sw_tracing_report' is no page. Document 'sw_tracing_report' is the page 'sw_tracing_report/index' (type trace_report, trace.report: rst).a document that is in no toctree. Sphinx builds it, but it is not in the navigation.
Entries in folders that belong to no document, e.g. the API pages of
sphinx-autoapi (api/<package>/index), are not checked.
8.4 page_header
reStructuredText inserted at the top of every page trlcdoc generates: the
generated start page and the pages of type trlc, test_results,
trace_report, html, command and text. Not the pages of type
rst/markdown and not a project index, these are yours already.
.. figure:: {project_root}/doc/images/NewTec_Logo.png
:align: right
:width: 150px
.. container:: clearboth
\
Use it for a logo, a classification notice or a disclaimer. Because it is
inserted into pages at different folder depths, image paths must use
{project_root} and links to other pages {page:<id>}.
8.5 Placeholders
trlcdoc copies project owned pages into the generated Sphinx folder, at
different depths (index.rst, sw_requirements/index.rst). A relative path
written in the original file would therefore be wrong, and the page names of
the documents depend on their type (4.1).
In these files, trlcdoc replaces placeholders, relative to the page they are in:
html.index,html.page_header(separately for each page it is inserted into),documents of type
rstandmarkdown, unless they setplaceholders: false(4.7).
Placeholder |
Replaced by |
|---|---|
|
The relative path from the page to the project root. |
|
The page name of the document |
|
The page names of the documents in configuration order, one per line, without the documents a toctree lists explicitly (8.3). Write it alone on a line, e.g. as content of a toctree; every page name gets the indentation of the placeholder. |
.. image:: {project_root}/doc/images/architecture.svg
.. literalinclude:: {project_root}/examples/simple/simple.trlc
See the :doc:`tracing report <{page:sw_tracing_report}>`.
A {page:<id>} naming no document is a configuration error:
html.index: placeholder '{page:sw_req}' names no document. To show a
placeholder as text, e.g. on a page explaining it, set placeholders: false
for that document.
The placeholders are not replaced in the conf file; use PROJECT_ROOT there.
9. Generated files
Everything goes to paths.output, or to the folder of the --output option:
build/trlcdoc/
├── plantuml/plantuml-<version>.jar plantuml step (download)
├── plantuml/picoweb.log plantuml step (output of the local PlantUML server)
├── tests/
│ ├── junit.xml tests step (pytest)
│ ├── coverage/ HTML coverage report (pytest with --cov)
│ └── results/sw_test_result_report.trlc
├── convert/
│ ├── rst/<id>/ convert step, one folder per TRLC document
│ └── markdown/<id>/ convert --format markdown
├── trace/
│ ├── <level>.yaml, <level>.lobster extracted items per level
│ ├── <level>-doxygen/xml/ doxygen XML of lobster-doxygen levels
│ ├── lobster-report.conf generated policy
│ ├── report.lobster
│ └── tracing_report.html
├── sphinx/ generated Sphinx sources, conf.py (copy) and trlcdoc_settings.json
├── doctrees/ Sphinx cache
└── html/ the site, open html/index.html
Publish the html folder. Each step clears its own folders before it runs,
so stale files of a previous run do not remain.
10. Typical errors
Configuration errors are listed without the leading <file>:<line>:. Errors and
warnings go to the standard error output, everything else to the standard output.
If the message doesn’t explain the problem, run trlcdoc again with -v. It shows
its decisions (steps, PlantUML source, report format), and for every tool it runs
the working folder, the environment variables trlcdoc sets, the exit code and the
duration. -vv adds details per item, e.g. every rewritten link of the tracing
report, and the complete environment. Values of variables named like secrets
(TOKEN, SECRET, PASSWORD, KEY, CREDENTIAL) and the user info of URLs are
shown as ***.
trlcdoc -v tests # decisions, tool details and timings
trlcdoc -vv trace # also per-item details and the environment
Message |
Cause and fix |
|---|---|
|
The document type needs this key, see the table in 4. The number is the position in the list, starting at 0. |
|
Typo in a document key, or a key that is not allowed for this document type. |
|
Typo in a key of the other sections, e.g. a top level key. |
|
|
|
Wrong path, or |
|
A pyTRLCConverter option on document level. Move it into the |
|
The |
|
The level name must match exactly, including spaces and case. |
|
The Doxyfile path is relative to the project root. |
|
Install doxygen and put it on the |
|
Install Java and put it on the |
|
The local PlantUML server didn’t start, the next line tells why, |
|
Install Graphviz and put its |
|
The program of |
lobster-doxygen: |
An |
|
Tests without test case link, see 5.3. |
|
Set |
|
All test cases of the results must be in one package, see 5.4. |
|
|
|
Run |
|
Run |
|
The referenced records’ document is missing in |
LOBSTER: |
A level in |
Sphinx: |
With |
|
The entry uses the wrong page name, e.g. after changing |
|
Add |
|
Misspelled document id in a project page. |
11. Complete examples
A configuration example using all sections, with requirements, architecture, test cases, test results, code tracing and a customized site.
# yaml-language-server: $schema=https://nhjschulz.github.io/trlc-doc/schema/V0.7.0/trlcdoc.schema.json
project:
name: pyTRLCConverter
author: NewTec GmbH
copyright: 2024 - 2026, NewTec GmbH
repository: https://github.com/NewTec-GmbH/pyTRLCConverter
logo: doc/images/NewTec_Logo.png
favicon: doc/images/favicon.ico
paths:
trlc_model: trlc/model
output: build/trlcdoc
plantuml:
version: "1.2026.1"
documents:
- id: sw_requirements # no title: the converter writes the heading
type: trlc
source: trlc/swe-req
pytrlcconverter:
converter:
rst: tools/converter/req2rst.py # project owned converters
markdown: tools/converter/req2markdown.py
translation: tools/converter/translation.json
render_cfg: tools/converter/renderCfg.json
- id: sw_architecture
type: trlc
source: trlc/swe-arch
include: [sw_requirements] # architecture items reference requirements
pytrlcconverter:
converter:
rst: tools/converter/req2rst.py
translation: tools/converter/translation.json
render_cfg: tools/converter/renderCfg.json
- id: sw_detail_design
type: rst
source: doc/sphinx/sw_detail_design.rst
- id: sw_tests
type: trlc
source: trlc/swe-test
include: [sw_requirements]
pytrlcconverter:
converter:
rst: tools/converter/tc2rst.py
translation: tools/converter/translation.json
- id: sw_tracing_report
title: SW Tracing Report
type: trace_report
- id: sw_test_result_report
type: test_results
include: [sw_tests] # results reference the test cases
pytrlcconverter:
converter:
rst: tools/converter/create_test_report_in_rst.py
- id: coverage_report
title: Coverage Report
type: html
source: tests:coverage
- id: license_include
title: License information
type: text
source: LICENSE
tests:
runner: pytest
args: [tests, -v, --cov=./src] # --cov enables the coverage report
link:
property: lobster-trace # record_property("lobster-trace", "SwTests.x")
array: true # some tests record several test cases
from: "test_{name}"
to: "SwTests.{name}"
trace:
levels:
- name: SW Requirement
document: sw_requirements
record_type: SwRequirements.SwReq
description_fields: [description, valid_status]
requires: [SW Code, SW Test Case, SW Architecture]
- name: SW Constraint
document: sw_requirements
record_type: SwRequirements.SwConstraint
requires: [SW Architecture]
- name: SW Architecture
document: sw_architecture
record_type: SwArch.SwArchSpec
tags: [satisfies]
trace_to: [SW Requirement, SW Constraint]
- name: SW Code
kind: implementation
extractor: lobster-python
sources: [src/pyTRLCConverter]
trace_to: [SW Requirement]
- name: SW Test Case
document: sw_tests
record_type: SwTests.SwTestCase
tags: [verifies]
trace_to: [SW Requirement]
- name: SW Test Result
document: sw_test_result_report
record_type: SwTests.SwTestCaseResult
tags: [relates]
description_fields: [name]
trace_to: [SW Test Case]
- name: SW Test Code
kind: implementation
extractor: lobster-python
sources: [tests]
trace_to: [SW Test Case]
html:
theme: sphinx_rtd_theme
extensions: [sphinx_rtd_theme, autoapi.extension, sphinx.ext.napoleon, sphinx_favicon]
conf: doc/sphinx/sphinx_conf.py
index: doc/sphinx/index.rst
page_header: doc/sphinx/page_header.rst
More configurations in use:
trlcdoc.yaml of trlcdoc itself: built-in converters, name pattern test linking, default site.
flashcontainer: the same structure with property based test linking.