Skip to content

Remove dead no-op Jinja2 block in report.html.j2 (broken selectattr on session_id) #275

@decko

Description

@decko

Finding

File: src/raki/report/templates/report.html.j2:1183
Severity: Minor

Problem

An empty {% if … %}{% endif %} block evaluates a complex but broken expression on every render while producing no output. It is leftover code from an abandoned attempt to detect per-session scores, superseded by the namespace(value=false) loop immediately below (lines 1185–1191).

The expression is also semantically wrong:

  • session_id in <list-of-dicts> is always False
  • selectattr('sample_scores.' ~ session_id, 'defined') fails to resolve dotted names correctly

This is confusing for future maintainers.

Suggested Fix

Delete lines 1183–1184 entirely:

{# Remove these two lines: #}
{% if sample_result.scores and session_id in%}
{% endif %}

The namespace-based check on lines 1185–1191 is the correct implementation and already handles this case.

Reference

Found during review of #273 (feat: structured drill-down sections in HTML report, ticket #250).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions