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

clean

paths.output

Removes the output folder

check

the whole file

Nothing, validates the configuration and the table of contents of html.index

plantuml

plantuml

PlantUML jar, PLANTUML environment variable

tests

tests

JUnit XML, coverage report, TRLC test results

convert

documents of type trlc/test_results, paths.trlc_model

Converted reStructuredText (or Markdown)

trace

trace, documents, project.repository

LOBSTER files and the HTML tracing report

html

documents, project, html

The HTML site

show

paths.output

Nothing, opens html/index.html in the web browser

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:

  1. Schema validation: types, required keys, allowed keys per document type, id patterns.

  2. Reference checks that the schema cannot express:

    • document ids and trace level names are unique,

    • include and trace.levels[].document refer to documents of type trlc or test_results,

    • trace_to and requires refer to defined levels,

    • the converter, translation and render configuration files of the pytrlcconverter options exist,

    • project.logo, project.favicon, html.conf, html.index and html.page_header files exist,

    • the {page:<id>} placeholders (8.5) name documents,

    • a test_results document or a tests:coverage source has a tests section,

    • a trace_report document has a trace section,

    • paths.output is 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

name

yes

Sphinx project. Appears in the page header, the browser title of every page and in the heading <name> documentation of the generated start page.

version

no

none

Sphinx version and release. Follows the name in the page header, the browser title and the start page heading: <name> <version> documentation. Quote it ("1.0"): YAML reads an unquoted 1.0 as a number, which the schema rejects.

author

yes

Sphinx author.

copyright

yes

Sphinx copyright, shown in the page footer. Quote it if it contains a colon or starts with a number followed by special characters.

repository

no

auto

Repository URL. Used by trlcdoc trace --online to turn the file references of the tracing report into links to the repository, and for the links of Markdown pages to project files (4.7). auto takes the URL from git remote get-url origin. SSH URLs (git@host:owner/repo.git) are converted to HTTPS, a trailing .git is removed.

logo

no

none

Image file shown by the theme as site logo (Sphinx html_logo).

favicon

no

none

Browser tab icon (Sphinx html_favicon).

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

trlc_model

yes

Folder with the TRLC model files (.rsl). It is passed as include to every pyTRLCConverter run and as input to every lobster-trlc run, so all documents and trace levels can resolve the record types.

output

no

build/trlcdoc

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.output in 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: command documents, test result files of runner: 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:

type

Content

Required keys

Optional keys

trlc

TRLC records converted by pyTRLCConverter

source, pytrlcconverter

title, include

test_results

TRLC records generated from the test results

pytrlcconverter

title, include

trace_report

The LOBSTER tracing report

title

html

An existing HTML folder, e.g. a coverage report

title, source

command

An HTML folder generated by an external tool

title, command, output

rst

A project owned reStructuredText page

source

title

markdown

A project owned Markdown page

source

title

text

A plain text file shown literally

title, source

Every document also requires id and type. Keys not listed for a type are rejected.

4.1 Common keys

Key

Meaning and impact

id

Unique key of the document. Lower case letters, digits and _, starting with a letter (sw_requirements). It names the page and the output folders (convert/rst/<id>), and other parts of the configuration refer to the document by it (include, trace.levels[].document). Changing it changes the page URL.

title

Page heading and table of contents entry. trlcdoc writes it as top level heading above the content, except for rst and markdown pages (4.7).

type

One of the types above.

Page names: a document is a single page or a folder of pages:

Document

Page name

HTML file

trlc, test_results

<id>/index

<id>/index.html

trace_report with trace.report: rst

<id>/index

<id>/index.html, plus one page per trace level

trace_report with trace.report: html (default)

<id>

<id>.html

all others

<id>

<id>.html

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

source

Folder with the .trlc files of this document (pyTRLCConverter --source). All files in it are converted; each converted file is included into the page in file name order.

include

Ids of other trlc or test_results documents whose records are referenced here, e.g. the requirements an architecture item satisfies. Their files are passed as --include (to resolve the references) and as --exclude (so they are not rendered on this page). Includes are transitive: including sw_test also includes what sw_test includes. Without the include, the conversion fails with an unresolved reference.

pytrlcconverter

The options of the pyTRLCConverter run: converter, translation and render configuration, see 4.9.

title

Optional for this type. Without title, trlcdoc writes no heading, and the first heading of the converted content is the page title. Use this if your converter writes its own document heading, otherwise the page shows two headings.

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 tests section.

  • include must name the document with the TRLC test cases, because every result record references its test case.

  • Run the tests step before convert. all does this; trlcdoc convert alone 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 for trlc.

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

source

HTML folder, relative to the project root. The special value tests:coverage refers to the coverage report of the tests step (tests.coverage, or <output>/tests/coverage for pytest), and requires a tests section.

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

command

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: [bash, -c, "..."].

output

The HTML folder the command writes, relative to the project root. It must contain index.html. It is copied into the site as <id>/.

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
  • source is the .rst or .md file. It is copied into the Sphinx source folder as <id>.rst or <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 title is the page title in the table of contents, the navigation links and the browser title, e.g. README for a README.md whose first heading is the project name. Without title, 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 source of a document of type trlc, rst, markdown or text

    A 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>, tree for folders), see project.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: false copies 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

converter

yes

--project

Project converter per output format. rst is required, it is used for the HTML site. markdown is only used by trlcdoc convert --format markdown; a document without it is skipped in that run.

translation

no

--translation

JSON file mapping attribute names to the names shown in the output, e.g. verification_criteria to Verification Criteria. Without it, the attribute names of the TRLC model are shown.

render_cfg

no

--renderCfg

JSON file declaring the format of attribute values (md CommonMark, gfm GitHub Flavored Markdown, or rst), selected by package, type and attribute name patterns. Matching values are rendered as rich text (lists, tables, emphasis, links); all others are escaped and shown as plain text.

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

req2rst.py, req2markdown.py

Requirements, constraints and architecture records

tc2rst.py, tc2markdown.py

Test case records

create_test_report_in_rst.py, create_test_report_in_markdown.py

Test result records (test_results documents)

translation.json

Display names of the attributes used by these converters

renderCfg.json

Renders the description of Info, SwReq, SwReqNonFunc, SwConstraint, SwArchSpec and SwTestCase records and the verification_criteria of SwReq and SwArchSpec records as GitHub Flavored Markdown

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

runner

yes

pytest or command.

args

no

pytest arguments (runner pytest only).

command

runner command

The test command (runner command only).

junit

runner command

JUnit XML file the command writes.

coverage

no

HTML coverage folder, if not the default.

link

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>]
  • args typically name the test folder and options like -v.

  • An argument starting with --cov enables the HTML coverage report (pytest-cov must be installed). It is written to tests.coverage if set, otherwise to <output>/tests/coverage. Refer to it with a document of type html and source: tests:coverage.

  • The coverage data file .coverage is 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}"
  • command runs 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.

  • junit is 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.

  • coverage is the HTML coverage folder the command writes, if any. Its index.html must be written by the command, otherwise the step fails.

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

namespace

req

LOBSTER namespace of all TRLC items. An item is identified as <namespace> <Package>.<record>, e.g. req SwRequirements.sw_req_cli. Keep the default: lobster-python reads # lobster-trace: Package.record comments into the req namespace, so code can only trace to TRLC items in that namespace.

markdown

false

Render the item descriptions of the tracing report as Markdown (lobster-html-report --render-md): wrapped lines join into one paragraph, and **bold**, `code`, lists and tables are rendered like on the documentation pages. Enable it together with a Markdown render_cfg (4.9). Raw HTML is not escaped: write text like <name> in backticks, otherwise the browser hides it as unknown tag. Without it, descriptions are plain text with a line break for every source line break.

report

html

Format of the tracing report in the site. html embeds the LOBSTER HTML report (lobster-html-report) into the page of the trace_report document. rst includes it as site pages (lobster-rst-report): a start page with the coverage summary and the tracing policy diagram, and one page per level with an expandable card per item. The report then uses the site theme, navigation, page header and search, and the links to the item sources are relative to the page. trlcdoc adds the Sphinx extensions sphinx_design and sphinx.ext.graphviz. markdown has no effect: lobster-rst-report shows the descriptions as plain text, wrapped lines join and - lists render, but **bold** or `code` stay literal. With rst, no tracing_report.html is written.

levels

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

name

Level name, shown in the report and used in trace_to/requires.

kind

requirements

Omit for TRLC levels.

document

Id of a trlc or test_results document. Its source and its include documents are the input, together with paths.trlc_model.

record_type

Package.Type of the records forming this level. Records of other types in the same document are ignored, so several levels can use the same document (e.g. SwReq and SwConstraint from sw_requirements).

tags

[]

Record components holding the references to the items of the levels in trace_to, e.g. satisfies, verifies, relates. Without tags, the items have no outgoing links.

description_fields

[description]

Record components shown as item text in the report. Test result records have no description, use [name].

trace_to

[]

Levels this level links to, see 6.3.

requires

[]

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

extractor

lobster-python or lobster-doxygen.

sources

lobster-python only: files or folders to scan, relative to the project root.

doxyfile

lobster-doxygen only: the Doxyfile that selects the sources, relative to the project root.

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 (and EXCLUDE, FILE_PATTERNS, …).

  • set PREDEFINED with MACRO_EXPANSION = YES if functions are declared by macros, e.g. Unity’s TEST(...).

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 level X (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 the tags components (TRLC) or the lobster-trace comments (code).

  • requires: [X, Y] means every item of this level must be linked from level X and from level Y (down). The listed levels must have this level in their trace_to, otherwise LOBSTER reports an error.

  • Without requires, LOBSTER requires a link from every level that has this level in its trace_to. With requires, 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

version

1.2024.8

PlantUML release downloaded from GitHub into <output>/plantuml if no jar is configured. Quote it, so YAML keeps it a string. The download happens once; clean removes it.

jar

none

Use this plantuml.jar (relative to the project root) instead of downloading one.

picoweb

true

Start the jar once as local PlantUML server for all diagrams, see 7.1. false starts the jar for each diagram.

The jar is selected in this order:

  1. the PLANTUML environment variable, if it is an existing jar file or a http(s):// PlantUML server URL,

  2. plantuml.jar,

  3. 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.1 only, it cannot be reached from the network. 127.0.0.1 is added to NO_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 !include path is therefore relative to the project root, not to the diagram file. Use picoweb: false if 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

theme

haiku

Sphinx html_theme. trlcdoc’s custom.css is only applied to haiku. Other themes must be installed in the environment, and usually also listed in extensions (e.g. sphinx_rtd_theme).

extensions

[]

Sphinx extensions added to the ones trlcdoc always loads (myst_parser for Markdown, sphinxcontrib.plantuml for diagrams). They must be installed in the environment.

extra_conf

{}

Sphinx configuration values, set as variables in trlcdoc’s conf.py (see 8.2). Any value that YAML can express: strings, numbers, lists, dicts.

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

PROJECT_ROOT

pathlib.Path of the project root.

trlcdoc_links

Dict with repository (HTTPS URL, None without git or origin remote), repository_path (path of the project root in the repository, . in the repository root), commit (HEAD, None outside git), root and the page mappings of the Markdown link resolution.

project, author, copyright, version, release

From the project section.

extensions

trlcdoc’s extensions plus html: extensions.

html_theme, html_static_path, html_logo, html_favicon, html_last_updated_fmt

Site settings.

rst_prolog, source_suffix, myst_heading_anchors, plantuml

Source and diagram settings.

Path, os, json, subprocess, shutil, urlparse, Any

Modules and names imported by conf.py.

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 from PROJECT_ROOT, not relative to the file.

  • Functions defined in the file become Sphinx configuration values too, e.g. linkcode_resolve() for sphinx.ext.linkcode. They can use the names above, e.g. trlcdoc_links["repository"], trlcdoc_links["repository_path"] and trlcdoc_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 _static folder holds the stylesheet and the s5defs.txt roles 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.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 rst and markdown, unless they set placeholders: false (4.7).

Placeholder

Replaced by

{project_root}

The relative path from the page to the project root.

{page:<id>}

The page name of the document <id>, relative to the page. For toctree entries and :doc: links.

{documents}

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

... does not match the schema: documents/1: 'title' is a required property

The document type needs this key, see the table in 4. The number is the position in the list, starting at 0.

documents/0: 'titel' is not one of ['id', 'title', ...]

Typo in a document key, or a key that is not allowed for this document type.

Additional properties are not allowed ('document' was unexpected)

Typo in a key of the other sections, e.g. a top level key.

documents[x].include: 'y' is no document of type trlc or test_results.

include names a missing id or a page type without TRLC records.

documents[x].pytrlcconverter.converter.rst: file '...' not found.

Wrong path, or builtin: prefix missing for a built-in file.

documents/0: 'converter' is not one of ['id', 'title', ...]

A pyTRLCConverter option on document level. Move it into the pytrlcconverter block.

--output ...: must not be the project root or one of its parents.

The --output folder would contain the project, which the clean step deletes. A relative folder is relative to the current folder, see 3.

trace.levels[A].requires: level 'B' is not defined.

The level name must match exactly, including spaces and case.

trace.levels[A].doxyfile: file '...' not found.

The Doxyfile path is relative to the project root.

Tool 'doxygen' not found. It is needed by the lobster-doxygen extractor of trace level 'A'

Install doxygen and put it on the PATH.

Tool 'java' not found. A Java runtime is needed to run the PlantUML jar

Install Java and put it on the PATH, or set PLANTUML to a PlantUML server URL, see 7.

Warning: The PlantUML picoweb server is not available, every diagram starts the jar instead.

The local PlantUML server didn’t start, the next line tells why, <output>/plantuml/picoweb.log has its output. The build continues, only slower. Set plantuml.picoweb: false to skip the server, see 7.

Tool 'dot' not found. Graphviz is needed ...

Install Graphviz and put its bin folder on the PATH. The plantuml step, the trace step (tracing policy diagram) and, with trace.report: rst, the html step need it.

Program 'x' not found, check tests.command in the configuration and the PATH.

The program of tests.command or of a command document (named documents[<id>].command) is not installed or not on the PATH. not executable instead of not found: the file exists but can’t be run. -v shows the PATH.

lobster-doxygen: ... has requirements or justifications on file level.

An @implements tag in the @file comment. Move it to a function, struct or class.

Tests without test case link (property ..., output ..., name pattern ...)

Tests without test case link, see 5.3.

Tests linked to several test cases, which needs tests.link.array

Set array: true and make relates an array in the model.

Tests linked to test cases of several packages

All test cases of the results must be in one package, see 5.4.

tests/link: {...} is not valid under any of the given schemas

link needs property, output, or both from and to.

No test results in ..., run the tests step first.

Run trlcdoc tests convert or trlcdoc.

No converted files in ..., run the convert step first.

Run convert before html.

pyTRLCConverter reports an unresolved reference

The referenced records’ document is missing in include.

LOBSTER: X cannot trace to Y items

A level in requires of Y lacks Y in its trace_to.

Sphinx: document isn't included in any toctree

With html.index, add the page to your toctree, e.g. with {page:<id>}.

html.index: toctree entry 'x' is no page. Document 'x' is the page 'x/index' (...)

The entry uses the wrong page name, e.g. after changing trace.report. Write {page:x} instead.

html.index: document 'x' (page '...') is not in any toctree.

Add {page:x} to a toctree of the start page or of a project page.

html.index: placeholder '{page:x}' names no document.

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.