Skip to content

Commit d2c495f

Browse files
Tracability improvements - needs type autodiscovery (#545)
* Fix: clarify requirement type autodiscovery override * Feat: traceability improvements (#578) * Fix: Upgrade of tests & schema * Feat: Reworking scripts into Sphinx Extensions * Fix: Documentation, Complexity, PR Comments * Fix: Fixing PR comments, linting & formatting * Fix: Fix accessing of renamed options --------- Co-authored-by: Maximilian Sören Pollak <maximilian.pollak@qorix.com>
1 parent 590778c commit d2c495f

29 files changed

Lines changed: 1524 additions & 1605 deletions

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13+
import matplotlib
1314

1415
project = "Score Docs-as-Code"
1516
project_url = "https://eclipse-score.github.io/docs-as-code/"
@@ -18,3 +19,4 @@
1819
extensions = [
1920
"score_sphinx_bundle",
2021
]
22+
matplotlib.rcParamsDefault["savefig.bbox"] = "tight"

docs/how-to/dashboards_and_quality_gates.rst

Lines changed: 100 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Goals:
2727
What You Get
2828
------------
2929

30-
With the ``docs(...)`` macro and ``score_metamodel`` extension enabled, your
30+
With the ``docs(...)`` macro and ``score_metamodel`` as well as the ```score_metrics`` extensions enabled, your
3131
repository can:
3232

3333
- build an HTML dashboard from its own Sphinx needs,
@@ -40,30 +40,44 @@ Typical Setup
4040

4141
For details, see :ref:`setup`.
4242

43-
Minimal Configuration Example
44-
-----------------------------
43+
Configuration
44+
-------------
45+
46+
Default Behavior (No Configuration Needed)
47+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48+
49+
By default, ``score_metrics`` autodiscovers requirement types from the
50+
repository needs present in the current build.
51+
Requirement types are identified from ``needs_types`` entries tagged with ``requirement``.
52+
53+
This is the recommended setup for most repositories.
4554

46-
In ``docs/conf.py``:
55+
Optional Override for Requirement Types
56+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57+
58+
If a repository needs to force a specific set of requirement types, set an
59+
explicit override in ``docs/conf.py``:
4760

4861
.. code-block:: python
4962
50-
score_metamodel_requirement_types = "feat_req,comp_req,aou_req"
51-
score_metamodel_include_external_needs = False
63+
score_metrics_requirement_types = "feat_req,comp_req,aou_req"
64+
65+
When this setting is provided, the explicit list is used instead of
66+
autodiscovery.
5267

53-
Use ``score_metamodel_include_external_needs = True`` only in repositories that
68+
Use ``score_metrics_include_external_needs = True`` only in repositories that
5469
intentionally aggregate requirements across module dependencies, such as
55-
integration repositories. Use ``False`` for module repositories to gate only on
56-
local traceability.
70+
integration repositories.
5771

5872
Building the Dashboard
5973
----------------------
6074

61-
After building/running any docs command (i.e. ``bazel build //:needs_json`` or ``bazel run //:docs_check`` are the fastest):
75+
After building/running any docs and test command (i.e. ``bazel build //:needs_json`` or ``bazel run //:docs_check``, ``bazel run //:docs``, ``bazel test //...``):
6276

63-
The documentation build writes ``metrics.json`` via ``score_metamodel``, and the ``needs_json`` artifact contains:
77+
The documentation build writes ``metrics.json`` via ``score_metrics``, and the ``needs_json`` artifact contains:
6478

65-
- ``bazel-bin/needs_json/_build/needs/needs.json``
66-
- ``bazel-bin/needs_json/_build/needs/metrics.json``
79+
- ``_build/needs.json``
80+
- ``_build/metrics.json``
6781

6882
The dashboard charts and the CI gate both use the same computed metrics.
6983

@@ -87,13 +101,13 @@ There are two common modes:
87101

88102
**Module repository**
89103

90-
- Set ``score_metamodel_include_external_needs = False``.
104+
- No setting needed. Local-only scope is the default.
91105
- Gate only on the needs owned by the repository itself.
92106
- Use this for per-module implementation progress and traceability.
93107

94108
**Integration repository**
95109

96-
- Set ``score_metamodel_include_external_needs = True``.
110+
- Set ``score_metrics_include_external_needs = True``.
97111
- Aggregate requirements across module dependencies when that is the intended
98112
repository purpose.
99113
- Use this for system or integration-level dashboards.
@@ -136,10 +150,75 @@ For a new consumer repository:
136150
4. Introduce modest thresholds in CI.
137151
5. Raise thresholds over time as the repository matures.
138152

139-
Related Guides
140-
--------------
153+
..
154+
╓ ╖
155+
║ Some portions generated by Github Copilot ║
156+
╙ ╜
157+
158+
Needpie Usage Guide (Quick and Practical)
159+
=========================================
160+
161+
Use these examples as ready-to-copy templates for dashboard-style pie charts.
162+
163+
Tips for readable charts
164+
------------------------
165+
166+
- Keep labels short and audience-friendly.
167+
- Put the most important category first.
168+
- Use high-contrast colors that are easy to distinguish.
169+
- Avoid red/green-only combinations when possible.
170+
171+
Recommended color palette
172+
~~~~~~~~~~~~~~~~~~~~~~~~~
173+
174+
This palette is generally easier to read:
175+
176+
- ``#4E79A7`` (blue)
177+
- ``#F28E2B`` (orange)
178+
- ``#59A14F`` (green)
179+
- ``#B07AA1`` (purple)
180+
181+
Example 1: Overall view (including remaining/unlinked)
182+
------------------------------------------------------
183+
184+
.. code-block:: rst
185+
186+
.. needpie:: Overall Requirement Coverage
187+
:labels: Remaining (no selected links), With Test Link, With Code Link, Fully Linked
188+
:colors: #4E79A7, #F28E2B, #59A14F, #B07AA1
189+
:filter-func: score_metrics.sphinx_filters.get_metrics_with_first_value_total(overall_metrics:total,overall_metrics:with_test_link,overall_metrics:with_code_link,overall_metrics:fully_linked)
190+
191+
This chart shows:
192+
193+
- remaining requirements (calculated from total),
194+
- requirements with test link,
195+
- requirements with code link,
196+
- fully linked requirements.
197+
198+
.. needpie:: Overall Requirement Coverage
199+
:labels: Remaining (no selected links), With Test Link, With Code Link, Fully Linked
200+
:colors: #4E79A7, #F28E2B, #59A14F, #B07AA1
201+
:filter-func: score_metrics.sphinx_filters.get_metrics_with_first_value_total(overall_metrics:total,overall_metrics:with_test_link,overall_metrics:with_code_link,overall_metrics:fully_linked)
202+
203+
Example 2: Focused view (no total-based remainder)
204+
--------------------------------------------------
205+
206+
This chart shows direct values only (no remaining slice):
207+
208+
- tool requirements with test link,
209+
- tool requirements with code link,
210+
- overall fully linked requirements.
211+
212+
.. needpie:: Tool Requirements Snapshot
213+
:labels: Tool Req With Test Link, Tool Req With Code Link, Fully Linked (Overall)
214+
:colors: #F28E2B, #4E79A7, #59A14F
215+
:filter-func: score_metrics.sphinx_filters.get_just_metrics(metrics_by_type:tool_req:with_test_link,metrics_by_type:tool_req:with_code_link,overall_metrics:fully_linked)
216+
217+
Presentation checklist
218+
----------------------
219+
220+
Before publishing, quickly verify:
141221

142-
- :ref:`setup`
143-
- :doc:`other_modules`
144-
- :doc:`source_to_doc_links`
145-
- :doc:`test_to_doc_links`
222+
- labels are understandable for non-technical readers,
223+
- colors are distinct and readable on your page theme,
224+
- title clearly says what the chart represents.

docs/internals/requirements/implementation_state.rst

Lines changed: 0 additions & 127 deletions
This file was deleted.

docs/internals/requirements/index.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ docs-as-code as a Bazel dependency.
2828
Pages
2929
-----
3030

31-
- ``implementation_state`` describes tooling coverage: implemented capabilities,
32-
source-code links, test links, full linkage, and process-to-tool mapping.
3331
- ``tooling_verification`` describes verification evidence for the tooling
3432
itself, including test results and testcase metadata.
3533

@@ -39,5 +37,4 @@ Pages
3937
capabilities
4038
process_overview
4139
requirements
42-
implementation_state
4340
tooling_verification

docs/internals/requirements/requirements.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,18 @@ Testing
852852
- If Partially/FullyVerifies are set in Unit Test these shall link to Component Requirements
853853

854854

855+
.. tool_req:: Provide Metrics for linked requirements
856+
:id: tool_req__docs_test_linkage_metrics
857+
:tags: Testing
858+
:version: 1
859+
:implemented: YES
860+
:parent_covered: NO: Placeholder process requirement
861+
:satisfies: gd_req__verification_reporting
862+
:status: invalid
863+
864+
Docs-AS-Code shall provide a way to gather statistics on linkages to implementation(source_code_links) & tests(testlink) for all needs.
865+
It shall also be possible to filter these by type and use the provided statistics in the documentation (via diagrams drawn from it etc.)
866+
855867
🧪 Tool Verification Reports
856868
############################
857869

docs/internals/requirements/tooling_verification.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ Overview
5353
No skipped or disabled tests are expected in the current dataset.
5454

5555

56+
How many requirements are linked
57+
---------------------------------
58+
59+
*This shows how many of our requirements are linked with tests, in source code, both or neither.*
60+
61+
.. needpie:: Overall Requirement Coverage
62+
:labels: Remaining (no selected links), With Test Link, With Code Link, Fully Linked
63+
:colors: #4E79A7, #F28E2B, #59A14F, #B07AA1
64+
:filter-func: score_metrics.sphinx_filters.get_metrics_with_first_value_total(overall_metrics:total,overall_metrics:with_test_link,overall_metrics:with_code_link,overall_metrics:fully_linked)
65+
66+
5667
Testcase Metadata Overview
5768
--------------------------
5869

0 commit comments

Comments
 (0)