Skip to content

feat: Add HTML report generation for outlier analysis#57

Open
ghinks wants to merge 3 commits into
mainfrom
feat/html-report-generation
Open

feat: Add HTML report generation for outlier analysis#57
ghinks wants to merge 3 commits into
mainfrom
feat/html-report-generation

Conversation

@ghinks
Copy link
Copy Markdown
Owner

@ghinks ghinks commented May 14, 2026

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

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
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

ghinks and others added 2 commits May 14, 2026 11:24
- 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>
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.

1 participant