{#- Trend dashboard for multi-snapshot Coverity metrics comparison. Rendered by ``coverity_metrics/cli/delta.py`` with a single ``delta`` dict (schema v1, trend shape) plus ``inline_css``. Deliberately dependency-free — no Plotly, no external JS, no CDN. Line charts and sparklines are hand-rolled inline SVG. Tables use the ``data-table`` class so the sortable-header autoloader at the bottom wires ▲▼ arrows onto every column at load time (repo convention, see .github/copilot-instructions.md). The ``per_project`` sparkline column exposes a numeric ``data-sort-value`` (the first→last active_defects Δ) so the autoloader's generic sort still produces a meaningful order on that column. -#} {#- ---------- Reusable SVG chart macros ---------- -#} {% macro line_chart(series, labels, width=520, height=140, color='#4a90e2', y_label='') -%} {#- Renders a fixed-viewBox SVG line chart. ``series`` may contain None to represent missing data points; the polyline is broken into segments at those positions. Y-axis min/max labels sit outside the plot area on the left. Each marker gets a native SVG
--days {{ s.days }}{% if not loop.last %},{% endif %}
{% endfor %}
{{ w.code }}: {{ w.message }}{{ instance_name }}{{ evt.name }}
{% if still_present %}
joined {{ joined }}
{% else %}
{{ joined }} → {{ last_seen }} (came & went)
{% endif %}
{{ evt.name }}
{% if was_at_start %}
last seen {{ last_seen }}
{% else %}
{{ joined }} → {{ last_seen }} (came & went)
{% endif %}
{{ u }}{{ u }}| Metric | {% for lbl in snap_labels %}{{ lbl }} | {% endfor %}First → Last Δ | %Δ |
|---|---|---|---|
| {{ label }} | {% for v in t.series %}{{ v|int }} | {% endfor %}{{ '{:+d}'.format(t.delta|int) }} | {% if t.pct_delta is not none %}{{ '{:+.1f}%'.format(t.pct_delta) }}{% else %}—{% endif %} |
{{ evt.name }}
{% if still_present %}
first active {{ joined }}
{% else %}
{{ joined }} → {{ last_seen }} (came & went)
{% endif %}
{{ evt.name }}
{% if was_at_start %}
last active {{ last_seen }}
{% else %}
{{ joined }} → {{ last_seen }} (came & went)
{% endif %}
How this is computed: {{ sc.note }}
Sparkline shows active-defect count across the {{ delta.snapshots|length }} snapshots ({{ snap_labels[0] }} → {{ snap_labels[-1] }}). Ranking is on outstanding active defects per snapshot (#1 = most active defects). ▲ means the project moved up the ranking (better, fewer active defects than before), ▼ means it moved down. Sort is by first→last active-defect Δ by default.
| Project | Active trend ({{ snap_labels|length }} points) | Active first | Active last | Δ active | %Δ | Rank first | Rank last | Δ rank |
|---|---|---|---|---|---|---|---|---|
{{ r.project_name }} |
{{ sparkline(r.active_series, snap_labels) }} | {{ r.active_first if r.active_first is not none else '—' }} | {{ r.active_last if r.active_last is not none else '—' }} | {% if r.active_delta is not none %}{{ '{:+d}'.format(r.active_delta|int) }}{% else %}—{% endif %} | {% if r.active_pct_delta is not none %}{{ '{:+.1f}%'.format(r.active_pct_delta) }}{% else %}—{% endif %} | {{ r.rank_first if r.rank_first is not none else '—' }} | {{ r.rank_last if r.rank_last is not none else '—' }} | {% if r.rank_first is none and r.rank_last is none %} came & went {% elif r.rank_first is none and r.rank_last is not none %} new {% elif r.rank_first is not none and r.rank_last is none %} dropped {% elif r.rank_delta is not none and r.rank_delta > 0 %} ▲{{ r.rank_delta|int }} {% elif r.rank_delta is not none and r.rank_delta < 0 %} ▼{{ (r.rank_delta * -1)|int }} {% else %} 0 {% endif %} |