Skip to content

Conversation

@linw1995
Copy link

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:

  • gen_index() only displayed directories (kind = "Directory")
  • gen_dir_index() only displayed files (kind = "File")
  • No unified method to list both files and directories together.
  • The root index.html overwriten by gen_dir_index ended up showing only files, losing all directory navigation

- 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
@marco-c marco-c requested a review from lu-zero September 8, 2025 15:14
@marco-c
Copy link
Collaborator

marco-c commented Sep 8, 2025

@lu-zero could you have a look?

Copy link
Collaborator

@lu-zero lu-zero left a comment

Choose a reason for hiding this comment

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

Please remove the spurious changes and explain better what it does fix.

@marco-c do we have a policy regarding usage of LLM ?

- 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
@linw1995
Copy link
Author

linw1995 commented Sep 9, 2025

Thanks for the review! @lu-zero

Before this change, we had an inconsistency in index generation:

  • gen_dir_index() only outputs files (no directories),
  • gen_index() only outputs directories (no files),
  • And gen_dir_index() overwrites gen_index() at the root → directories lost.
  • In subdirectories, only gen_dir_index() is called → directories never appear.

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.
Apologies if this caused any concern — I want to emphasize that this patch does solve the core issue.
It just needs a bit more refinement, which I’m happy to address based on your feedback.

@lu-zero
Copy link
Collaborator

lu-zero commented Sep 9, 2025

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.

@marco-c
Copy link
Collaborator

marco-c commented Sep 11, 2025

@marco-c do we have a policy regarding usage of LLM ?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no links to subdirectories in generated html

3 participants