Skip to main content
Ctrl+K
Eclipse S-CORE documentation - Home Eclipse S-CORE documentation - Home
  • How To
  • Reference
  • Concepts
  • Internals
  • GitHub
  • How To
  • Reference
  • Concepts
  • Internals
  • GitHub

Section Navigation

Getting started

  • Build Documentation in an Existing Project
  • Set Up Docs-as-Code in a New Project
  • Write Documentation

Integrate and extend documentation

  • Use Documentation Bundles
  • Integrate Generated Documentation
  • Reference Documentation from Other Modules
  • Handle Cross-Module Compatibility Findings
  • Add Sphinx Extensions

Traceability and quality checks

  • Link Source Code to Requirements
  • Link Tests to Requirements
  • Build Dashboards and Quality Gates

Tool verification

  • How to Apply the SCORE Tool Management Process
  • How To
  • Link Source Code to Requirements

Link Source Code to Requirements#

In your C++/Rust/Python source code, you want to reference requirements (needs). The docs-as-code tool will create backlinks in the documentation in two steps:

  1. You add a special comment in your source code that references the need ID.

  2. Scan for those comments and provide needs links to your documentation.

For an example result, look at the attribute source_code_link of Enforces title wording rules (tool_req__docs_common_attr_title).

Comments in Source Code#

Use a comment and start with req-Id: or req-traceability: followed by the need ID.

# req-Id: TOOL_REQ__EXAMPLE_ID
# req-traceability: TOOL_REQ__EXAMPLE_ID

For other languages (C++, Rust, etc.), use the appropriate comment syntax.

Scanning Source Code for Links#

In your BUILD files, pass the implementation targets to the docs rule as code_targets. Their srcs, hdrs, and textual_hdrs are scanned, including those of their deps recursively within the component boundary described below. This means that a cc_executable also covers source files from the cc_library targets it uses. You may also pass filegroups; their files are scanned directly.

Source-link scanning includes the sources and headers of every explicitly selected target, even when it is outside the bundle package. Transitive dependencies are filtered by the repository and BUILD package containing the docs_bundle declaration; subpackage targets are included. Local targets reached through a sibling package or external repository are included too. This boundary does not depend on source_dir. Source and header attributes resolve filegroups and generated outputs; selecting generator rules directly as implementation targets is not supported.

 1cc_library(
 2   name = "some_library",
 3   srcs = [
 4       "bar.cpp",
 5   ],
 6)
 7
 8cc_executable(
 9   name = "some_application",
10   srcs = ["main.cpp"],
11   deps = [":some_library"],
12)
13
14docs(
15   external_needs = [
16      "@score_process_description//:docs",
17   ],
18   source_dir = "docs",
19   code_targets = [":some_application"],
20   primary_need_id = "comp__some_component",
21)

primary_need_id is optional and identifies the single Need representing the bundle’s primary subject. A bundle can contain many other Needs; target metadata is attached only to this explicitly selected Need. The ID is never derived from the Bazel bundle name.

previous

Add Sphinx Extensions

next

Link Tests to Requirements

On this page
  • Comments in Source Code
  • Scanning Source Code for Links
Edit on GitHub

Created using Sphinx 9.1.1.

Built with the PyData Sphinx Theme 0.24.0.