-
-
Notifications
You must be signed in to change notification settings - Fork 665
Upgrade HTML output to support various CLI options #4682
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: develop
Are you sure you want to change the base?
Upgrade HTML output to support various CLI options #4682
Conversation
…license-clarity-score in HTML output The HTML output now supports --license-text, --license-text-diagnostics, --summary,--license-clarity-score Signed-off-by: uttam282005 <uttam282005@gmail.com>
Signed-off-by: uttam282005 <uttam282005@gmail.com>
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.
Pull request overview
This PR adds support for additional CLI options (--license-text, --license-text-diagnostics, --summary, --license-clarity-score) in HTML output to match functionality available in JSON/YAML formats.
Changes:
- Added template sections for Scan Summary and License Clarity Score display
- Enhanced Copyrights and Licenses table with new column for matched text and diagnostics using collapsible HTML5 details/summary elements
- Modified output_html.py to pass summary parameter through the template generation pipeline
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| src/formattedcode/templates/html/template.html | Added Scan Summary section, License Clarity Score table, and matched text/diagnostics column with collapsible display |
| src/formattedcode/output_html.py | Modified to extract and pass summary data, matched_text, and matched_text_diagnostics to template |
| tests/formattedcode/test_output_templated.py | Added integration tests for the new HTML output features |
Comments suppressed due to low confidence (2)
src/formattedcode/output_html.py:160
- Outdated docstring. The function signature includes a summary parameter, but the docstring doesn't document it. Update the docstring to describe the summary parameter.
"""
Write scan output `results` to the `output_file` opened file using a template
file at `template_loc`.
Raise an exception on errors.
"""
src/formattedcode/output_html.py:200
- Outdated docstring. The function signature includes license_references and summary parameters, but the docstring only mentions results and version. Update the docstring to describe all parameters including license_references and summary.
"""
Yield unicode strings from incrementally rendering `results` and `version`
with the Jinja `template` object.
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <p><strong>Other Holders:</strong></p> | ||
| <ul> | ||
| {% for holder in summary.other_holders %} | ||
| <li>{{ holder }}</li> |
Copilot
AI
Jan 15, 2026
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.
Incorrect template variable access. The other_holders list contains dictionary objects with 'value' and 'count' keys (similar to other_license_expressions), but the template is rendering the holder object directly instead of accessing holder.value. Change the line to display holder.value and optionally holder.count to match the format used for other_license_expressions.
| <li>{{ holder }}</li> | |
| <li>{{ holder.value }}{% if holder.count is not none %} (count: {{ holder.count }}){% endif %}</li> |
| test_file = test_env.get_test_loc('templated/simple-license.txt') | ||
| result_file = test_env.get_temp_file('html') | ||
| run_scan_click(['--license', '--license-text', test_file, '--html', result_file]) | ||
| results = open(result_file).read() |
Copilot
AI
Jan 15, 2026
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.
File is opened but is not closed.
| result_file = test_env.get_temp_file('html') | ||
| run_scan_click(['--license', '--license-text', '--license-text-diagnostics', | ||
| test_file, '--html', result_file]) | ||
| results = open(result_file).read() |
Copilot
AI
Jan 15, 2026
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.
File is opened but is not closed.
| result_file = test_env.get_temp_file('html') | ||
| run_scan_click(['--license', '--classify', '--license-clarity-score', | ||
| test_dir, '--html', result_file]) | ||
| results = open(result_file).read() |
Copilot
AI
Jan 15, 2026
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.
File is opened but is not closed.
| result_file = test_env.get_temp_file('html') | ||
| run_scan_click(['--license', '--classify', '--summary', | ||
| test_dir, '--html', result_file]) | ||
| results = open(result_file).read() |
Copilot
AI
Jan 15, 2026
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.
File is opened but is not closed.
Signed-off-by: uttam282005 <uttam282005@gmail.com>
Signed-off-by: uttam282005 <uttam282005@gmail.com>
Fixes #3281
Description
This PR adds support for additional CLI options in HTML output to match the functionality available in JSON/YAML formats:
--license-text: Display matched license text--license-text-diagnostics: Show diagnostic information for license matches--summary: Display scan summary with declared license and holder information--license-clarity-score: Show license clarity score breakdownChanges Made
Template Changes (
src/formattedcode/templates/html/template.html)<details>/<summary>elements for collapsible sections--license-textis used--license-text-diagnosticsis usedCode Changes (
src/formattedcode/output_html.py)generate_output()to passsummaryparameter totemplate.generate()process_codebase()- just needed to be passed throughTesting
Tested with various command combinations: