feat: Add HTML report generation for outlier analysis#57
Conversation
Implement standalone HTML report output format for PR outlier analysis results. - Add html_report.py module with Jinja2 template system - Update output.py to support 'html' format option - Update app.py with format validation - Add comprehensive test suite (8 tests) - Include professional, responsive HTML design - Clickable GitHub PR links with color-coded severity - Complete documentation and quick-start guide
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf85e73ae6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| from datetime import UTC, datetime | ||
| from textwrap import dedent | ||
|
|
||
| import jinja2 |
There was a problem hiding this comment.
Add Jinja2 as a runtime dependency for HTML output
The new HTML formatter imports jinja2, but the project dependency list still does not declare Jinja2, so a clean install can crash with ModuleNotFoundError when users run classify --format html. This makes the new feature unusable in environments that only install declared package dependencies.
Useful? React with 👍 / 👎.
|
|
||
| def _get_template() -> jinja2.Template: | ||
| """Load and return the HTML template.""" | ||
| return jinja2.Template(_TEMPLATE_HTML) |
There was a problem hiding this comment.
Enable autoescaping when rendering untrusted PR fields
The template is created with jinja2.Template(...) and default settings, which do not auto-escape HTML; PR titles/authors/features are inserted directly into the report, so a PR title containing markup (for example <script>) will be rendered as active HTML/JS instead of text. This creates an XSS vector and can also corrupt the report layout when viewing generated files in a browser.
Useful? React with 👍 / 👎.
- Extract _TEMPLATE_HTML from html_report.py into a standalone report.html template file loaded via importlib.resources - Fix all E501 ruff errors caused by long HTML/CSS lines in Python - Reformat two Python-side E501 lines in _format_repo and _format_outlier - Remove unused textwrap.dedent import - Add jinja2 as a declared runtime dependency (was used but undeclared) - Enable Jinja2 autoescape to fix pre-existing XSS escaping issue Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add type parameters to dict return types (dict[str, object]) - Type outlier parameter in _format_outlier as OutlierResult - Import OutlierResult for the type annotation - Remove now-obsolete noqa: ANN001 comment Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implement standalone HTML report output format for PR outlier analysis results.