Document HTML rendering as a pure view layer over canonical report data.
- Main renderer:
codeclone/report/html/assemble.py:build_html_report - Package entrypoint:
codeclone/report/html/__init__.py:build_html_report - Context shaping:
codeclone/report/html/_context.py - Escaping helpers:
codeclone/report/html/primitives/escape.py - Snippet/highlight helpers:
codeclone/report/html/widgets/snippets.py - Sections/widgets/assets:
codeclone/report/html/sections/*,codeclone/report/html/widgets/*,codeclone/report/html/assets/*
Inputs to the renderer:
- canonical
report_document(preferred path) - shared
report_meta - optional runtime snippet sources for code excerpts
Output:
- one self-contained HTML string
- HTML must not recompute detection semantics; it renders facts from report/core layers.
- Provenance panels mirror canonical report/meta facts.
- Overview, Quality, Suggestions, Dead Code, and Clones tabs are projections over canonical report sections.
- Quality may include report-only subtabs such as
Coverage JoinandSecurity Surfaces; these remain factual projections over canonical metrics families rather than HTML-only analysis. - IDE deep links are HTML-only UX over canonical path/line facts.
- Missing snippets or optional meta fields render safe factual fallbacks rather than invented data.
Refs:
codeclone/report/html/assemble.py:build_html_reportcodeclone/report/html/sections/_clones.py:_render_group_explanationcodeclone/report/html/sections/_meta.py:render_meta_panelcodeclone/report/html/assets/js.py:_IDE_LINKScodeclone/report/overview.py:materialize_report_overview
- User/content fields are escaped before insertion into HTML.
- Missing file snippets render explicit fallback blocks.
- Novelty badges reflect baseline trust and per-group novelty flags.
- Suppressed dead-code rows render only from report suppression payloads.
- Path-link
data-fileanddata-lineattributes are escaped before insertion.
Refs:
codeclone/report/html/primitives/escape.py:_escape_htmlcodeclone/report/html/widgets/snippets.py:_render_code_blockcodeclone/report/html/widgets/tables.py
| Condition | Behavior |
|---|---|
| Source file unreadable for snippet | Render fallback snippet with message |
| Missing/invalid optional meta field | Render empty or (none)-style display |
| Pygments unavailable | Escape-only fallback code rendering |
Refs:
codeclone/report/html/widgets/snippets.py:_FileCachecodeclone/report/html/widgets/snippets.py:_try_pygments
- Section and group ordering follow sorted canonical report inputs.
- Metadata rows are built in fixed order.
Refs:
codeclone/report/html/assemble.py:build_html_reportcodeclone/report/html/sections/_meta.py:render_meta_panel
tests/test_html_report.py::test_html_report_uses_core_block_group_factstests/test_html_report.py::test_html_report_escapes_meta_and_titletests/test_html_report.py::test_html_report_escapes_script_breakout_payloadtests/test_html_report.py::test_html_report_missing_source_snippet_fallbacktests/test_html_report.py::test_html_and_json_group_order_consistenttests/test_html_report.py::test_html_report_quality_includes_security_surfaces_subtab
- CSS, layout, and interaction details may evolve without a schema bump.
- IDE deep link behavior depends on local IDE installation and protocol handlers.