Fix HTML directory navigation by unifying file and directory handling#1395
Fix HTML directory navigation by unifying file and directory handling#1395linw1995 wants to merge 2 commits intomozilla:masterfrom
Conversation
- Introduce HtmlItemStats enum to represent both files and directories - Add list() method to HtmlGlobalStats for unified directory listing - Update HTML generation to use unified item structure - Simplify index template to handle files and directories uniformly
|
@lu-zero could you have a look? |
- Change list() parameter from String to &str to avoid allocations - Update all callers to pass string references instead of owned strings - Refactor test to use serde_json::json! macro for better readability
|
Thanks for the review! @lu-zero Before this change, we had an inconsistency in index generation:
This led to missing directory entries across the board. To resolve this, I introduce a new method that generates a unified HTML index — including both files and directories — based on the target path. I based the implementation on code suggestions from Claude to accelerate development. |
|
Ideally you can avoid much of the boilerplate still present and just have a new function instead. Worst case I'll try to look into it this weekend. |
We don't have one yet. I would say we can accept PRs where the contributor used a LLM, as long as it is not just a sloppy patch that was not even properly reviewed by the author and just wastes our time. |
resolve #1343
HTML coverage reports now properly display both files and subdirectories in the index pages, enabling complete navigation through the project structure.
The original code had separate handling for files and directories with rigid template logic: