-
Notifications
You must be signed in to change notification settings - Fork 241
Fixed HTML Rendering - Added option to pass in console output width into HTML export #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Caution Review failedAn error occurred during the review process. Please try again later. WalkthroughAdds an optional width configuration to the HTML formatter by reading settings.width and passing it to the Console. Updates README to document the new optional --width flag (example uses 250) for Azure Blob Storage export with Microsoft Teams notifications. No public API signatures change. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant HTMLFormatter as html(result)
participant Settings as settings.width
participant Console
Caller->>HTMLFormatter: html(result)
HTMLFormatter->>Settings: read width
alt width is set
HTMLFormatter->>Console: create Console(width=width, force_terminal=False)
else
HTMLFormatter->>Console: create Console(width=None, force_terminal=False)
end
HTMLFormatter->>Console: render table
HTMLFormatter-->>Caller: return HTML with inline styles
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
README.md (1)
711-718
: Fix command: make it copy-paste safe and keep line continuationThe current example breaks when copied: parentheses become part of the command, and the previous line lacks a trailing backslash. Suggested fix:
krr simple -f html \ --azurebloboutput "https://yourstorageaccount.blob.core.windows.net/fileuploads?sv=..." \ --teams-webhook "https://your-teams-webhook-url" \ --azure-subscription-id "your-subscription-id" \ - --azure-resource-group "your-resource-group" - --width 250 (optional but HIGHLY RECOMMENDED) + --azure-resource-group "your-resource-group" \ + --width 250 # optional but HIGHLY RECOMMENDED
🧹 Nitpick comments (2)
README.md (1)
751-752
: Nit: grammar tweakUse plural “browsers”.
-Note: Consider adjusting the `--width` CLI flag for a better HTML viewing experience in browser. +Note: Consider adjusting the `--width` CLI flag for a better HTML viewing experience in browsers.robusta_krr/formatters/html.py (1)
10-11
: Simplify width handling and guard bad values; avoid forcing non-terminal unless intentional
- The explicit None check is redundant.
- Guard against non-positive widths to prevent odd wrapping.
- Consider omitting force_terminal so Rich can auto-detect; forcing non-terminal may subtly change styling/wrapping in HTML export.
- html_width = settings.width if settings.width is not None else None - console = Console(record=True, width=html_width, force_terminal=False) + width = settings.width + if width is not None and width < 1: + width = None + # Let Rich auto-detect terminal behavior; recorded HTML will still capture styles. + console = Console(record=True, width=width)Please verify that removing
force_terminal=False
preserves expected HTML styling and wrapping. If there’s a known reason to force non-terminal here, add a short code comment.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
README.md
(2 hunks)robusta_krr/formatters/html.py
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
robusta_krr/formatters/html.py (3)
robusta_krr/formatters/table.py (1)
table
(64-125)robusta_krr/core/abstract/formatters.py (1)
register
(24-48)robusta_krr/core/models/result.py (1)
Result
(62-115)
🔇 Additional comments (1)
robusta_krr/formatters/html.py (1)
5-5
: Width flag wiring verified
Both thesettings.width
field and the--width
CLI option are correctly defined and connected:
- In
robusta_krr/core/models/config.py
,
width: Optional[int] = pd.Field(None, ge=1)
provides the configuration field with proper validation (must be ≥ 1).- In
robusta_krr/main.py
,
width: Optional[int] = typer.Option(None, "--width", …)
exposes the flag and populatessettings.width
.No further changes are required.
Solves #428
Enabled use of the
--width
CLI flag to set the console width in the HTML formatter. (For better html browser viewing experience)Before: the HTML formatter console would auto detect terminal widths leading to an exported HTML file with squished table widths; which is very hard to read.