diff --git a/docs/strictdoc_01_user_guide.sdoc b/docs/strictdoc_01_user_guide.sdoc index 1040c53d1..8c46ceb4f 100644 --- a/docs/strictdoc_01_user_guide.sdoc +++ b/docs/strictdoc_01_user_guide.sdoc @@ -3839,6 +3839,35 @@ A statistics generator is a class that iterates over the traceability index, col [[/SECTION]] +[[SECTION]] +MID: 875c097b4da348938ed71de4b8e8e73b +TITLE: Document tree map screen + +[TEXT] +MID: 36067f1c73c545fea0b2408b32ee8a9a +STATEMENT: >>> +The Document Tree Map screen, or simply Tree Map, provides a visualization of the document tree and of requirements coverage by source files and tests. + +The feature can be activated as follows: + +.. code-block:: + + [project] + title = "My project" + + features = [ + "TREE_MAP_SCREEN" + ] + +The feature has experimental status because it has only been tested against StrictDoc's own documentation. Several questions still remain to be answered: + +- How to allow users to customize this screen with their own additional visualizations. +- How to allow users to customize rules for color-coding the document nodes. +- How should the traceability mechanics work when there are multiple levels of requirements and a given requirement can reference either source files or child requirements. +<<< + +[[/SECTION]] + [[SECTION]] MID: aa7ebc36cd2947ac9aa293d6c76d8848 UID: SECTION-UG-Diff-changelog-screen diff --git a/docs/strictdoc_04_release_notes.sdoc b/docs/strictdoc_04_release_notes.sdoc index 179b7dd37..7c2f63bfc 100644 --- a/docs/strictdoc_04_release_notes.sdoc +++ b/docs/strictdoc_04_release_notes.sdoc @@ -45,6 +45,20 @@ STATEMENT: >>> This document maintains a record of all changes to StrictDoc since November 2023. It serves as a user-friendly version of the changelog, complementing the automatically generated, commit-by-commit changelog available as GitHub releases: `StrictDoc Releases `_. <<< +[[SECTION]] +MID: 9e294d6a047b42bf8c55c090fb685b4a +TITLE: Unreleased + +[TEXT] +MID: ab6e1c508d224bf1bfb303a808f33f9f +STATEMENT: >>> +This release contains a new feature and several bug fixes. + +A new experimental screen, Tree Map, provides visualizations of the overall document tree as well as requirements coverage by source files and tests. The visualization is based on a tree map graph generated using Plotly.js. +<<< + +[[/SECTION]] + [[SECTION]] MID: 27d526d90cda48dfa5cbf17df88299ba TITLE: 0.12.1 (2025-09-18) diff --git a/docs/strictdoc_21_L2_StrictDoc_Requirements.sdoc b/docs/strictdoc_21_L2_StrictDoc_Requirements.sdoc index b98f088d0..71114d4b2 100644 --- a/docs/strictdoc_21_L2_StrictDoc_Requirements.sdoc +++ b/docs/strictdoc_21_L2_StrictDoc_Requirements.sdoc @@ -1064,6 +1064,31 @@ RELATIONS: [[/SECTION]] +[[SECTION]] +MID: d84e3a79b3e443cabe96d7c18ea5d322 +TITLE: Screen: Document tree map + +[REQUIREMENT] +MID: 1520fa85ed7a4f1aa80c49ed858f402f +UID: SDOC-SRS-157 +STATUS: Active +TITLE: Tree map +STATEMENT: >>> +StrictDoc shall provide a tree map screen, visualizing the following information: + +- Document tree map +- Requirements coverage by source code +- Requirements coverage by test files. +<<< +RATIONALE: >>> +Enables the visualization and browsing of the overall document tree and requirements coverage information. +<<< +RELATIONS: +- TYPE: Parent + VALUE: SDOC-SSS-29 + +[[/SECTION]] + [[SECTION]] MID: 14ad600308434e6baaeef02d3e90b720 TITLE: Screen: Traceability matrix diff --git a/strictdoc.toml b/strictdoc.toml index 0a23e3c34..fd8f0ffcf 100644 --- a/strictdoc.toml +++ b/strictdoc.toml @@ -18,6 +18,8 @@ features = [ # Experimental features. "PROJECT_STATISTICS_SCREEN", + "TREE_MAP_SCREEN", + # "REQIF", # "STANDALONE_DOCUMENT_SCREEN", "TRACEABILITY_MATRIX_SCREEN", @@ -26,7 +28,6 @@ features = [ "HTML2PDF", "DIFF", "NESTOR", - "TREEMAP_SCREEN", ] include_doc_paths = [ @@ -48,6 +49,7 @@ include_source_paths = [ "tests/integration/**itest", "tests/unit/**.py", "tests/unit_server/**.py", + "tests/end2end/**.py", "tasks.py", "pyproject.toml", ] @@ -56,9 +58,14 @@ exclude_source_paths = [ # StrictDoc (almost never) uses __init__ files. # The used files will be whitelisted include_source_paths. "**__init__.py", + "**.test.py", "build/**", "output/**", + "tests/unit/*.py", + "tests/unit/helpers/*.py", "tests/integration/**ignored.itest", + "tests/end2end/*.py", + "tests/end2end/helpers/*.py", ] test_report_root_dict = [ diff --git a/strictdoc/backend/sdoc/models/node.py b/strictdoc/backend/sdoc/models/node.py index c6c0aba77..5b93d517f 100644 --- a/strictdoc/backend/sdoc/models/node.py +++ b/strictdoc/backend/sdoc/models/node.py @@ -337,7 +337,7 @@ def is_requirement(self) -> bool: return True def is_normative_node(self) -> bool: - return not self.is_text_node() + return self.node_type not in ("SECTION", "TEXT") def is_text_node(self) -> bool: return self.node_type == "TEXT" diff --git a/strictdoc/backend/sdoc/processor.py b/strictdoc/backend/sdoc/processor.py index c58f93bfa..08a50c8bd 100644 --- a/strictdoc/backend/sdoc/processor.py +++ b/strictdoc/backend/sdoc/processor.py @@ -191,7 +191,7 @@ def process_requirement(self, requirement: SDocNode) -> None: self.parse_context.context_document_reference ) - if requirement.node_type not in ("SECTION", "TEXT"): + if requirement.is_normative_node(): self.parse_context.document_has_requirements = True cursor: Union[SDocDocumentIF, SDocSectionIF, SDocNodeIF] = ( diff --git a/strictdoc/core/project_config.py b/strictdoc/core/project_config.py index d7ca99fd5..2977a7553 100644 --- a/strictdoc/core/project_config.py +++ b/strictdoc/core/project_config.py @@ -47,7 +47,7 @@ class ProjectFeature(str, Enum): REQIF = "REQIF" DIFF = "DIFF" PROJECT_STATISTICS_SCREEN = "PROJECT_STATISTICS_SCREEN" - TREEMAP_SCREEN = "TREEMAP_SCREEN" + TREE_MAP_SCREEN = "TREE_MAP_SCREEN" STANDALONE_DOCUMENT_SCREEN = "STANDALONE_DOCUMENT_SCREEN" TRACEABILITY_MATRIX_SCREEN = "TRACEABILITY_MATRIX_SCREEN" REQUIREMENT_TO_SOURCE_TRACEABILITY = "REQUIREMENT_TO_SOURCE_TRACEABILITY" @@ -368,7 +368,7 @@ def is_activated_requirements_coverage(self) -> bool: ) def is_activated_tree_map(self) -> bool: - return ProjectFeature.TREEMAP_SCREEN in self.project_features + return ProjectFeature.TREE_MAP_SCREEN in self.project_features def is_activated_standalone_document(self) -> bool: return ( diff --git a/strictdoc/features/tree_map/generator.py b/strictdoc/features/tree_map/generator.py index 00ed77b47..56fb068e9 100644 --- a/strictdoc/features/tree_map/generator.py +++ b/strictdoc/features/tree_map/generator.py @@ -1,5 +1,9 @@ """ -TBD +Generate HTML graphs with documentation tree information. + +Uses Plotly.js for generating tree map graphs. + +@relation(SDOC-SRS-157, scope=file) """ import os diff --git a/strictdoc/features/tree_map/helpers.py b/strictdoc/features/tree_map/helpers.py index 8214e191a..844abc95a 100644 --- a/strictdoc/features/tree_map/helpers.py +++ b/strictdoc/features/tree_map/helpers.py @@ -1,3 +1,7 @@ +""" +@relation(SDOC-SRS-157, scope=file) +""" + from typing import Optional diff --git a/strictdoc/features/tree_map/plotly_js.py b/strictdoc/features/tree_map/plotly_js.py index c035bf6a6..cb72e64ad 100644 --- a/strictdoc/features/tree_map/plotly_js.py +++ b/strictdoc/features/tree_map/plotly_js.py @@ -1,3 +1,7 @@ +""" +@relation(SDOC-SRS-157, scope=file) +""" + from markupsafe import Markup PLOTLY_JS_EXTENSION = Markup(""" diff --git a/strictdoc/features/tree_map/view_object.py b/strictdoc/features/tree_map/view_object.py index 14a28e9e7..4802c9459 100644 --- a/strictdoc/features/tree_map/view_object.py +++ b/strictdoc/features/tree_map/view_object.py @@ -1,3 +1,7 @@ +""" +@relation(SDOC-SRS-157, scope=file) +""" + from markupsafe import Markup from strictdoc import __version__ diff --git a/tests/end2end/screens/source_coverage/source_file/view_source_file/file.py b/tests/end2end/screens/source_coverage/source_file/view_source_file/file.test.py similarity index 100% rename from tests/end2end/screens/source_coverage/source_file/view_source_file/file.py rename to tests/end2end/screens/source_coverage/source_file/view_source_file/file.test.py diff --git a/tests/end2end/screens/source_coverage/source_file/view_source_file/test_case.py b/tests/end2end/screens/source_coverage/source_file/view_source_file/test_case.py index 7238c12ac..5a1407efc 100644 --- a/tests/end2end/screens/source_coverage/source_file/view_source_file/test_case.py +++ b/tests/end2end/screens/source_coverage/source_file/view_source_file/test_case.py @@ -32,9 +32,9 @@ def test(self): screen_source_coverage.assert_on_screen() screen_source_coverage.assert_contains_text("strictdoc.toml") - screen_source_coverage.assert_contains_text("file.py") + screen_source_coverage.assert_contains_text("file.test.py") screen_source_file_coverage: Screen_SourceFileCoverage = ( - screen_source_coverage.do_click_on_file("file.py") + screen_source_coverage.do_click_on_file("file.test.py") ) screen_source_file_coverage.assert_on_screen() diff --git a/tests/end2end/screens/tree_map/01_tree_map_cli/strictdoc.toml b/tests/end2end/screens/tree_map/01_tree_map_cli/strictdoc.toml index dd3b52673..ae354df00 100644 --- a/tests/end2end/screens/tree_map/01_tree_map_cli/strictdoc.toml +++ b/tests/end2end/screens/tree_map/01_tree_map_cli/strictdoc.toml @@ -2,5 +2,5 @@ title = "Test project" features = [ - "TREEMAP_SCREEN" + "TREE_MAP_SCREEN" ] diff --git a/tests/end2end/screens/tree_map/01_tree_map_cli/test_case.py b/tests/end2end/screens/tree_map/01_tree_map_cli/test_case.py index e44ee38d4..4145ecf6a 100644 --- a/tests/end2end/screens/tree_map/01_tree_map_cli/test_case.py +++ b/tests/end2end/screens/tree_map/01_tree_map_cli/test_case.py @@ -1,5 +1,5 @@ """ -@relation(SDOC-SRS-155, scope=file) +@relation(SDOC-SRS-157, scope=file) """ import os diff --git a/tests/end2end/screens/tree_map/02_tree_map_server/strictdoc.toml b/tests/end2end/screens/tree_map/02_tree_map_server/strictdoc.toml index dd3b52673..ae354df00 100644 --- a/tests/end2end/screens/tree_map/02_tree_map_server/strictdoc.toml +++ b/tests/end2end/screens/tree_map/02_tree_map_server/strictdoc.toml @@ -2,5 +2,5 @@ title = "Test project" features = [ - "TREEMAP_SCREEN" + "TREE_MAP_SCREEN" ] diff --git a/tests/end2end/screens/tree_map/02_tree_map_server/test_case.py b/tests/end2end/screens/tree_map/02_tree_map_server/test_case.py index d7c6ce154..c034f4df1 100644 --- a/tests/end2end/screens/tree_map/02_tree_map_server/test_case.py +++ b/tests/end2end/screens/tree_map/02_tree_map_server/test_case.py @@ -1,5 +1,5 @@ """ -@relation(SDOC-SRS-155, scope=file) +@relation(SDOC-SRS-157, scope=file) """ import os diff --git a/tests/integration/features/html/incremental_generation/01_when_document_changes_regenerate_it/strictdoc.toml b/tests/integration/features/html/incremental_generation/01_when_document_changes_regenerate_it/strictdoc.toml index 4cb25c13c..4281b383c 100644 --- a/tests/integration/features/html/incremental_generation/01_when_document_changes_regenerate_it/strictdoc.toml +++ b/tests/integration/features/html/incremental_generation/01_when_document_changes_regenerate_it/strictdoc.toml @@ -2,5 +2,5 @@ title = "StrictDoc Documentation" features = [ - "TREEMAP_SCREEN", + "TREE_MAP_SCREEN", ]