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
5 changes: 5 additions & 0 deletions _data/criterion-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"generated_at": "2026-01-07T14:06:57Z",
"rustpython_commit": "c490a357fd54d578ae92681b8b1b4bae5006d843",
"rustpython_ref": "main"
}
8 changes: 8 additions & 0 deletions _layouts/benchmarks.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
{{ content }}
</div>

{% assign metadata = site.data["criterion-metadata"] %}
<div class="text-muted mt-2">
<small>
Generated: {{ metadata.generated_at | date: "%Y-%m-%d %H:%M" }} UTC
| RustPython commit: <a href="https://github.com/RustPython/RustPython/commit/{{ metadata.rustpython_commit }}">{{ metadata.rustpython_commit | truncate: 7, "" }}</a>
</small>
</div>
Comment on lines +25 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block can be improved for better maintainability and robustness:

  1. Hardcoded URL: The GitHub commit URL is hardcoded. It's better to use the site.github variable from _config.yml to make it more maintainable.
  2. Missing Data Check: The code doesn't check if metadata exists before trying to access its properties. If _data/criterion-metadata.json is missing, this will lead to malformed output. It's more robust to wrap the rendering logic in an {% if metadata %} block.

The suggested code below applies both improvements.

    {% assign metadata = site.data["criterion-metadata"] %}
    {% if metadata %}
        <div class="text-muted mt-2">
            <small>
                Generated: {{ metadata.generated_at | date: "%Y-%m-%d %H:%M" }} UTC
                | RustPython commit: <a href="{{ site.github }}commit/{{ metadata.rustpython_commit }}">{{ metadata.rustpython_commit | truncate: 7, "" }}</a>
            </small>
        </div>
    {% endif %}


{% assign folders = "" | split: ", " %}
{% for folder in site.static_files %}
{% if folder.path contains 'criterion/' %}
Expand Down