Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/how-to/dashboards_and_quality_gates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ Example 1: Overall view (including remaining/unlinked)

.. code-block:: rst

.. needpie:: Overall Requirement Coverage
:labels: Remaining (no selected links), With Test Link, With Code Link, Fully Linked
.. needpie:: Overall Requirement Coverage (non-overlapping)
:labels: Remaining (no links), Test Link Only, Code Link Only, Fully Linked (Both)
:colors: #4E79A7, #F28E2B, #59A14F, #B07AA1
: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)
:filter-func: score_metrics.sphinx_filters.get_non_overlapping_link_metrics

This chart shows:

Expand All @@ -195,10 +195,10 @@ This chart shows:
- requirements with code link,
- fully linked requirements.

.. needpie:: Overall Requirement Coverage
:labels: Remaining (no selected links), With Test Link, With Code Link, Fully Linked
.. needpie:: Overall Requirement Coverage (non-overlapping)
:labels: Remaining (no links), Test Link Only, Code Link Only, Fully Linked (Both)
:colors: #4E79A7, #F28E2B, #59A14F, #B07AA1
: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)
:filter-func: score_metrics.sphinx_filters.get_non_overlapping_link_metrics

Example 2: Focused view (no total-based remainder)
--------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions docs/internals/requirements/requirement_coverage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ by CI quality gates — they will always match.
Overall Coverage
----------------

.. needpie:: Overall Requirement Coverage
:labels: Remaining (no selected links), With Test Link, With Code Link, Fully Linked
.. needpie:: Overall Requirement Coverage (non-overlapping)
:labels: Remaining (no links), Test Link Only, Code Link Only, Fully Linked (Both)
:colors: #ca2828, #009ad2, #d26403, #37a12d
: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)
:filter-func: score_metrics.sphinx_filters.get_non_overlapping_link_metrics

.. needpie:: Test Linkages
:labels: Tests Not Linked, Tests Linked
Expand Down
11 changes: 0 additions & 11 deletions docs/internals/requirements/tooling_verification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ Overview
No skipped or disabled tests are expected in the current dataset.


How many requirements are linked
---------------------------------

*This shows how many of our requirements are linked with tests, in source code, both or neither.*

.. needpie:: Overall Requirement Coverage
:labels: Remaining (no selected links), With Test Link, With Code Link, Fully Linked
:colors: #4E79A7, #F28E2B, #59A14F, #B07AA1
: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)


Testcase Metadata Overview
--------------------------

Expand Down
28 changes: 28 additions & 0 deletions src/extensions/score_metrics/sphinx_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,31 @@ def get_just_metrics(needs: list[Any], results: list[int], **kwargs: Any) -> Non
"""
results.clear()
_get_key_values(results, [str(value) for value in kwargs.values()])


def get_non_overlapping_link_metrics(
needs: list[Any], results: list[int], **kwargs: Any
) -> None:
"""Compute mutually exclusive (non-overlapping) requirements-tests linkage categories.

Use input from global state and overrides results input.

1. **Remaining** — no testlink, no source_code_link
2. **Test link only** — has testlink, no source_code_link
3. **Code link only** — has source_code_link, no testlink
4. **Fully linked** — has both testlink and source_code_link

Suitable for ``needpie`` directives where overlapping
categories produce misleading visualisations.
"""
results.clear()
total = int(CALCULATED_METRICS["overall_metrics"]["total"])
with_test = int(CALCULATED_METRICS["overall_metrics"]["with_test_link"])
with_code = int(CALCULATED_METRICS["overall_metrics"]["with_code_link"])
fully = int(CALCULATED_METRICS["overall_metrics"]["fully_linked"])

remaining = total - with_test - with_code + fully # inclusion-exclusion
only_test = with_test - fully
only_code = with_code - fully

results.extend([remaining, only_test, only_code, fully])
2 changes: 1 addition & 1 deletion src/extensions/score_metrics/traceability_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from sphinx_needs.data import NeedsView, SphinxNeedsData
from sphinx_needs.need_item import NeedItem

CALCULATED_METRICS: dict[str, object] = {}
CALCULATED_METRICS: dict[str, Any] = {}


def get_need_types_by_tags(needs: list[ScoreNeedType], tags: set[str]) -> list[str]:
Expand Down
Loading